Browse Source

support new genre images

Luke Pulverenti 11 years ago
parent
commit
9e391bcffc

+ 154 - 0
MediaBrowser.Providers/ImagesByName/GenreImageProvider.cs

@@ -0,0 +1,154 @@
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Logging;
+using MediaBrowser.Model.Net;
+using MediaBrowser.Model.Providers;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Providers.ImagesByName
+{
+    public class GenreImageProvider : BaseMetadataProvider
+    {
+        private readonly IProviderManager _providerManager;
+        private readonly SemaphoreSlim _resourcePool = new SemaphoreSlim(5, 5);
+
+        public GenreImageProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
+            : base(logManager, configurationManager)
+        {
+            _providerManager = providerManager;
+        }
+
+        public override bool Supports(BaseItem item)
+        {
+            return item is Genre;
+        }
+
+        public override bool RequiresInternet
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+        public override ItemUpdateType ItemUpdateType
+        {
+            get
+            {
+                return ItemUpdateType.ImageUpdate;
+            }
+        }
+
+        protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
+        {
+            if (item.HasImage(ImageType.Primary) && item.HasImage(ImageType.Thumb))
+            {
+                return false;
+            }
+
+            return base.NeedsRefreshInternal(item, providerInfo);
+        }
+
+        protected override bool RefreshOnVersionChange
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+        protected override string ProviderVersion
+        {
+            get
+            {
+                return "6";
+            }
+        }
+
+        public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
+        {
+            if (item.HasImage(ImageType.Primary) && item.HasImage(ImageType.Thumb))
+            {
+                SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
+                return true;
+            }
+
+            var images = await _providerManager.GetAvailableRemoteImages(item, cancellationToken, GenresManualImageProvider.ProviderName).ConfigureAwait(false);
+
+            await DownloadImages(item, images.ToList(), cancellationToken).ConfigureAwait(false);
+
+            SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
+            return true;
+        }
+
+        private async Task DownloadImages(BaseItem item, List<RemoteImageInfo> images, CancellationToken cancellationToken)
+        {
+            if (!item.LockedFields.Contains(MetadataFields.Images))
+            {
+                cancellationToken.ThrowIfCancellationRequested();
+
+                if (!item.HasImage(ImageType.Primary))
+                {
+                    await SaveImage(item, images, ImageType.Primary, cancellationToken).ConfigureAwait(false);
+                }
+                cancellationToken.ThrowIfCancellationRequested();
+
+                if (!item.HasImage(ImageType.Thumb))
+                {
+                    await SaveImage(item, images, ImageType.Thumb, cancellationToken).ConfigureAwait(false);
+                }
+            }
+
+            if (!item.LockedFields.Contains(MetadataFields.Backdrops))
+            {
+                cancellationToken.ThrowIfCancellationRequested();
+
+                if (item.BackdropImagePaths.Count == 0)
+                {
+                    foreach (var image in images.Where(i => i.Type == ImageType.Backdrop))
+                    {
+                        await _providerManager.SaveImage(item, image.Url, _resourcePool, ImageType.Backdrop, null, cancellationToken)
+                            .ConfigureAwait(false);
+
+                        break;
+                    }
+                }
+            }
+        }
+
+
+        private async Task SaveImage(BaseItem item, IEnumerable<RemoteImageInfo> images, ImageType type, CancellationToken cancellationToken)
+        {
+            foreach (var image in images.Where(i => i.Type == type))
+            {
+                try
+                {
+                    await _providerManager.SaveImage(item, image.Url, _resourcePool, type, null, cancellationToken).ConfigureAwait(false);
+                    break;
+                }
+                catch (HttpException ex)
+                {
+                    // Sometimes fanart has bad url's in their xml
+                    if (ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound)
+                    {
+                        continue;
+                    }
+                    break;
+                }
+            }
+        }
+
+        public override MetadataProviderPriority Priority
+        {
+            get { return MetadataProviderPriority.Third; }
+        }
+    }
+}

+ 128 - 0
MediaBrowser.Providers/ImagesByName/GenresManualImageProvider.cs

@@ -0,0 +1,128 @@
+using MediaBrowser.Common.IO;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Providers;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Providers.ImagesByName
+{
+    public class GenresManualImageProvider : IImageProvider
+    {
+        private readonly IServerConfigurationManager _config;
+        private readonly IHttpClient _httpClient;
+        private readonly IFileSystem _fileSystem;
+
+        private readonly SemaphoreSlim _listResourcePool = new SemaphoreSlim(1, 1);
+
+        public GenresManualImageProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem)
+        {
+            _config = config;
+            _httpClient = httpClient;
+            _fileSystem = fileSystem;
+        }
+
+        public string Name
+        {
+            get { return ProviderName; }
+        }
+
+        public static string ProviderName
+        {
+            get { return "Media Browser"; }
+        }
+
+        public bool Supports(IHasImages item)
+        {
+            return item is Genre;
+        }
+
+        public Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, ImageType imageType, CancellationToken cancellationToken)
+        {
+            return GetImages(item, imageType == ImageType.Primary, imageType == ImageType.Backdrop, cancellationToken);
+        }
+
+        public Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken)
+        {
+            return GetImages(item, true, true, cancellationToken);
+        }
+
+        private async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, bool posters, bool backdrops, CancellationToken cancellationToken)
+        {
+            var list = new List<RemoteImageInfo>();
+
+            if (posters)
+            {
+                var posterPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotegenreposters.txt");
+
+                await EnsurePosterList(posterPath, cancellationToken).ConfigureAwait(false);
+
+                list.Add(GetImage(item, posterPath, ImageType.Primary, "folder"));
+            }
+
+            cancellationToken.ThrowIfCancellationRequested();
+
+            if (backdrops)
+            {
+                var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotegenrethumbs.txt");
+
+                await EnsureThumbsList(thumbsPath, cancellationToken).ConfigureAwait(false);
+
+                list.Add(GetImage(item, thumbsPath, ImageType.Thumb, "thumb"));
+            }
+
+            return list.Where(i => i != null);
+        }
+
+        private RemoteImageInfo GetImage(IHasImages item, string filename, ImageType type, string remoteFilename)
+        {
+            var list = ImageUtils.GetAvailableImages(filename);
+
+            var match = ImageUtils.FindMatch(item, list);
+
+            if (!string.IsNullOrEmpty(match))
+            {
+                var url = GetUrl(match, remoteFilename);
+
+                return new RemoteImageInfo
+                {
+                    ProviderName = Name,
+                    Type = type,
+                    Url = url
+                };
+            }
+
+            return null;
+        }
+
+        private string GetUrl(string image, string filename)
+        {
+            return string.Format("https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/imagesbyname/genres/{0}/{1}.jpg", image, filename);
+        }
+
+        private Task EnsureThumbsList(string file, CancellationToken cancellationToken)
+        {
+            const string url = "https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/imagesbyname/genrethumbs.txt";
+
+            return ImageUtils.EnsureList(url, file, _httpClient, _fileSystem, _listResourcePool, cancellationToken);
+        }
+
+        private Task EnsurePosterList(string file, CancellationToken cancellationToken)
+        {
+            const string url = "https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/imagesbyname/genreposters.txt";
+
+            return ImageUtils.EnsureList(url, file, _httpClient, _fileSystem, _listResourcePool, cancellationToken);
+        }
+
+        public int Priority
+        {
+            get { return 0; }
+        }
+    }
+}

+ 83 - 0
MediaBrowser.Providers/ImagesByName/ImageUtils.cs

@@ -0,0 +1,83 @@
+using MediaBrowser.Common.IO;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Entities;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Providers.ImagesByName
+{
+    public static class ImageUtils
+    {
+        /// <summary>
+        /// Ensures the list.
+        /// </summary>
+        /// <param name="url">The URL.</param>
+        /// <param name="file">The file.</param>
+        /// <param name="httpClient">The HTTP client.</param>
+        /// <param name="fileSystem">The file system.</param>
+        /// <param name="semaphore">The semaphore.</param>
+        /// <param name="cancellationToken">The cancellation token.</param>
+        /// <returns>Task.</returns>
+        public static async Task EnsureList(string url, string file, IHttpClient httpClient, IFileSystem fileSystem, SemaphoreSlim semaphore, CancellationToken cancellationToken)
+        {
+            var fileInfo = new FileInfo(file);
+
+            if (!fileInfo.Exists || (DateTime.UtcNow - fileSystem.GetLastWriteTimeUtc(fileInfo)).TotalDays > 1)
+            {
+                await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
+
+                try
+                {
+                    var temp = await httpClient.GetTempFile(new HttpRequestOptions
+                    {
+                        CancellationToken = cancellationToken,
+                        Progress = new Progress<double>(),
+                        Url = url
+
+                    }).ConfigureAwait(false);
+
+                    Directory.CreateDirectory(Path.GetDirectoryName(file));
+
+                    File.Copy(temp, file, true);
+                }
+                finally
+                {
+                    semaphore.Release();
+                }
+            }
+        }
+
+        public static string FindMatch(IHasImages item, IEnumerable<string> images)
+        {
+            var name = GetComparableName(item.Name);
+
+            return images.FirstOrDefault(i => string.Equals(name, GetComparableName(i), StringComparison.OrdinalIgnoreCase));
+        }
+
+        private static string GetComparableName(string name)
+        {
+            return name.Replace(" ", string.Empty).Replace(".", string.Empty).Replace("&", string.Empty).Replace("!", string.Empty);
+        }
+
+        public static IEnumerable<string> GetAvailableImages(string file)
+        {
+            using (var reader = new StreamReader(file))
+            {
+                var lines = new List<string>();
+
+                while (!reader.EndOfStream)
+                {
+                    var text = reader.ReadLine();
+
+                    lines.Add(text);
+                }
+
+                return lines;
+            }
+        }
+    }
+}

+ 2 - 2
MediaBrowser.Providers/Studios/StudioImageProvider.cs → MediaBrowser.Providers/ImagesByName/StudioImageProvider.cs

@@ -13,7 +13,7 @@ using System.Net;
 using System.Threading;
 using System.Threading.Tasks;
 
-namespace MediaBrowser.Providers.Studios
+namespace MediaBrowser.Providers.ImagesByName
 {
     public class StudioImageProvider : BaseMetadataProvider
     {
@@ -69,7 +69,7 @@ namespace MediaBrowser.Providers.Studios
         {
             get
             {
-                return "5";
+                return "6";
             }
         }
 

+ 128 - 0
MediaBrowser.Providers/ImagesByName/StudiosManualImageProvider.cs

@@ -0,0 +1,128 @@
+using MediaBrowser.Common.IO;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Providers;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Providers.ImagesByName
+{
+    public class StudiosManualImageProvider : IImageProvider
+    {
+        private readonly IServerConfigurationManager _config;
+        private readonly IHttpClient _httpClient;
+        private readonly IFileSystem _fileSystem;
+
+        private readonly SemaphoreSlim _listResourcePool = new SemaphoreSlim(1, 1);
+
+        public StudiosManualImageProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem)
+        {
+            _config = config;
+            _httpClient = httpClient;
+            _fileSystem = fileSystem;
+        }
+
+        public string Name
+        {
+            get { return ProviderName; }
+        }
+
+        public static string ProviderName
+        {
+            get { return "Media Browser"; }
+        }
+
+        public bool Supports(IHasImages item)
+        {
+            return item is Studio;
+        }
+
+        public Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, ImageType imageType, CancellationToken cancellationToken)
+        {
+            return GetImages(item, imageType == ImageType.Primary, imageType == ImageType.Backdrop, cancellationToken);
+        }
+
+        public Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken)
+        {
+            return GetImages(item, true, true, cancellationToken);
+        }
+
+        private async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, bool posters, bool backdrops, CancellationToken cancellationToken)
+        {
+            var list = new List<RemoteImageInfo>();
+
+            if (posters)
+            {
+                var posterPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudioposters.txt");
+
+                await EnsurePosterList(posterPath, cancellationToken).ConfigureAwait(false);
+
+                list.Add(GetImage(item, posterPath, ImageType.Primary, "folder"));
+            }
+
+            cancellationToken.ThrowIfCancellationRequested();
+
+            if (backdrops)
+            {
+                var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudiothumbs.txt");
+
+                await EnsureThumbsList(thumbsPath, cancellationToken).ConfigureAwait(false);
+
+                list.Add(GetImage(item, thumbsPath, ImageType.Thumb, "thumb"));
+            }
+
+            return list.Where(i => i != null);
+        }
+
+        private RemoteImageInfo GetImage(IHasImages item, string filename, ImageType type, string remoteFilename)
+        {
+            var list = ImageUtils.GetAvailableImages(filename);
+
+            var match = ImageUtils.FindMatch(item, list);
+
+            if (!string.IsNullOrEmpty(match))
+            {
+                var url = GetUrl(match, remoteFilename);
+
+                return new RemoteImageInfo
+                {
+                    ProviderName = Name,
+                    Type = type,
+                    Url = url
+                };
+            }
+
+            return null;
+        }
+
+        private string GetUrl(string image, string filename)
+        {
+            return string.Format("https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/imagesbyname/studios/{0}/{1}.jpg", image, filename);
+        }
+
+        private Task EnsureThumbsList(string file, CancellationToken cancellationToken)
+        {
+            const string url = "https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/imagesbyname/studiothumbs.txt";
+
+            return ImageUtils.EnsureList(url, file, _httpClient, _fileSystem, _listResourcePool, cancellationToken);
+        }
+
+        private Task EnsurePosterList(string file, CancellationToken cancellationToken)
+        {
+            const string url = "https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/imagesbyname/studioposters.txt";
+
+            return ImageUtils.EnsureList(url, file, _httpClient, _fileSystem, _listResourcePool, cancellationToken);
+        }
+
+        public int Priority
+        {
+            get { return 0; }
+        }
+    }
+}

+ 5 - 8
MediaBrowser.Providers/MediaBrowser.Providers.csproj

@@ -66,6 +66,9 @@
     <Compile Include="Games\GameSystemProviderFromXml.cs" />
     <Compile Include="ImageFromMediaLocationProvider.cs" />
     <Compile Include="ImagesByNameProvider.cs" />
+    <Compile Include="ImagesByName\GenreImageProvider.cs" />
+    <Compile Include="ImagesByName\GenresManualImageProvider.cs" />
+    <Compile Include="ImagesByName\ImageUtils.cs" />
     <Compile Include="LiveTv\ChannelProviderFromXml.cs" />
     <Compile Include="MediaInfo\AudioImageProvider.cs" />
     <Compile Include="MediaInfo\BaseFFProbeProvider.cs" />
@@ -120,8 +123,8 @@
     <Compile Include="Savers\SeasonXmlSaver.cs" />
     <Compile Include="Savers\SeriesXmlSaver.cs" />
     <Compile Include="Savers\XmlSaverHelpers.cs" />
-    <Compile Include="Studios\StudioImageProvider.cs" />
-    <Compile Include="Studios\StudiosManualImageProvider.cs" />
+    <Compile Include="ImagesByName\StudioImageProvider.cs" />
+    <Compile Include="ImagesByName\StudiosManualImageProvider.cs" />
     <Compile Include="TV\EpisodeImageFromMediaLocationProvider.cs" />
     <Compile Include="TV\EpisodeIndexNumberProvider.cs" />
     <Compile Include="TV\EpisodeProviderFromXml.cs" />
@@ -167,12 +170,6 @@
   <ItemGroup>
     <None Include="packages.config" />
   </ItemGroup>
-  <ItemGroup>
-    <EmbeddedResource Include="Studios\thumbs.txt" />
-  </ItemGroup>
-  <ItemGroup>
-    <EmbeddedResource Include="Studios\posters.txt" />
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition=" '$(ConfigurationName)' != 'Release Mono' " />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+ 0 - 135
MediaBrowser.Providers/Studios/StudiosManualImageProvider.cs

@@ -1,135 +0,0 @@
-using MediaBrowser.Controller.Entities;
-using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Providers;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Providers.Studios
-{
-    public class StudiosManualImageProvider : IImageProvider
-    {
-        public string Name
-        {
-            get { return ProviderName; }
-        }
-
-        public static string ProviderName
-        {
-            get { return "Media Browser"; }
-        }
-
-        public bool Supports(IHasImages item)
-        {
-            return item is Studio;
-        }
-
-        public Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, ImageType imageType, CancellationToken cancellationToken)
-        {
-            return GetImages(item, imageType == ImageType.Primary, imageType == ImageType.Backdrop, cancellationToken);
-        }
-
-        public Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken)
-        {
-            return GetImages(item, true, true, cancellationToken);
-        }
-
-        private Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, bool posters, bool backdrops, CancellationToken cancellationToken)
-        {
-            var list = new List<RemoteImageInfo>();
-
-            if (posters)
-            {
-                list.Add(GetImage(item, "posters.txt", ImageType.Primary, "folder"));
-            }
-
-            cancellationToken.ThrowIfCancellationRequested();
-
-            if (backdrops)
-            {
-                list.Add(GetImage(item, "thumbs.txt", ImageType.Thumb, "thumb"));
-            }
-            
-            return Task.FromResult(list.Where(i => i != null));
-        }
-
-        private RemoteImageInfo GetImage(IHasImages item, string filename, ImageType type, string remoteFilename)
-        {
-            var url = GetUrl(item, filename, remoteFilename);
-
-            if (url != null)
-            {
-                return new RemoteImageInfo
-                {
-                    ProviderName = Name,
-                    Type = type,
-                    Url = url
-                };
-            }
-
-            return null;
-        }
-
-        private string GetUrl(IHasImages item, string listingFilename, string remoteFilename)
-        {
-            var list = GetAvailableImages(listingFilename);
-
-            var match = FindMatch(item, list);
-
-            if (!string.IsNullOrEmpty(match))
-            {
-                return GetUrl(match, remoteFilename);
-            }
-
-            return null;
-        }
-
-        private string FindMatch(IHasImages item, IEnumerable<string> images)
-        {
-            var name = GetComparableName(item.Name);
-
-            return images.FirstOrDefault(i => string.Equals(name, GetComparableName(i), StringComparison.OrdinalIgnoreCase));
-        }
-
-        private string GetComparableName(string name)
-        {
-            return name.Replace(" ", string.Empty).Replace(".", string.Empty).Replace("&", string.Empty).Replace("!", string.Empty);
-        }
-
-        private string GetUrl(string image, string filename)
-        {
-            return string.Format("https://raw.github.com/MediaBrowser/MediaBrowser.Resources/master/images/studios/{0}/{1}.jpg", image, filename);
-        }
-
-        private IEnumerable<string> GetAvailableImages(string filename)
-        {
-            var path = GetType().Namespace + "." + filename;
-
-            using (var stream = GetType().Assembly.GetManifestResourceStream(path))
-            {
-                using (var reader = new StreamReader(stream))
-                {
-                    var lines = new List<string>();
-
-                    while (!reader.EndOfStream)
-                    {
-                        var text = reader.ReadLine();
-
-                        lines.Add(text);
-                    }
-
-                    return lines;
-                }
-            }
-        }
-
-        public int Priority
-        {
-            get { return 0; }
-        }
-    }
-}

+ 0 - 0
MediaBrowser.Providers/Studios/posters.txt


+ 0 - 493
MediaBrowser.Providers/Studios/thumbs.txt

@@ -1,493 +0,0 @@
-15 Gigs
-19 Entertainment
-20th Television
-321 Productions
-4K Media
-4Kids Entertainment
-A La Carte Communications
-A&E
-Aardman
-ABC
-ABC Family
-ABC News
-ABC Studios
-Above Average
-Acacia Fitness
-Action Television
-Advertising Age
-All Channel Films
-All3Media
-Alli
-Alliance Entertainment
-Alloy
-AllWarriorNetwork
-American Pop Classics
-Ananey
-Anchor Bay Entertainment
-Anderson Digital
-Animal Planet
-Animation Domination High-Def
-Anime Network
-Aniplex
-Artists Den Entertainment
-Asian Crush
-Atlantic Records
-Attention Span
-Austin City Limits Music Festival
-Australian Broadcasting Corporation
-Australian Food TV
-Avalon UK
-Azteca America
-Bandai
-Base 79
-BBC Worldwide
-Beliefnet
-Believe
-BET
-Beta Film
-Big Air Studios
-BIGFlix
-bio
-Blame Society
-Blastro Networks
-Bloody Disgusting Selects
-Bloomberg
-Bonnier TV Group
-Border Entertainment
-Brain Farm
-Brainstorm Media
-Brave New Films
-Bravo
-Broadway Video
-Brushfire Records
-Butaca
-BVTV
-C3 Entertainment
-Canal 13 de Chile
-Candlelight Media
-Candor TV
-Caracol Television
-Carsey Werner
-CBS
-CelebTV
-Charlie Rose
-Cheflive
-CHIC.TV
-Chiller
-China Lion
-Cine Real
-Cinedigm
-CINELAN
-Cinema Guild
-Cinema Libre Studio
-Cinema Purgatorio
-CineSport
-Cirque du Soleil
-Citizens United Productions No. 3
-CJ Entertainment
-Classic Media
-Clinton Global Initiative
-Cloo
-ClubWPT
-CNBC
-CODA BOOKS
-CollegeHumor
-Comedy Central
-Comedy Time
-Conde Nast Digital
-Constantin Film
-Content and Co
-Content Family
-Content Media Corporation
-Contentino
-Cooking Channel
-Crackle
-Crime & Investigation Network
-Criterion Collection
-CRM
-Cuppa Coffee
-Dark Sky Films
-Dave Matthews Band
-Davis Panzer
-Debutante Inc
-Digital Artists
-Digital Rights Group
-Digital Studios
-Discovery Channel
-Discovery
-Distribber
-Diva
-DIY Network
-DocComTV
-DramaFever
-Duopoly
-E! Entertainment
-EA Sports
-Eagle Media
-Eagle Rock
-Echo Bridge Entertainment
-Echo Pictures
-EchoBoom Sports
-Edmunds
-ElecPlay
-Electric Entertainment
-Electric Sky
-ELLE
-EMI
-Enchanted Tales
-Endemol
-Entertainment Rights
-eOne Entertainment Distribution
-Epicurious.com
-Eqal
-Esquire Network
-Estrella TV
-Everyday Edisons
-Evil Global
-Exclusive Media
-ExerciseTV
-Fanclub
-Fangoria
-FEARnet
-Fever Dreams
-Fight TV
-Film Ideas on Demand
-Film Movement
-Film Sales Company
-FilmBuff
-Finley-Holiday Films
-First Look Studios
-First Run Features
-Focus Features
-Food Network
-FORA.tv
-Ford
-FOX
-Fox College Sports
-Fox Movie Channel
-Fox News
-Fox Reality
-Fox Sports
-Fox Sports Net
-Fox Television Classics
-Frantic Films
-FremantleMedia
-FUEL TV
-FUNimation
-FX
-FXM
-FXX
-G4
-Gaiam
-Galavision
-GameTrailers
-Generate
-George Dickel
-Giant Ape Media
-Glamour Films
-GoDigital
-Golf TV
-Gong
-Gorilla Pictures
-Gravitas
-Gravitas Horror
-GreenLight Media
-GT Media
-H2
-Handmade TV
-Hat Trick
-HD Films, Inc
-Health Science Channel
-HealthiNation
-HereTV
-HGTV
-Historic Films
-History
-History en Español
-HitFix
-Hollywood Pictures
-How it Works
-Howcast
-Howdini
-Hudsun Media
-Hulu Original Series
-Hype
-Iconix
-iCue.com
-IFC
-IFC Films
-IGN
-Image Entertainment
-Imagina US
-Independent Comedy Network
-Independent International Pictures Corp
-Indie Crush
-IndieFlix
-itsallinyourhands.tv
-ITV
-ITV1
-Janson Media
-Jim Henson Family TV
-K2
-KCET
-Kidz Bop
-Kino Lorber
-KinoNation
-Klown
-Koan
-L Studio
-Lagardere
-Laguna Productions
-Latin Crush
-Legend Fighting Championship
-Legend Films
-Lifetime
-Link TV
-Lionsgate
-Liquid Comics
-Litton Entertainment
-LMN
-Local Food Sustainable Network
-Logo
-lolflix
-Long Way Round
-Look
-Lou Reda Productions
-Lucha Libre USA
-LXTV
-MAN
-Manga Entertainment
-Manolin Studios
-Mar Vista
-Martha Stewart Living
-Marvel
-Maverick Entertainment
-Maya
-MBC America
-Media Blasters
-Mentorn
-MGM
-MHz Networks
-Midnight Pulp
-Military History
-Millennium Media Services
-Modelinia
-Mojo
-MoMedia
-Monterey Media
-Moonscoop
-Moshcam
-Movieola
-Movies by OHM
-Moving Art
-MPI
-MSNBC
-MTV
-MulticomTV
-MVD Entertainment Group
-My Vortexx
-My Yoga
-MyNetworkTV
-NASA
-Nat Geo Wild
-National Geographic Channel
-NBC
-NBC News
-NBC Sports
-NBC Universal
-NBCU TV
-NCircle
-Netflix
-New Renaissance
-NHL
-Nickelodeon
-NickMom
-Nikki Sixx
-Nirvana Films
-NIS America
-Novel Ruby Productions
-NowThisNews
-nuvoTV
-O2 Media
-OhmTV
-Oops Doughnuts
-Ora TV
-Orange Lounge
-ORF Universum
-Oscilloscope Laboratories
-Oxygen
-Paley Media
-Panna
-Paranormal TV
-Passion River
-PBS Kids
-Phase 4 Films
-Players Network
-Plum TV
-PopSugar TV
-Power Rangers
-PPI Releasing
-PRO
-Pure Adrenaline
-Pure History
-Pure Nature
-Pure Science
-Questar
-Quintus Media
-Quiver
-Rajshri Media
-Raphael Saadiq
-Razor & Tie
-RCTV
-Real Magic TV
-Red Bull
-Red Hour Digital
-ReelAfrican
-ReelzChannel
-Revolver
-Rick Steves' Network
-RiffTrax
-Right Network
-Riverhorse
-Roadside Attractions
-Ron Hazelton Productions
-RooftopComedy
-Rovio
-RSA
-RT
-RTE
-S and S Entertainment
-Saavn
-Sachs Judah
-Salient Media
-Satelight
-Saturday Morning TV
-SBS
-SBS Australia
-Scholastic
-Science Channel
-Scott Entertainment
-Screen Media
-Sesame Street
-Shaftesbury
-Shemaroo
-Shochiku
-Shout! Factory
-Showtime
-Shree International
-Sky Studios
-SnagFilms
-SOFA
-SOMA
-Sonar Entertainment
-Sony Pictures Television
-SoPeachi
-Source Interlink Media
-SpaceRip
-SPEED
-Speed Racer Enterprises
-Spike
-Spike TV
-Stand Up To Cancer
-Starz
-Strand Releasing
-Strike.TV
-Sundance Channel
-SunWorld Pictures
-Sweet Irony
-Syfy
-Syndicado
-Synergetic
-Talking Baseball with Ed Randall
-Tantao Entertainment
-TasteTV
-Telepictures
-TenduTV
-The Cannell Studios
-The CW
-The Democratic National Convention
-The Denis Leary Podcasts
-The Global Film Initiative
-The Jim Henson Company
-The Kitchen Diva
-The LXD
-The Military Network
-The Morning After
-The National Film Board of Canada
-The New York Times
-The Onion
-The OnLine Network
-The Orchard
-The Rebound
-The Situation Workout
-The Sundance Institute
-The Three Stooges
-The Weinstein Company
-The White House
-The Wine Library
-The Zalman King Company
-This Week In Studios
-Thunderbird
-Tiny Island Productions
-TLA Releasing
-TLC
-TMS Entertainment
-Toei Animation
-Tokyopop
-Total College Sports
-Total Content Digital
-Touchstone Pictures
-Tr3s
-Transworld
-Travel Channel
-Troma
-TV Globo
-TV Land
-TVF International
-TVG Interactive Horseracing
-TVGN
-Twentieth Century Fox
-Uncork'd Entertainment
-UniMas
-Universal Pictures
-Universal Sports
-Universal Television
-Univision
-unwrapped.tv
-USA
-USA Network
-uStudio
-Vanguard Cinema
-Venevision
-Venus
-VH1
-Vibrant Media
-Videofashion
-viewster
-ViKi
-Virgil Films
-Vision Films
-Vivendi Entertainment
-VIZ Media
-Vogue.TV
-Wall Street Journal
-Warner Bros. Records
-WatchMojo.com
-Water.org
-WCG
-WE tv
-Web Therapy
-Well Go
-WEP
-Westchester Films
-Wolfe Video
-WWE
-Yan Can Cook
-Young Hollywood
-YourTango
-ZDF Enterprises
-ZED
-Zeitgeist Films
-Zodiak Kids
-Zodiak Rights
-ZoomTV

+ 1 - 1
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

@@ -791,7 +791,7 @@ namespace MediaBrowser.Server.Implementations.Library
 
             var id = path.GetMBId(type);
 
-            var item = RetrieveItem(id) as T;
+            var item = isNew ? null : RetrieveItem(id) as T;
 
             if (item == null)
             {