diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-12 11:27:56 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-12 11:27:56 -0400 |
| commit | 5c873d3ed17b9291ed437b80b8ef66d4a4f2f960 (patch) | |
| tree | a4d358d500672be7e885557feba37dd205a05f37 /MediaBrowser.Controller | |
| parent | 57d7e9fccc1434d51876ab9baf23c20c80140706 (diff) | |
fixes #232 - '/' in artist causes issues.
Diffstat (limited to 'MediaBrowser.Controller')
3 files changed, 6 insertions, 99 deletions
diff --git a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs index 4c86e909b..bcaf4d525 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs @@ -8,7 +8,6 @@ using MediaBrowser.Model.Serialization; using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Threading; using System.Threading.Tasks; @@ -28,33 +27,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo } protected readonly IJsonSerializer JsonSerializer; - - /// <summary> - /// Gets or sets the FF probe cache. - /// </summary> - /// <value>The FF probe cache.</value> - protected FileSystemRepository FFProbeCache { get; set; } - - /// <summary> - /// Initializes this instance. - /// </summary> - protected override void Initialize() - { - base.Initialize(); - FFProbeCache = new FileSystemRepository(Path.Combine(ConfigurationManager.ApplicationPaths.CachePath, CacheDirectoryName)); - } - - /// <summary> - /// Gets the name of the cache directory. - /// </summary> - /// <value>The name of the cache directory.</value> - protected virtual string CacheDirectoryName - { - get - { - return "ffmpeg-video-info"; - } - } /// <summary> /// Gets the priority. @@ -86,7 +58,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo { OnPreFetch(myItem, isoMount); - var result = await GetMediaInfo(item, isoMount, item.DateModified, FFProbeCache, cancellationToken).ConfigureAwait(false); + var result = await GetMediaInfo(item, isoMount, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); @@ -123,39 +95,15 @@ namespace MediaBrowser.Controller.Providers.MediaInfo /// </summary> /// <param name="item">The item.</param> /// <param name="isoMount">The iso mount.</param> - /// <param name="lastDateModified">The last date modified.</param> - /// <param name="cache">The cache.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{MediaInfoResult}.</returns> /// <exception cref="System.ArgumentNullException">inputPath /// or /// cache</exception> - private async Task<MediaInfoResult> GetMediaInfo(BaseItem item, IIsoMount isoMount, DateTime lastDateModified, FileSystemRepository cache, CancellationToken cancellationToken) + private async Task<MediaInfoResult> GetMediaInfo(BaseItem item, IIsoMount isoMount, CancellationToken cancellationToken) { - if (cache == null) - { - throw new ArgumentNullException("cache"); - } - - // Put the ffmpeg version into the cache name so that it's unique per-version - // We don't want to try and deserialize data based on an old version, which could potentially fail - var resourceName = item.Id + "_" + lastDateModified.Ticks + "_" + MediaEncoder.Version; - - // Forumulate the cache file path - var cacheFilePath = cache.GetResourcePath(resourceName, ".js"); - cancellationToken.ThrowIfCancellationRequested(); - // Avoid File.Exists by just trying to deserialize - try - { - return JsonSerializer.DeserializeFromFile<MediaInfoResult>(cacheFilePath); - } - catch (FileNotFoundException) - { - // Cache file doesn't exist - } - var type = InputType.AudioFile; var inputPath = isoMount == null ? new[] { item.Path } : new[] { isoMount.MountedPath }; @@ -166,11 +114,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo inputPath = MediaEncoderHelpers.GetInputArgument(video, isoMount, out type); } - var info = await MediaEncoder.GetMediaInfo(inputPath, type, cancellationToken).ConfigureAwait(false); - - JsonSerializer.SerializeToFile(info, cacheFilePath); - - return info; + return await MediaEncoder.GetMediaInfo(inputPath, type, cancellationToken).ConfigureAwait(false); } /// <summary> diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs index 9bd1e2811..45ee732dd 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs @@ -24,18 +24,6 @@ namespace MediaBrowser.Controller.Providers.MediaInfo } /// <summary> - /// Gets the name of the cache directory. - /// </summary> - /// <value>The name of the cache directory.</value> - protected override string CacheDirectoryName - { - get - { - return "ffmpeg-audio-info"; - } - } - - /// <summary> /// Fetches the specified audio. /// </summary> /// <param name="audio">The audio.</param> diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs index 93533b4f0..15a9b08f0 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs @@ -35,17 +35,9 @@ namespace MediaBrowser.Controller.Providers.MediaInfo _blurayExaminer = blurayExaminer; _isoManager = isoManager; - - BdInfoCache = new FileSystemRepository(Path.Combine(ConfigurationManager.ApplicationPaths.CachePath, "bdinfo")); } /// <summary> - /// Gets or sets the bd info cache. - /// </summary> - /// <value>The bd info cache.</value> - private FileSystemRepository BdInfoCache { get; set; } - - /// <summary> /// Gets or sets the bluray examiner. /// </summary> /// <value>The bluray examiner.</value> @@ -231,7 +223,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo if (video.VideoType == VideoType.BluRay || (video.IsoType.HasValue && video.IsoType.Value == IsoType.BluRay)) { var inputPath = isoMount != null ? isoMount.MountedPath : video.Path; - FetchBdInfo(video, inputPath, BdInfoCache, cancellationToken); + FetchBdInfo(video, inputPath, cancellationToken); } AddExternalSubtitles(video); @@ -334,29 +326,12 @@ namespace MediaBrowser.Controller.Providers.MediaInfo /// </summary> /// <param name="item">The item.</param> /// <param name="inputPath">The input path.</param> - /// <param name="bdInfoCache">The bd info cache.</param> /// <param name="cancellationToken">The cancellation token.</param> - private void FetchBdInfo(BaseItem item, string inputPath, FileSystemRepository bdInfoCache, CancellationToken cancellationToken) + private void FetchBdInfo(BaseItem item, string inputPath, CancellationToken cancellationToken) { var video = (Video)item; - // Get the path to the cache file - var cacheName = item.Id + "_" + item.DateModified.Ticks; - - var cacheFile = bdInfoCache.GetResourcePath(cacheName, ".js"); - - BlurayDiscInfo result; - - try - { - result = JsonSerializer.DeserializeFromFile<BlurayDiscInfo>(cacheFile); - } - catch (FileNotFoundException) - { - result = GetBDInfo(inputPath); - - JsonSerializer.SerializeToFile(result, cacheFile); - } + var result = GetBDInfo(inputPath); cancellationToken.ThrowIfCancellationRequested(); |
