1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00

Onedr0p/3 8 17 (#1087)

* Move ToUrlSlug to Parser, fix issue with trakt lists that have non-alphanumeric characters

* Move "Add movies" link in nav to the first link

* String interpolation!

* Add Limit to Trakt List Settings to limit the amount of movies returned, 50 by default

* Updates to FailedDownload

* Update DownloadService and CompleteDownloadService
This commit is contained in:
Devin Buhl
2017-03-08 19:00:00 -05:00
committed by GitHub
parent 5c22d0b61d
commit 571730ddec
11 changed files with 67 additions and 115 deletions
+25
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using NLog;
using NzbDrone.Common.Extensions;
@@ -608,6 +609,30 @@ namespace NzbDrone.Core.Parser
return null;
}
public static string ToUrlSlug(string value)
{
//First to lower case
value = value.ToLowerInvariant();
//Remove all accents
var bytes = Encoding.GetEncoding("ISO-8859-8").GetBytes(value);
value = Encoding.ASCII.GetString(bytes);
//Replace spaces
value = Regex.Replace(value, @"\s", "-", RegexOptions.Compiled);
//Remove invalid chars
value = Regex.Replace(value, @"[^a-z0-9\s-_]", "", RegexOptions.Compiled);
//Trim dashes from end
value = value.Trim('-', '_');
//Replace double occurences of - or _
value = Regex.Replace(value, @"([-_]){2,}", "$1", RegexOptions.Compiled);
return value;
}
public static string ParseSeriesName(string title)
{
Logger.Debug("Parsing string '{0}'", title);