mirror of https://github.com/lidarr/Lidarr
Add Additional Logging to Track Parsing
This commit is contained in:
parent
04766bb786
commit
78f1066535
|
@ -60,11 +60,13 @@ namespace NzbDrone.Core.Parser
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
public LocalEpisode GetLocalEpisode(string filename, Series series)
|
public LocalEpisode GetLocalEpisode(string filename, Series series)
|
||||||
{
|
{
|
||||||
return GetLocalEpisode(filename, series, null, false);
|
return GetLocalEpisode(filename, series, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
public LocalEpisode GetLocalEpisode(string filename, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource)
|
public LocalEpisode GetLocalEpisode(string filename, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource)
|
||||||
{
|
{
|
||||||
ParsedEpisodeInfo parsedEpisodeInfo;
|
ParsedEpisodeInfo parsedEpisodeInfo;
|
||||||
|
@ -115,6 +117,7 @@ namespace NzbDrone.Core.Parser
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
public Series GetSeries(string title)
|
public Series GetSeries(string title)
|
||||||
{
|
{
|
||||||
var parsedEpisodeInfo = Parser.ParseTitle(title);
|
var parsedEpisodeInfo = Parser.ParseTitle(title);
|
||||||
|
@ -272,6 +275,7 @@ namespace NzbDrone.Core.Parser
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
public List<Episode> GetEpisodes(ParsedEpisodeInfo parsedEpisodeInfo, Series series, bool sceneSource, SearchCriteriaBase searchCriteria = null)
|
public List<Episode> GetEpisodes(ParsedEpisodeInfo parsedEpisodeInfo, Series series, bool sceneSource, SearchCriteriaBase searchCriteria = null)
|
||||||
{
|
{
|
||||||
if (parsedEpisodeInfo.FullSeason)
|
if (parsedEpisodeInfo.FullSeason)
|
||||||
|
@ -305,6 +309,7 @@ namespace NzbDrone.Core.Parser
|
||||||
return GetStandardEpisodes(series, parsedEpisodeInfo, sceneSource, searchCriteria);
|
return GetStandardEpisodes(series, parsedEpisodeInfo, sceneSource, searchCriteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
public ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, int tvdbId, int tvRageId, SearchCriteriaBase searchCriteria = null)
|
public ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, int tvdbId, int tvRageId, SearchCriteriaBase searchCriteria = null)
|
||||||
{
|
{
|
||||||
if (searchCriteria != null)
|
if (searchCriteria != null)
|
||||||
|
@ -349,6 +354,7 @@ namespace NzbDrone.Core.Parser
|
||||||
return ParseSpecialEpisodeTitle(title, series);
|
return ParseSpecialEpisodeTitle(title, series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
private ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, Series series)
|
private ParsedEpisodeInfo ParseSpecialEpisodeTitle(string title, Series series)
|
||||||
{
|
{
|
||||||
// find special episode in series season 0
|
// find special episode in series season 0
|
||||||
|
@ -399,7 +405,7 @@ namespace NzbDrone.Core.Parser
|
||||||
return artist;
|
return artist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tvRageId, SearchCriteriaBase searchCriteria)
|
private Series GetSeries(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tvRageId, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
Series series = null;
|
Series series = null;
|
||||||
|
@ -471,6 +477,7 @@ namespace NzbDrone.Core.Parser
|
||||||
return series;
|
return series;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
private Episode GetDailyEpisode(Series series, string airDate, SearchCriteriaBase searchCriteria)
|
private Episode GetDailyEpisode(Series series, string airDate, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
Episode episodeInfo = null;
|
Episode episodeInfo = null;
|
||||||
|
@ -489,6 +496,7 @@ namespace NzbDrone.Core.Parser
|
||||||
return episodeInfo;
|
return episodeInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
private List<Episode> GetAnimeEpisodes(Series series, ParsedEpisodeInfo parsedEpisodeInfo, bool sceneSource)
|
private List<Episode> GetAnimeEpisodes(Series series, ParsedEpisodeInfo parsedEpisodeInfo, bool sceneSource)
|
||||||
{
|
{
|
||||||
var result = new List<Episode>();
|
var result = new List<Episode>();
|
||||||
|
@ -591,6 +599,7 @@ namespace NzbDrone.Core.Parser
|
||||||
// return result;
|
// return result;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
[System.Obsolete("Used for sonarr, not lidarr")]
|
||||||
private List<Episode> GetStandardEpisodes(Series series, ParsedEpisodeInfo parsedEpisodeInfo, bool sceneSource, SearchCriteriaBase searchCriteria)
|
private List<Episode> GetStandardEpisodes(Series series, ParsedEpisodeInfo parsedEpisodeInfo, bool sceneSource, SearchCriteriaBase searchCriteria)
|
||||||
{
|
{
|
||||||
var result = new List<Episode>();
|
var result = new List<Episode>();
|
||||||
|
@ -700,7 +709,7 @@ namespace NzbDrone.Core.Parser
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tracks = GetTracks(parsedTrackInfo, artist);
|
var tracks = GetTracks(artist, parsedTrackInfo);
|
||||||
var album = _albumService.FindByTitle(artist.Id, parsedTrackInfo.AlbumTitle);
|
var album = _albumService.FindByTitle(artist.Id, parsedTrackInfo.AlbumTitle);
|
||||||
|
|
||||||
return new LocalTrack
|
return new LocalTrack
|
||||||
|
@ -716,39 +725,44 @@ namespace NzbDrone.Core.Parser
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Track> GetTracks(ParsedTrackInfo parsedTrackInfo, Artist artist)
|
private List<Track> GetTracks(Artist artist, ParsedTrackInfo parsedTrackInfo)
|
||||||
{
|
|
||||||
return GetStandardTracks(artist, parsedTrackInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Track> GetStandardTracks(Artist artist, ParsedTrackInfo parsedTrackInfo)
|
|
||||||
{
|
{
|
||||||
var result = new List<Track>();
|
var result = new List<Track>();
|
||||||
|
|
||||||
if (parsedTrackInfo.AlbumTitle.IsNullOrWhiteSpace())
|
if (parsedTrackInfo.AlbumTitle.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
|
_logger.Debug("Album title could not be parsed for {0}", parsedTrackInfo);
|
||||||
return new List<Track>();
|
return new List<Track>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var album = _albumService.FindByTitle(artist.Id, parsedTrackInfo.AlbumTitle);
|
var album = _albumService.FindByTitle(artist.Id, parsedTrackInfo.AlbumTitle);
|
||||||
|
_logger.Debug("Album {0} selected for {1}", album, parsedTrackInfo);
|
||||||
|
|
||||||
if (album == null)
|
if (album == null)
|
||||||
{
|
{
|
||||||
|
_logger.Debug("Parsed album title not found in Db for {0}", parsedTrackInfo);
|
||||||
return new List<Track>();
|
return new List<Track>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Track trackInfo = null;
|
Track trackInfo = null;
|
||||||
|
|
||||||
trackInfo = _trackService.FindTrackByTitle(artist.Id, album.Id, parsedTrackInfo.Title);
|
if (parsedTrackInfo.Title.IsNotNullOrWhiteSpace())
|
||||||
|
|
||||||
if (trackInfo !=null)
|
|
||||||
{
|
{
|
||||||
result.Add(trackInfo);
|
trackInfo = _trackService.FindTrackByTitle(artist.Id, album.Id, parsedTrackInfo.Title);
|
||||||
return result;
|
_logger.Debug("Track {0} selected for {1}", trackInfo, parsedTrackInfo);
|
||||||
|
|
||||||
|
if (trackInfo != null)
|
||||||
|
{
|
||||||
|
result.Add(trackInfo);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger.Debug("Track title search unsuccessful, falling back to track number for {1}", trackInfo, parsedTrackInfo);
|
||||||
|
|
||||||
if (parsedTrackInfo.TrackNumbers == null)
|
if (parsedTrackInfo.TrackNumbers == null)
|
||||||
{
|
{
|
||||||
|
_logger.Debug("Track has no track numbers: {1}", trackInfo, parsedTrackInfo);
|
||||||
return new List<Track>();
|
return new List<Track>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,6 +771,7 @@ namespace NzbDrone.Core.Parser
|
||||||
Track trackInfoByNumber = null;
|
Track trackInfoByNumber = null;
|
||||||
|
|
||||||
trackInfoByNumber = _trackService.FindTrack(artist.Id, album.Id, trackNumber);
|
trackInfoByNumber = _trackService.FindTrack(artist.Id, album.Id, trackNumber);
|
||||||
|
_logger.Debug("Track {0} selected for {1}", trackInfoByNumber, parsedTrackInfo);
|
||||||
|
|
||||||
if (trackInfoByNumber != null)
|
if (trackInfoByNumber != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue