From 0f3934454b395aa8553724782e0b69774cc38c18 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 14 Mar 2018 22:27:05 -0400 Subject: [PATCH] Cleanup: Cleanup Import/Parsing Files --- .../TrackImport/ImportApprovedTracks.cs | 29 ------------- .../MediaFiles/TrackImport/ImportDecision.cs | 4 +- .../TrackImport/ImportDecisionMaker.cs | 5 --- src/NzbDrone.Core/Parser/Parser.cs | 41 ------------------- src/NzbDrone.Core/Parser/ParsingService.cs | 28 ------------- 5 files changed, 1 insertion(+), 106 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportApprovedTracks.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportApprovedTracks.cs index d8698ab80..5bc14858b 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportApprovedTracks.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportApprovedTracks.cs @@ -6,13 +6,11 @@ using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Qualities; -using NzbDrone.Core.Parser; using System; using System.Collections.Generic; using System.Linq; using System.Text; using NzbDrone.Core.Extras; -using NzbDrone.Core.Music; using NzbDrone.Core.Languages; namespace NzbDrone.Core.MediaFiles.TrackImport @@ -29,13 +27,11 @@ public class ImportApprovedTracks : IImportApprovedTracks private readonly IExtraService _extraService; private readonly IDiskProvider _diskProvider; private readonly IEventAggregator _eventAggregator; - private readonly IAlbumRepository _albumRepository; private readonly Logger _logger; public ImportApprovedTracks(IUpgradeMediaFiles episodeFileUpgrader, IMediaFileService mediaFileService, IExtraService extraService, - IAlbumRepository albumRepository, IDiskProvider diskProvider, IEventAggregator eventAggregator, Logger logger) @@ -43,7 +39,6 @@ public ImportApprovedTracks(IUpgradeMediaFiles episodeFileUpgrader, _trackFileUpgrader = episodeFileUpgrader; _mediaFileService = mediaFileService; _extraService = extraService; - _albumRepository = albumRepository; _diskProvider = diskProvider; _eventAggregator = eventAggregator; _logger = logger; @@ -168,29 +163,5 @@ public List Import(List decisions, bool newDownloa return importResults; } - - //private string GetSceneName(DownloadClientItem downloadClientItem, LocalEpisode localEpisode) - //{ - // if (downloadClientItem != null) - // { - // var title = Parser.Parser.RemoveFileExtension(downloadClientItem.Title); - - // var parsedTitle = Parser.Parser.ParseTitle(title); - - // if (parsedTitle != null && !parsedTitle.FullSeason) - // { - // return title; - // } - // } - - // var fileName = Path.GetFileNameWithoutExtension(localEpisode.Path.CleanFilePath()); - - // if (SceneChecker.IsSceneTitle(fileName)) - // { - // return fileName; - // } - - // return null; - //} } } diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecision.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecision.cs index 885ec60b0..be28f2541 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecision.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecision.cs @@ -1,4 +1,4 @@ -using NzbDrone.Common.Extensions; +using NzbDrone.Common.Extensions; using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.Parser.Model; using System; @@ -15,8 +15,6 @@ public class ImportDecision public bool Approved => Rejections.Empty(); - public object LocalEpisode { get; internal set; } - public ImportDecision(LocalTrack localTrack, params Rejection[] rejections) { LocalTrack = localTrack; diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs index c68ab007f..2a39b6506 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs @@ -172,11 +172,6 @@ private bool ShouldUseFolderName(List musicFiles, Artist artist, ParsedT return false; } - //if (folderInfo.FullSeason) - //{ - // return false; - //} - return musicFiles.Count(file => { diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 398791db0..e60ddf216 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -6,12 +6,10 @@ using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Common.Instrumentation; -using NzbDrone.Core.MediaFiles.MediaInfo; using NzbDrone.Core.Music; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Languages; using TagLib; -using TagLib.IFD.Tags; namespace NzbDrone.Core.Parser { @@ -290,35 +288,9 @@ public static ParsedTrackInfo ParseMusicTitle(string title) if (result != null) { - //if (result.FullSeason && title.ContainsIgnoreCase("Special")) - //{ - // result.FullSeason = false; - // result.Special = true; - //} - - //result.Language = LanguageParser.ParseLanguage(title); - //Logger.Debug("Language parsed: {0}", result.Language); - result.Quality = QualityParser.ParseQuality(title, null, 0); Logger.Debug("Quality parsed: {0}", result.Quality); - // Majora: We don't currently need Release Group for Music. - //result.ReleaseGroup = ParseReleaseGroup(title); - - //var subGroup = GetSubGroup(match); - //if (!subGroup.IsNullOrWhiteSpace()) - //{ - // result.ReleaseGroup = subGroup; - //} - - //Logger.Debug("Release Group parsed: {0}", result.ReleaseGroup); - - //result.ReleaseHash = GetReleaseHash(match); - //if (!result.ReleaseHash.IsNullOrWhiteSpace()) - //{ - // Logger.Debug("Release Hash parsed: {0}", result.ReleaseHash); - //} - return result; } } @@ -721,19 +693,6 @@ private static ArtistTitleInfo GetArtistTitleInfo(string title) var artistTitleInfo = new ArtistTitleInfo(); artistTitleInfo.Title = title; - //var match = YearInTitleRegex.Match(title); - - //if (!match.Success) - //{ - // artistTitleInfo.TitleWithoutYear = title; - //} - - //else - //{ - // artistTitleInfo.TitleWithoutYear = match.Groups["title"].Value; - // artistTitleInfo.Year = Convert.ToInt32(match.Groups["year"].Value); - //} - return artistTitleInfo; } diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index b8a9bd11c..cc4350356 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -38,12 +38,10 @@ public ParsingService(ITrackService trackService, IArtistService artistService, IAlbumService albumService, IMediaFileService mediaFileService, - // ISceneMappingService sceneMappingService, Logger logger) { _albumService = albumService; _artistService = artistService; - // _sceneMappingService = sceneMappingService; _trackService = trackService; _mediaFileService = mediaFileService; _logger = logger; @@ -298,32 +296,6 @@ private List GetTracks(Artist artist, ParsedTrackInfo parsedTrackInfo) } } - //_logger.Debug("Track title search unsuccessful, falling back to track number for {1}", trackInfo, parsedTrackInfo); - - //if (parsedTrackInfo.TrackNumbers == null) - //{ - // _logger.Debug("Track has no track numbers: {1}", trackInfo, parsedTrackInfo); - // return new List(); - //} - - //foreach (var trackNumber in parsedTrackInfo.TrackNumbers) - //{ - // Track trackInfoByNumber = null; - - // trackInfoByNumber = _trackService.FindTrack(artist.Id, album.Id, parsedTrackInfo.DiscNumber, trackNumber); - // _logger.Debug("Track {0} selected for {1}", trackInfoByNumber, parsedTrackInfo); - - // if (trackInfoByNumber != null) - // { - // result.Add(trackInfoByNumber); - // } - - // else - // { - // _logger.Debug("Unable to find {0}", parsedTrackInfo); - // } - //} - return result; } }