mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
removed redundant else
This commit is contained in:
parent
3b087ba922
commit
cf77104a02
@ -241,7 +241,7 @@ public TransferMode TransferFile(string source, string destination, TransferMode
|
|||||||
{
|
{
|
||||||
return TransferMode.HardLink;
|
return TransferMode.HardLink;
|
||||||
}
|
}
|
||||||
else if (!mode.HasFlag(TransferMode.Copy))
|
if (!mode.HasFlag(TransferMode.Copy))
|
||||||
{
|
{
|
||||||
throw new IOException("Hardlinking from '" + source + "' to '" + destination + "' failed.");
|
throw new IOException("Hardlinking from '" + source + "' to '" + destination + "' failed.");
|
||||||
}
|
}
|
||||||
|
@ -48,24 +48,20 @@ private static OsPathKind DetectPathKind(String path)
|
|||||||
{
|
{
|
||||||
return OsPathKind.Windows;
|
return OsPathKind.Windows;
|
||||||
}
|
}
|
||||||
else if (path.Contains('/'))
|
if (path.Contains('/'))
|
||||||
{
|
{
|
||||||
return OsPathKind.Unix;
|
return OsPathKind.Unix;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return OsPathKind.Unknown;
|
return OsPathKind.Unknown;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static String FixSlashes(String path, OsPathKind kind)
|
private static String FixSlashes(String path, OsPathKind kind)
|
||||||
{
|
{
|
||||||
if (kind == OsPathKind.Windows)
|
switch (kind)
|
||||||
{
|
{
|
||||||
|
case OsPathKind.Windows:
|
||||||
return path.Replace('/', '\\');
|
return path.Replace('/', '\\');
|
||||||
}
|
case OsPathKind.Unix:
|
||||||
else if (kind == OsPathKind.Unix)
|
|
||||||
{
|
|
||||||
return path.Replace('\\', '/');
|
return path.Replace('\\', '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,16 +99,14 @@ public Boolean IsRooted
|
|||||||
{
|
{
|
||||||
return _path.StartsWith(@"\\") || _path.Contains(':');
|
return _path.StartsWith(@"\\") || _path.Contains(':');
|
||||||
}
|
}
|
||||||
else if (IsUnixPath)
|
if (IsUnixPath)
|
||||||
{
|
{
|
||||||
return _path.StartsWith("/");
|
return _path.StartsWith("/");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public OsPath Directory
|
public OsPath Directory
|
||||||
{
|
{
|
||||||
@ -124,12 +118,10 @@ public OsPath Directory
|
|||||||
{
|
{
|
||||||
return new OsPath(null);
|
return new OsPath(null);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return new OsPath(_path.Substring(0, index), _kind).AsDirectory();
|
return new OsPath(_path.Substring(0, index), _kind).AsDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public String FullPath
|
public String FullPath
|
||||||
{
|
{
|
||||||
@ -156,12 +148,10 @@ public String FileName
|
|||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return _path.Substring(index).Trim('\\', '/');
|
return _path.Substring(index).Trim('\\', '/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private Int32 GetFileNameIndex()
|
private Int32 GetFileNameIndex()
|
||||||
{
|
{
|
||||||
@ -211,15 +201,12 @@ public override Boolean Equals(Object obj)
|
|||||||
{
|
{
|
||||||
return Equals((OsPath)obj);
|
return Equals((OsPath)obj);
|
||||||
}
|
}
|
||||||
else if (obj is String)
|
if (obj is String)
|
||||||
{
|
{
|
||||||
return Equals(new OsPath(obj as String));
|
return Equals(new OsPath(obj as String));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public OsPath AsDirectory()
|
public OsPath AsDirectory()
|
||||||
{
|
{
|
||||||
@ -228,19 +215,15 @@ public OsPath AsDirectory()
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Kind == OsPathKind.Windows)
|
switch (Kind)
|
||||||
{
|
{
|
||||||
|
case OsPathKind.Windows:
|
||||||
return new OsPath(_path.TrimEnd('\\') + "\\", _kind);
|
return new OsPath(_path.TrimEnd('\\') + "\\", _kind);
|
||||||
}
|
case OsPathKind.Unix:
|
||||||
else if (Kind == OsPathKind.Unix)
|
|
||||||
{
|
|
||||||
return new OsPath(_path.TrimEnd('/') + "/", _kind);
|
return new OsPath(_path.TrimEnd('/') + "/", _kind);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean Contains(OsPath other)
|
public Boolean Contains(OsPath other)
|
||||||
{
|
{
|
||||||
@ -286,11 +269,8 @@ public Boolean Equals(OsPath other)
|
|||||||
{
|
{
|
||||||
return String.Equals(left, right, StringComparison.InvariantCultureIgnoreCase);
|
return String.Equals(left, right, StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return String.Equals(left, right, StringComparison.InvariantCulture);
|
return String.Equals(left, right, StringComparison.InvariantCulture);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static Boolean operator ==(OsPath left, OsPath right)
|
public static Boolean operator ==(OsPath left, OsPath right)
|
||||||
{
|
{
|
||||||
@ -327,15 +307,12 @@ public Boolean Equals(OsPath other)
|
|||||||
{
|
{
|
||||||
return new OsPath(String.Join("\\", left._path.TrimEnd('\\'), right._path.TrimStart('\\')), OsPathKind.Windows);
|
return new OsPath(String.Join("\\", left._path.TrimEnd('\\'), right._path.TrimStart('\\')), OsPathKind.Windows);
|
||||||
}
|
}
|
||||||
else if (left.Kind == OsPathKind.Unix || right.Kind == OsPathKind.Unix)
|
if (left.Kind == OsPathKind.Unix || right.Kind == OsPathKind.Unix)
|
||||||
{
|
{
|
||||||
return new OsPath(String.Join("/", left._path.TrimEnd('/'), right._path), OsPathKind.Unix);
|
return new OsPath(String.Join("/", left._path.TrimEnd('/'), right._path), OsPathKind.Unix);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return new OsPath(String.Join("/", left._path, right._path), OsPathKind.Unknown);
|
return new OsPath(String.Join("/", left._path, right._path), OsPathKind.Unknown);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static OsPath operator +(OsPath left, String right)
|
public static OsPath operator +(OsPath left, String right)
|
||||||
{
|
{
|
||||||
@ -389,12 +366,9 @@ public Boolean Equals(OsPath other)
|
|||||||
{
|
{
|
||||||
return new OsPath(String.Join("\\", newFragments), OsPathKind.Unknown);
|
return new OsPath(String.Join("\\", newFragments), OsPathKind.Unknown);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return new OsPath(String.Join("/", newFragments), OsPathKind.Unknown);
|
return new OsPath(String.Join("/", newFragments), OsPathKind.Unknown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public enum OsPathKind
|
public enum OsPathKind
|
||||||
{
|
{
|
||||||
|
@ -63,11 +63,8 @@ public static string GetParentPath(this string childPath)
|
|||||||
{
|
{
|
||||||
return parentPath.Substring(0, index);
|
return parentPath.Substring(0, index);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsParentPath(this string parentPath, string childPath)
|
public static bool IsParentPath(this string parentPath, string childPath)
|
||||||
{
|
{
|
||||||
|
@ -210,29 +210,24 @@ private ValidationFailure TestConnection()
|
|||||||
catch (WebException ex)
|
catch (WebException ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException(ex.Message, ex);
|
_logger.ErrorException(ex.Message, ex);
|
||||||
if (ex.Status == WebExceptionStatus.ConnectFailure)
|
switch (ex.Status)
|
||||||
{
|
{
|
||||||
|
case WebExceptionStatus.ConnectFailure:
|
||||||
return new NzbDroneValidationFailure("Host", "Unable to connect")
|
return new NzbDroneValidationFailure("Host", "Unable to connect")
|
||||||
{
|
{
|
||||||
DetailedDescription = "Please verify the hostname and port."
|
DetailedDescription = "Please verify the hostname and port."
|
||||||
};
|
};
|
||||||
}
|
case WebExceptionStatus.ConnectionClosed:
|
||||||
else if (ex.Status == WebExceptionStatus.ConnectionClosed)
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationFailure("UseSsl", "Verify SSL settings")
|
return new NzbDroneValidationFailure("UseSsl", "Verify SSL settings")
|
||||||
{
|
{
|
||||||
DetailedDescription = "Please verify your SSL configuration on both Deluge and NzbDrone."
|
DetailedDescription = "Please verify your SSL configuration on both Deluge and NzbDrone."
|
||||||
};
|
};
|
||||||
}
|
case WebExceptionStatus.SecureChannelFailure:
|
||||||
else if (ex.Status == WebExceptionStatus.SecureChannelFailure)
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationFailure("UseSsl", "Unable to connect through SSL")
|
return new NzbDroneValidationFailure("UseSsl", "Unable to connect through SSL")
|
||||||
{
|
{
|
||||||
DetailedDescription = "Drone is unable to connect to Deluge using SSL. This problem could be computer related. Please try to configure both drone and Deluge to not use SSL."
|
DetailedDescription = "Drone is unable to connect to Deluge using SSL. This problem could be computer related. Please try to configure both drone and Deluge to not use SSL."
|
||||||
};
|
};
|
||||||
}
|
default:
|
||||||
else
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message);
|
return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,11 +264,8 @@ private void AuthenticateClient(IRestClient restClient)
|
|||||||
_logger.Debug("Deluge authentication failed.");
|
_logger.Debug("Deluge authentication failed.");
|
||||||
throw new DownloadClientAuthenticationException("Failed to authenticate with Deluge.");
|
throw new DownloadClientAuthenticationException("Failed to authenticate with Deluge.");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Debug("Deluge authentication succeeded.");
|
_logger.Debug("Deluge authentication succeeded.");
|
||||||
_authCookieContainer = restClient.CookieContainer;
|
_authCookieContainer = restClient.CookieContainer;
|
||||||
}
|
|
||||||
|
|
||||||
ConnectDaemon(restClient);
|
ConnectDaemon(restClient);
|
||||||
}
|
}
|
||||||
|
@ -212,11 +212,8 @@ private ValidationFailure TestConnection()
|
|||||||
DetailedDescription = "Please verify the hostname and port."
|
DetailedDescription = "Please verify the hostname and port."
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message);
|
return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException(ex.Message, ex);
|
_logger.ErrorException(ex.Message, ex);
|
||||||
|
@ -183,7 +183,9 @@ protected String GetSessionId(IRestClient client, TransmissionSettings settings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We expect the StatusCode = Conflict, coz that will provide us with a new session id.
|
// We expect the StatusCode = Conflict, coz that will provide us with a new session id.
|
||||||
if (restResponse.StatusCode == HttpStatusCode.Conflict)
|
switch (restResponse.StatusCode)
|
||||||
|
{
|
||||||
|
case HttpStatusCode.Conflict:
|
||||||
{
|
{
|
||||||
var sessionId = restResponse.Headers.SingleOrDefault(o => o.Name == "X-Transmission-Session-Id");
|
var sessionId = restResponse.Headers.SingleOrDefault(o => o.Name == "X-Transmission-Session-Id");
|
||||||
|
|
||||||
@ -194,8 +196,7 @@ protected String GetSessionId(IRestClient client, TransmissionSettings settings)
|
|||||||
|
|
||||||
return (String)sessionId.Value;
|
return (String)sessionId.Value;
|
||||||
}
|
}
|
||||||
else if (restResponse.StatusCode == HttpStatusCode.Unauthorized)
|
case HttpStatusCode.Unauthorized:
|
||||||
{
|
|
||||||
throw new DownloadClientAuthenticationException("User authentication failed.");
|
throw new DownloadClientAuthenticationException("User authentication failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,11 +223,8 @@ private ValidationFailure TestConnection()
|
|||||||
DetailedDescription = "Please verify the hostname and port."
|
DetailedDescription = "Please verify the hostname and port."
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message);
|
return new NzbDroneValidationFailure(String.Empty, "Unknown exception: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.ErrorException(ex.Message, ex);
|
_logger.ErrorException(ex.Message, ex);
|
||||||
|
@ -108,11 +108,8 @@ private string DownloadFromWebUrl(RemoteEpisode remoteEpisode, String torrentUrl
|
|||||||
{
|
{
|
||||||
return DownloadFromMagnetUrl(remoteEpisode, locationHeader);
|
return DownloadFromMagnetUrl(remoteEpisode, locationHeader);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new WebException("Remote website tried to redirect without providing a location.");
|
throw new WebException("Remote website tried to redirect without providing a location.");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
torrentFile = response.ResponseData;
|
torrentFile = response.ResponseData;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public override HealthCheck Check()
|
|||||||
|
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd)", "Migrating-to-Completed-Download-Handling#sabnzbd-enable-completed-download-handling");
|
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Sabnzbd)", "Migrating-to-Completed-Download-Handling#sabnzbd-enable-completed-download-handling");
|
||||||
}
|
}
|
||||||
else if (downloadClients.All(v => v.downloadClient is Nzbget))
|
if (downloadClients.All(v => v.downloadClient is Nzbget))
|
||||||
{
|
{
|
||||||
// With Nzbget we can check if the category should be changed.
|
// With Nzbget we can check if the category should be changed.
|
||||||
if (downloadClientOutputInDroneFactory)
|
if (downloadClientOutputInDroneFactory)
|
||||||
@ -57,11 +57,8 @@ public override HealthCheck Check()
|
|||||||
|
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget)", "Migrating-to-Completed-Download-Handling#nzbget-enable-completed-download-handling");
|
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible (Nzbget)", "Migrating-to-Completed-Download-Handling#nzbget-enable-completed-download-handling");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible", "Migrating-to-Completed-Download-Handling");
|
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling if possible", "Migrating-to-Completed-Download-Handling");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!_configService.EnableCompletedDownloadHandling && droneFactoryFolder.IsEmpty)
|
if (!_configService.EnableCompletedDownloadHandling && droneFactoryFolder.IsEmpty)
|
||||||
{
|
{
|
||||||
|
@ -106,10 +106,7 @@ public List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber)
|
|||||||
{
|
{
|
||||||
return v.SceneSeasonNumber.Value;
|
return v.SceneSeasonNumber.Value;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return v.SeasonNumber;
|
return v.SeasonNumber;
|
||||||
}
|
|
||||||
}).Distinct();
|
}).Distinct();
|
||||||
|
|
||||||
foreach (var sceneSeasonEpisodes in sceneSeasonGroups)
|
foreach (var sceneSeasonEpisodes in sceneSeasonGroups)
|
||||||
|
@ -13,22 +13,21 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||||||
{
|
{
|
||||||
var results = new List<ReleaseInfo>();
|
var results = new List<ReleaseInfo>();
|
||||||
|
|
||||||
if (indexerResponse.HttpResponse.StatusCode == HttpStatusCode.Unauthorized)
|
switch (indexerResponse.HttpResponse.StatusCode)
|
||||||
{
|
{
|
||||||
|
case HttpStatusCode.Unauthorized:
|
||||||
throw new ApiKeyException("API Key invalid or not authorized");
|
throw new ApiKeyException("API Key invalid or not authorized");
|
||||||
}
|
case HttpStatusCode.NotFound:
|
||||||
else if (indexerResponse.HttpResponse.StatusCode == HttpStatusCode.NotFound)
|
|
||||||
{
|
|
||||||
throw new IndexerException(indexerResponse, "Indexer API call returned NotFound, the Indexer API may have changed.");
|
throw new IndexerException(indexerResponse, "Indexer API call returned NotFound, the Indexer API may have changed.");
|
||||||
}
|
case HttpStatusCode.ServiceUnavailable:
|
||||||
else if (indexerResponse.HttpResponse.StatusCode == HttpStatusCode.ServiceUnavailable)
|
|
||||||
{
|
|
||||||
throw new RequestLimitReachedException("Cannot do more than 150 API requests per hour.");
|
throw new RequestLimitReachedException("Cannot do more than 150 API requests per hour.");
|
||||||
}
|
default:
|
||||||
else if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw new IndexerException(indexerResponse, "Indexer API call returned an unexpected StatusCode [{0}]", indexerResponse.HttpResponse.StatusCode);
|
throw new IndexerException(indexerResponse, "Indexer API call returned an unexpected StatusCode [{0}]", indexerResponse.HttpResponse.StatusCode);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var jsonResponse = new HttpResponse<JsonRpcResponse<BroadcastheNetTorrents>>(indexerResponse.HttpResponse).Resource;
|
var jsonResponse = new HttpResponse<JsonRpcResponse<BroadcastheNetTorrents>>(indexerResponse.HttpResponse).Resource;
|
||||||
|
|
||||||
@ -46,7 +45,7 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||||||
{
|
{
|
||||||
var torrentInfo = new TorrentInfo();
|
var torrentInfo = new TorrentInfo();
|
||||||
|
|
||||||
torrentInfo.Guid = String.Format("BTN-{0}", torrent.TorrentID.ToString());
|
torrentInfo.Guid = String.Format("BTN-{0}", torrent.TorrentID);
|
||||||
torrentInfo.Title = torrent.ReleaseName;
|
torrentInfo.Title = torrent.ReleaseName;
|
||||||
torrentInfo.Size = torrent.Size;
|
torrentInfo.Size = torrent.Size;
|
||||||
torrentInfo.DownloadUrl = torrent.DownloadURL;
|
torrentInfo.DownloadUrl = torrent.DownloadURL;
|
||||||
|
@ -100,17 +100,14 @@ private bool AddSeriesSearchParameters(BroadcastheNetTorrentQuery parameters, Se
|
|||||||
parameters.Tvrage = String.Format("{0}", searchCriteria.Series.TvRageId);
|
parameters.Tvrage = String.Format("{0}", searchCriteria.Series.TvRageId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (searchCriteria.Series.TvdbId != 0)
|
if (searchCriteria.Series.TvdbId != 0)
|
||||||
{
|
{
|
||||||
parameters.Tvdb = String.Format("{0}", searchCriteria.Series.TvdbId);
|
parameters.Tvdb = String.Format("{0}", searchCriteria.Series.TvdbId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// BTN is very neatly managed, so it's unlikely they map tvrage/tvdb wrongly.
|
// BTN is very neatly managed, so it's unlikely they map tvrage/tvdb wrongly.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetPagedRequests(Int32 maxPages, BroadcastheNetTorrentQuery parameters)
|
private IEnumerable<IndexerRequest> GetPagedRequests(Int32 maxPages, BroadcastheNetTorrentQuery parameters)
|
||||||
{
|
{
|
||||||
|
@ -147,11 +147,8 @@ protected virtual string GetDownloadUrl(XElement item)
|
|||||||
{
|
{
|
||||||
return item.Element("enclosure").Attribute("url").Value;
|
return item.Element("enclosure").Attribute("url").Value;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return item.Element("link").Value;
|
return item.Element("link").Value;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual string GetInfoUrl(XElement item)
|
protected virtual string GetInfoUrl(XElement item)
|
||||||
{
|
{
|
||||||
@ -174,7 +171,7 @@ protected virtual long GetSize(XElement item)
|
|||||||
{
|
{
|
||||||
return GetEnclosureLength(item);
|
return GetEnclosureLength(item);
|
||||||
}
|
}
|
||||||
else if (ParseSizeInDescription)
|
if (ParseSizeInDescription)
|
||||||
{
|
{
|
||||||
return ParseSize(item.Element("description").Value, true);
|
return ParseSize(item.Element("description").Value, true);
|
||||||
}
|
}
|
||||||
|
@ -74,16 +74,10 @@ private List<ImportResult> ProcessFolder(DownloadedEpisodesScanCommand message)
|
|||||||
|
|
||||||
return _downloadedEpisodesImportService.ProcessFolder(new DirectoryInfo(message.Path));
|
return _downloadedEpisodesImportService.ProcessFolder(new DirectoryInfo(message.Path));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return _completedDownloadService.Import(trackedDownload, message.Path);
|
return _completedDownloadService.Import(trackedDownload, message.Path);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _downloadedEpisodesImportService.ProcessFolder(new DirectoryInfo(message.Path));
|
return _downloadedEpisodesImportService.ProcessFolder(new DirectoryInfo(message.Path));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void Execute(DownloadedEpisodesScanCommand message)
|
public void Execute(DownloadedEpisodesScanCommand message)
|
||||||
{
|
{
|
||||||
|
@ -79,11 +79,8 @@ public EpisodeFile CopyEpisodeFile(EpisodeFile episodeFile, LocalEpisode localEp
|
|||||||
{
|
{
|
||||||
return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.HardLinkOrCopy);
|
return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.HardLinkOrCopy);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.Copy);
|
return TransferFile(episodeFile, localEpisode.Series, localEpisode.Episodes, filePath, TransferMode.Copy);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private EpisodeFile TransferFile(EpisodeFile episodeFile, Series series, List<Episode> episodes, string destinationFilename, TransferMode mode)
|
private EpisodeFile TransferFile(EpisodeFile episodeFile, Series series, List<Episode> episodes, string destinationFilename, TransferMode mode)
|
||||||
{
|
{
|
||||||
|
@ -115,12 +115,9 @@ public override MetadataFile FindMetadataFile(Series series, string path)
|
|||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
metadata.Type = MetadataType.SeriesImage;
|
metadata.Type = MetadataType.SeriesImage;
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var parseResult = Parser.Parser.ParseTitle(filename);
|
var parseResult = Parser.Parser.ParseTitle(filename);
|
||||||
|
|
||||||
|
@ -112,12 +112,9 @@ public override MetadataFile FindMetadataFile(Series series, string path)
|
|||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
metadata.Type = MetadataType.SeriesImage;
|
metadata.Type = MetadataType.SeriesImage;
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var parseResult = Parser.Parser.ParseTitle(filename);
|
var parseResult = Parser.Parser.ParseTitle(filename);
|
||||||
|
|
||||||
|
@ -17,10 +17,7 @@ public class TorrentInfo : ReleaseInfo
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return torrentInfo.Seeds;
|
return torrentInfo.Seeds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -384,10 +384,7 @@ public static string RemoveFileExtension(string title)
|
|||||||
{
|
{
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return m.Value;
|
return m.Value;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return title;
|
return title;
|
||||||
|
@ -143,18 +143,15 @@ public static QualityModel ParseQuality(string name)
|
|||||||
if (sourceMatch.Groups["bdrip"].Success ||
|
if (sourceMatch.Groups["bdrip"].Success ||
|
||||||
sourceMatch.Groups["brrip"].Success)
|
sourceMatch.Groups["brrip"].Success)
|
||||||
{
|
{
|
||||||
if (resolution == Resolution._720p)
|
switch (resolution)
|
||||||
{
|
{
|
||||||
|
case Resolution._720p:
|
||||||
result.Quality = Quality.Bluray720p;
|
result.Quality = Quality.Bluray720p;
|
||||||
return result;
|
return result;
|
||||||
}
|
case Resolution._1080p:
|
||||||
else if (resolution == Resolution._1080p)
|
|
||||||
{
|
|
||||||
result.Quality = Quality.Bluray1080p;
|
result.Quality = Quality.Bluray1080p;
|
||||||
return result;
|
return result;
|
||||||
}
|
default:
|
||||||
else
|
|
||||||
{
|
|
||||||
result.Quality = Quality.DVD;
|
result.Quality = Quality.DVD;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -113,13 +113,11 @@ public Series FindByTitleInexact(string title)
|
|||||||
// no series matched
|
// no series matched
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (list.Count == 1)
|
if (list.Count == 1)
|
||||||
{
|
{
|
||||||
// return the first series if there is only one
|
// return the first series if there is only one
|
||||||
return list.Single();
|
return list.Single();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// build ordered list of series by position in the search string
|
// build ordered list of series by position in the search string
|
||||||
var query =
|
var query =
|
||||||
list.Select(series => new
|
list.Select(series => new
|
||||||
@ -146,7 +144,6 @@ public Series FindByTitleInexact(string title)
|
|||||||
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public Series FindByTitle(string title, int year)
|
public Series FindByTitle(string title, int year)
|
||||||
{
|
{
|
||||||
|
@ -73,18 +73,15 @@ private UpdateStartupContext ParseArgs(string[] args)
|
|||||||
|
|
||||||
if (OsInfo.IsMono)
|
if (OsInfo.IsMono)
|
||||||
{
|
{
|
||||||
if (args.Count() == 1)
|
switch (args.Count())
|
||||||
{
|
{
|
||||||
|
case 1:
|
||||||
return startupContext;
|
return startupContext;
|
||||||
}
|
case 3:
|
||||||
|
|
||||||
else if (args.Count() == 3)
|
|
||||||
{
|
|
||||||
startupContext.UpdateLocation = args[1];
|
startupContext.UpdateLocation = args[1];
|
||||||
startupContext.ExecutingApplication = args[2];
|
startupContext.ExecutingApplication = args[2];
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
else
|
|
||||||
{
|
{
|
||||||
logger.Debug("Arguments:");
|
logger.Debug("Arguments:");
|
||||||
|
|
||||||
@ -98,6 +95,7 @@ private UpdateStartupContext ParseArgs(string[] args)
|
|||||||
throw new ArgumentOutOfRangeException("args", message);
|
throw new ArgumentOutOfRangeException("args", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return startupContext;
|
return startupContext;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user