better Series.ToString()

pull/4/head
kay.one 12 years ago
parent 2d41ebcc78
commit a216e37d6a

@ -5,6 +5,10 @@ namespace NzbDrone.Common
{
public static class StringExtension
{
public static string NullSafe(this string target)
{
return ((object)target).NullSafe().ToString();
}
public static object NullSafe(this object target)
{
@ -12,11 +16,6 @@ namespace NzbDrone.Common
return "[NULL]";
}
public static string NullSafe(this string target)
{
return ((object)target).NullSafe().ToString();
}
public static string FirstCharToUpper(this string input)
{
return input.First().ToString().ToUpper() + String.Join("", input.Skip(1));

@ -28,7 +28,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
if (!subject.Series.CustomStartDate.HasValue)
{
_logger.Debug("{0} does not restrict downloads before date.", subject.Series.Title);
_logger.Debug("{0} does not restrict downloads before date.", subject.Series);
return true;
}

@ -25,7 +25,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
if (!subject.Series.Monitored)
{
_logger.Debug("{0} is present in the DB but not tracked. skipping.", subject.Series.Title);
_logger.Debug("{0} is present in the DB but not tracked. skipping.", subject.Series);
return false;
}

@ -57,16 +57,16 @@ namespace NzbDrone.Core.MediaCover
{
var fileName = GetCoverPath(series.Id, cover.CoverType);
_logger.Info("Downloading {0} for {1} {2}", cover.CoverType, series.Title, cover.Url);
_logger.Info("Downloading {0} for {1} {2}", cover.CoverType, series, cover.Url);
_httpProvider.DownloadFile(cover.Url, fileName);
}
catch (WebException e)
{
_logger.WarnException("Couldn't download media cover for " + series.TvdbId, e);
_logger.WarnException("Couldn't download media cover for " + series, e);
}
catch (Exception e)
{
_logger.ErrorException("Couldn't download media cover for " + series.TvdbId, e);
_logger.ErrorException("Couldn't download media cover for " + series, e);
}
}

@ -154,7 +154,7 @@ namespace NzbDrone.Core.MediaFiles
}
catch (Exception e)
{
Logger.ErrorException("Diskscan failed for " + series.Title, e);
Logger.ErrorException("Disk scan failed for " + series, e);
}
}
}

@ -150,7 +150,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
//If the path is found update it, else update the whole library
if (!String.IsNullOrEmpty(xbmcSeriesPath))
{
_logger.Trace("Updating series [{0}] on XBMC host: {1}", series.Title, settings.Address);
_logger.Trace("Updating series [{0}] on XBMC host: {1}", series, settings.Address);
var command = BuildExecBuiltInCommand(String.Format("UpdateLibrary(video,{0})", xbmcSeriesPath));
SendCommand(settings, command);
}
@ -158,7 +158,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
else
{
//Update the entire library
_logger.Trace("Series [{0}] doesn't exist on XBMC host: {1}, Updating Entire Library", series.Title, settings.Address);
_logger.Trace("Series [{0}] doesn't exist on XBMC host: {1}, Updating Entire Library", series, settings.Address);
var command = BuildExecBuiltInCommand("UpdateLibrary(video)");
SendCommand(settings, command);
}

@ -143,7 +143,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
if (seriesPath != null)
{
_logger.Trace("Updating series [{0}] (Path: {1}) on XBMC host: {2}", series.Title, seriesPath, settings.Address);
_logger.Trace("Updating series {0} (Path: {1}) on XBMC host: {2}", series, seriesPath, settings.Address);
var parameters = new JObject(new JObject(new JProperty("directory", seriesPath)));
postJson = BuildJsonRequest("VideoLibrary.Scan", parameters);
@ -151,7 +151,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
else
{
_logger.Trace("Series [{0}] doesn't exist on XBMC host: {1}, Updating Entire Library", series.Title,
_logger.Trace("Series {0} doesn't exist on XBMC host: {1}, Updating Entire Library", series,
settings.Address);
postJson = BuildJsonRequest("VideoLibrary.Scan");

@ -94,7 +94,7 @@ namespace NzbDrone.Core.Parser
if (series.SeriesType == SeriesTypes.Standard)
{
//Todo: Collect this as a Series we want to treat as a daily series, or possible parsing error
_logger.Warn("Found daily-style episode for non-daily series: {0}.", series.Title);
_logger.Warn("Found daily-style episode for non-daily series: {0}.", series);
return new List<Episode>();
}

@ -7,7 +7,7 @@ using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Providers
{
public class XemProvider :IExecute<UpdateXemMappings>
public class XemProvider : IExecute<UpdateXemMappings>
{
private readonly IEpisodeService _episodeService;
private readonly XemCommunicationProvider _xemCommunicationProvider;
@ -15,7 +15,7 @@ namespace NzbDrone.Core.Providers
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
public XemProvider(IEpisodeService episodeService,XemCommunicationProvider xemCommunicationProvider,ISeriesRepository seriesRepository)
public XemProvider(IEpisodeService episodeService, XemCommunicationProvider xemCommunicationProvider, ISeriesRepository seriesRepository)
{
_episodeService = episodeService;
_xemCommunicationProvider = xemCommunicationProvider;
@ -31,7 +31,7 @@ namespace NzbDrone.Core.Providers
var series = _seriesRepository.All();
var wantedSeries = series.Where(s => ids.Contains(s.Id)).ToList();
foreach(var ser in wantedSeries)
foreach (var ser in wantedSeries)
{
PerformUpdate(ser);
}
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Providers
_logger.Trace("Completed scene numbering update");
}
catch(Exception ex)
catch (Exception ex)
{
_logger.WarnException("Error updating Scene Mappings", ex);
throw;
@ -69,7 +69,7 @@ namespace NzbDrone.Core.Providers
public virtual void PerformUpdate(Series series)
{
_logger.Trace("Updating scene numbering mapping for: {0}", series.Title);
_logger.Trace("Updating scene numbering mapping for: {0}", series);
try
{
var episodesToUpdate = new List<Episode>();
@ -77,7 +77,7 @@ namespace NzbDrone.Core.Providers
if (mappings == null)
{
_logger.Trace("Mappings for: {0} are null, skipping", series.Title);
_logger.Trace("Mappings for: {0} are null, skipping", series);
return;
}
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Providers
foreach (var mapping in mappings)
{
_logger.Trace("Setting scene numbering mappings for {0} S{1:00}E{2:00}", series.Title, mapping.Tvdb.Season, mapping.Tvdb.Episode);
_logger.Trace("Setting scene numbering mappings for {0} S{1:00}E{2:00}", series, mapping.Tvdb.Season, mapping.Tvdb.Episode);
var episode = episodes.SingleOrDefault(e => e.SeasonNumber == mapping.Tvdb.Season && e.EpisodeNumber == mapping.Tvdb.Episode);
@ -101,10 +101,10 @@ namespace NzbDrone.Core.Providers
episodesToUpdate.Add(episode);
}
_logger.Trace("Committing scene numbering mappings to database for: {0}", series.Title);
_logger.Trace("Committing scene numbering mappings to database for: {0}", series);
_episodeService.UpdateEpisodes(episodesToUpdate);
_logger.Trace("Setting UseSceneMapping for {0}", series.Title);
_logger.Trace("Setting UseSceneMapping for {0}", series);
series.UseSceneNumbering = true;
_seriesRepository.Update(series);
}

@ -50,7 +50,7 @@ namespace NzbDrone.Core.Tv
}
catch (Exception e)
{
_logger.ErrorException("Couldn't refresh info for {0}".Inject(series.Title), e);
_logger.ErrorException("Couldn't refresh info for {0}".Inject(series), e);
}
}
}
@ -86,7 +86,7 @@ namespace NzbDrone.Core.Tv
private void RefreshEpisodeInfo(Series series, IEnumerable<Episode> remoteEpisodes)
{
_logger.Info("Starting series info refresh for: {0}", series.Title.WithDefault(series.Id));
_logger.Info("Starting series info refresh for: {0}", series);
var successCount = 0;
var failCount = 0;
@ -151,7 +151,7 @@ namespace NzbDrone.Core.Tv
}
catch (Exception e)
{
_logger.FatalException(String.Format("An error has occurred while updating episode info for series {0}", series.Title), e);
_logger.FatalException(String.Format("An error has occurred while updating episode info for series {0}", series), e);
failCount++;
}
}
@ -192,7 +192,7 @@ namespace NzbDrone.Core.Tv
}
else
{
_logger.Info("Finished episode refresh for series: {0}.", series.Title);
_logger.Info("Finished episode refresh for series: {0}.", series);
}
//DeleteEpisodesNotAvailableAnymore(series, remoteEpisodes);

@ -3,6 +3,7 @@ using System.Collections.Generic;
using Marr.Data;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Qualities;
using NzbDrone.Common;
namespace NzbDrone.Core.Tv
@ -39,5 +40,10 @@ namespace NzbDrone.Core.Tv
public DateTime? FirstAired { get; set; }
public LazyLoaded<QualityProfile> QualityProfile { get; set; }
public override string ToString()
{
return string.Format("[{0}][{1}]", Id, Title.NullSafe());
}
}
}

@ -74,7 +74,7 @@ namespace NzbDrone.Core.Tv
_diskProvider.CreateFolder(newSeries.Path);
}
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
_logger.Info("Adding Series {0} Path: [{1}]", newSeries, newSeries.Path);
newSeries.Monitored = true;
newSeries.CleanTitle = Parser.Parser.CleanSeriesTitle(newSeries.Title);

Loading…
Cancel
Save