aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
blob: 6222eec5f7f39f773412abd23170f19ca157aacc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Threading.Tasks;
using MediaBrowser.Controller.Events;
using MediaBrowser.Model.Entities;

namespace MediaBrowser.Controller.Providers
{
    public abstract class BaseMetadataProvider : IDisposable
    {
        /// <summary>
        /// If the provider needs any startup routines, add them here
        /// </summary>
        public virtual void Init()
        {
        }

        /// <summary>
        /// Disposes anything created during Init
        /// </summary>
        public virtual void Dispose()
        {
        }

        public abstract bool Supports(BaseEntity item);

        public virtual bool RequiresInternet
        {
            get
            {
                return false;
            }
        }

        public abstract Task Fetch(BaseEntity item, ItemResolveEventArgs args);

        public abstract MetadataProviderPriority Priority { get; }
    }

    /// <summary>
    /// Determines when a provider should execute, relative to others
    /// </summary>
    public enum MetadataProviderPriority
    {
        // Run this provider at the beginning
        First = 1,

        // Run this provider after all first priority providers
        Second = 2,

        // Run this provider after all second priority providers
        Third = 3,

        // Run this provider last
        Last = 4
    }
}