aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Providers/FanartBaseProvider.cs
blob: 548fbd5a69e5e231fcfed15f8ae05dd71fe155bc (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using System;
using MediaBrowser.Model.Logging;

namespace MediaBrowser.Controller.Providers
{
    /// <summary>
    /// Class FanartBaseProvider
    /// </summary>
    public abstract class FanartBaseProvider : BaseMetadataProvider
    {
        /// <summary>
        /// The LOG o_ FILE
        /// </summary>
        protected const string LOGO_FILE = "logo.png";
        /// <summary>
        /// The AR t_ FILE
        /// </summary>
        protected const string ART_FILE = "clearart.png";
        /// <summary>
        /// The THUM b_ FILE
        /// </summary>
        protected const string THUMB_FILE = "thumb.jpg";
        /// <summary>
        /// The DIS c_ FILE
        /// </summary>
        protected const string DISC_FILE = "disc.png";
        /// <summary>
        /// The BANNE r_ FILE
        /// </summary>
        protected const string BANNER_FILE = "banner.png";

        /// <summary>
        /// The API key
        /// </summary>
        protected const string APIKey = "5c6b04c68e904cfed1e6cbc9a9e683d4";

        protected FanartBaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager)
        {
        }

        /// <summary>
        /// Needses the refresh internal.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="providerInfo">The provider info.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
        {
            if (item.DontFetchMeta) return false;

            return DateTime.UtcNow > (providerInfo.LastRefreshed.AddDays(ConfigurationManager.Configuration.MetadataRefreshDays)) 
                && ShouldFetch(item, providerInfo);
        }

        /// <summary>
        /// Gets a value indicating whether [requires internet].
        /// </summary>
        /// <value><c>true</c> if [requires internet]; otherwise, <c>false</c>.</value>
        public override bool RequiresInternet
        {
            get
            {
                return true;
            }
        }

        /// <summary>
        /// Gets the priority.
        /// </summary>
        /// <value>The priority.</value>
        public override MetadataProviderPriority Priority
        {
            get { return MetadataProviderPriority.Third; }
        }

        /// <summary>
        /// Shoulds the fetch.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="providerInfo">The provider info.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
        protected virtual bool ShouldFetch(BaseItem item, BaseProviderInfo providerInfo)
        {
            return false;
        }

    }
}