1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Remove ParsingLibrary

This commit is contained in:
Qstick 2020-11-05 21:43:08 -05:00
parent 025f064ecf
commit 216f9b37b2
8 changed files with 3 additions and 170 deletions

View File

@ -2,9 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
#if !LIBRARY
using NzbDrone.Common.EnsureThat;
#endif
namespace NzbDrone.Core
{
@ -12,9 +10,8 @@ public static class Fluent
{
public static string WithDefault(this string actual, object defaultValue)
{
#if !LIBRARY
Ensure.That(defaultValue, () => defaultValue).IsNotNull();
#endif
if (string.IsNullOrWhiteSpace(actual))
{
return defaultValue.ToString();

View File

@ -241,9 +241,7 @@ public static Language ParseSubtitleLanguage(string fileName)
{
try
{
#if !LIBRARY
Logger.Debug("Parsing language from subtitle file: {0}", fileName);
#endif
var simpleFilename = Path.GetFileNameWithoutExtension(fileName);
var languageMatch = SubtitleLanguageRegex.Match(simpleFilename);
@ -255,15 +253,12 @@ public static Language ParseSubtitleLanguage(string fileName)
return isoLanguage?.Language ?? Language.Unknown;
}
#if !LIBRARY
Logger.Debug("Unable to parse langauge from subtitle file: {0}", fileName);
#endif
}
catch (Exception)
{
#if !LIBRARY
Logger.Debug("Failed parsing langauge from subtitle file: {0}", fileName);
#endif
}
return Language.Unknown;

View File

@ -25,35 +25,5 @@ public override string ToString()
{
return string.Format("{0} - {1} {2}", MovieTitle, Year, Quality);
}
#if LIBRARY
public static ParsedMovieInfo ParseMovieInfo(string title)
{
var parsedMovie = Parser.ParseMovieTitle(title, false);
if (parsedMovie == null) return null;
parsedMovie.Languages = LanguageParser.ParseLanguages(parsedMovie.SimpleReleaseTitle);
parsedMovie.Quality = QualityParser.ParseQuality(parsedMovie.SimpleReleaseTitle);
if (parsedMovie.Edition.IsNullOrWhiteSpace())
{
parsedMovie.Edition = Parser.ParseEdition(parsedMovie.SimpleReleaseTitle);
}
parsedMovie.ReleaseGroup = Parser.ParseReleaseGroup(parsedMovie.SimpleReleaseTitle);
parsedMovie.ImdbId = Parser.ParseImdbId(parsedMovie.SimpleReleaseTitle);
parsedMovie.Languages =
LanguageParser.EnhanceLanguages(parsedMovie.SimpleReleaseTitle, parsedMovie.Languages);
parsedMovie.Quality.Quality = Qualities.Quality.FindByInfo(parsedMovie.Quality.Source, parsedMovie.Quality.Resolution,
parsedMovie.Quality.Modifier);
return parsedMovie;
}
#endif
}
}

View File

@ -7,8 +7,6 @@
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation;
using NzbDrone.Core.Parser.Model;
#if !LIBRARY
#endif
namespace NzbDrone.Core.Parser
{

View File

@ -164,7 +164,7 @@ static Quality()
{
AllLookup[quality.Id] = quality;
}
#if !LIBRARY
DefaultQualityDefinitions = new HashSet<QualityDefinition>
{
new QualityDefinition(Quality.Unknown) { Weight = 1, MinSize = 0, MaxSize = 100, PreferredSize = 95 },
@ -203,15 +203,12 @@ static Quality()
new QualityDefinition(Quality.BRDISK) { Weight = 25, MinSize = 0, MaxSize = null, PreferredSize = null },
new QualityDefinition(Quality.RAWHD) { Weight = 26, MinSize = 0, MaxSize = null, PreferredSize = null }
};
#endif
}
public static readonly List<Quality> All;
public static readonly Quality[] AllLookup;
#if !LIBRARY
public static readonly HashSet<QualityDefinition> DefaultQualityDefinitions;
#endif
public static Quality FindById(int id)
{
if (id == 0)

View File

@ -1,17 +0,0 @@
using System;
namespace NzbDrone.Common.Instrumentation
{
public static class NzbDroneLogger
{
public static Logger GetLogger(Type type)
{
return LogManager.GetLogger(type.Name.Replace("NzbDrone.", ""));
}
public static Logger GetLogger(object obj)
{
return GetLogger(obj.GetType());
}
}
}

View File

@ -1,95 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0;LIBRARY;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>TRACE;RELEASE;NETSTANDARD;NETSTANDARD2_0;LIBRARY</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\NzbDrone.Common\Exceptions\NzbDroneException.cs">
<Link>NzbDroneException.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Common\Extensions\DictionaryExtensions.cs">
<Link>DictionaryExtensions.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Common\Extensions\IEnumerableExtensions.cs">
<Link>IEnumerableExtensions.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Common\Extensions\Int64Extensions.cs">
<Link>Int64Extensions.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Common\Extensions\StringExtensions.cs">
<Link>StringExtensions.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\CustomFormats\CustomFormat.cs">
<Link>CustomFormat.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\CustomFormats\FormatTag.cs">
<Link>FormatTag.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Datastore\IEmbeddedDocument.cs">
<Link>IEmbeddedDocument.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Datastore\ModelBase.cs">
<Link>ModelBase.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Fluent.cs">
<Link>Fluent.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\MediaFiles\MediaFileExtensions.cs">
<Link>MediaFileExtensions.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\InvalidDateException.cs">
<Link>InvalidDateException.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\IsoLanguage.cs">
<Link>IsoLanguage.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\IsoLanguages.cs">
<Link>IsoLanguages.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\Language.cs">
<Link>Language.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\LanguageParser.cs">
<Link>LanguageParser.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\Model\ParsedMovieInfo.cs">
<Link>ParsedMovieInfo.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\Parser.cs">
<Link>Parser.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\QualityParser.cs">
<Link>QualityParser.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Parser\SceneChecker.cs">
<Link>SceneChecker.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Qualities\Quality.cs">
<Link>Quality.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Qualities\QualityModel.cs">
<Link>QualityModel.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Qualities\QualitySource.cs">
<Link>QualitySource.cs</Link>
</Compile>
<Compile Include="..\NzbDrone.Core\Qualities\Revision.cs">
<Link>Revision.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="NLog" Version="4.5.11" />
</ItemGroup>
</Project>

View File

@ -1,12 +0,0 @@
using System.IO;
namespace NzbDrone.Common.Extensions
{
public static class PathExtensions
{
public static bool ContainsInvalidPathChars(this string text)
{
return text.IndexOfAny(Path.GetInvalidPathChars()) >= 0;
}
}
}