mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Replace tabs with 4 spaces
This commit is contained in:
parent
8476e36122
commit
997ff74fb9
@ -110,11 +110,11 @@ private Table GetBaseTable()
|
||||
/*
|
||||
WITH GroupCTE AS
|
||||
(
|
||||
SELECT [t0].[ID],[t0].[OrderName],[t1].[ID] AS OrderItemID,[t1].[OrderID],[t1].[ItemDescription],[t1].[Price],
|
||||
ROW_NUMBER() OVER (PARTITION BY [t0].[ID] ORDER BY [t0].[OrderName]) As GroupRow
|
||||
FROM [Order] [t0]
|
||||
LEFT JOIN [OrderItem] [t1] ON (([t0].[ID] = [t1].[OrderID]))
|
||||
--WHERE (([t0].[OrderName] = @P0))
|
||||
SELECT [t0].[ID],[t0].[OrderName],[t1].[ID] AS OrderItemID,[t1].[OrderID],[t1].[ItemDescription],[t1].[Price],
|
||||
ROW_NUMBER() OVER (PARTITION BY [t0].[ID] ORDER BY [t0].[OrderName]) As GroupRow
|
||||
FROM [Order] [t0]
|
||||
LEFT JOIN [OrderItem] [t1] ON (([t0].[ID] = [t1].[OrderID]))
|
||||
--WHERE (([t0].[OrderName] = @P0))
|
||||
)
|
||||
SELECT * FROM GroupCTE
|
||||
WHERE GroupRow = 1
|
||||
|
@ -148,7 +148,7 @@ protected override Expression VisitConstant(ConstantExpression expression)
|
||||
private object GetRightValue(Expression expression)
|
||||
{
|
||||
object rightValue = null;
|
||||
|
||||
|
||||
var simpleConstExp = expression as ConstantExpression;
|
||||
if (simpleConstExp == null) // Value is not directly passed in as a constant
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ private static GetterDelegate GetPropertyGetter(PropertyInfo propertyInfo)
|
||||
if (getMethodInfo == null) return null;
|
||||
|
||||
#if NO_EXPRESSIONS
|
||||
return o => propertyInfo.GetGetMethod().Invoke(o, new object[] { });
|
||||
return o => propertyInfo.GetGetMethod().Invoke(o, new object[] { });
|
||||
#else
|
||||
try
|
||||
{
|
||||
|
@ -4,31 +4,31 @@
|
||||
|
||||
namespace MonoTorrent
|
||||
{
|
||||
public delegate long Operation<T>(T target);
|
||||
public delegate long Operation<T>(T target);
|
||||
|
||||
public static class Toolbox
|
||||
{
|
||||
private static Random r = new Random();
|
||||
public static int Count<T>(IEnumerable<T> enumerable, Predicate<T> predicate)
|
||||
{
|
||||
int count = 0;
|
||||
public static int Count<T>(IEnumerable<T> enumerable, Predicate<T> predicate)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
foreach (T t in enumerable)
|
||||
if (predicate(t))
|
||||
count++;
|
||||
foreach (T t in enumerable)
|
||||
if (predicate(t))
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static long Accumulate<T>(IEnumerable<T> enumerable, Operation<T> action)
|
||||
{
|
||||
public static long Accumulate<T>(IEnumerable<T> enumerable, Operation<T> action)
|
||||
{
|
||||
long count = 0;
|
||||
|
||||
foreach (T t in enumerable)
|
||||
count += action(t);
|
||||
|
||||
return count;
|
||||
}
|
||||
foreach (T t in enumerable)
|
||||
count += action(t);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void RaiseAsyncEvent<T>(EventHandler<T> e, object o, T args)
|
||||
where T : EventArgs
|
||||
|
@ -62,17 +62,17 @@ public IList<RawTrackerTier> AnnounceUrls
|
||||
/// <summary>
|
||||
/// This dictionary is specific for azureus client
|
||||
/// It can contain
|
||||
/// dht_backup_enable (number)
|
||||
/// Content (dictionnary)
|
||||
/// Publisher
|
||||
/// Description
|
||||
/// Title
|
||||
/// Creation Date
|
||||
/// Content Hash
|
||||
/// Revision Date
|
||||
/// Thumbnail (string) = Base64 encoded image
|
||||
/// Progressive
|
||||
/// Speed Bps (number)
|
||||
/// dht_backup_enable (number)
|
||||
/// Content (dictionnary)
|
||||
/// Publisher
|
||||
/// Description
|
||||
/// Title
|
||||
/// Creation Date
|
||||
/// Content Hash
|
||||
/// Revision Date
|
||||
/// Thumbnail (string) = Base64 encoded image
|
||||
/// Progressive
|
||||
/// Speed Bps (number)
|
||||
/// but not useful for MT
|
||||
/// </summary>
|
||||
public BEncodedValue AzureusProperties
|
||||
|
@ -11,9 +11,9 @@ public class IndexerConfigResource : RestResource
|
||||
public int Retention { get; set; }
|
||||
public int RssSyncInterval { get; set; }
|
||||
public bool PreferIndexerFlags { get; set; }
|
||||
public int AvailabilityDelay { get; set; }
|
||||
public bool AllowHardcodedSubs { get; set; }
|
||||
public string WhitelistedHardcodedSubs { get; set; }
|
||||
public int AvailabilityDelay { get; set; }
|
||||
public bool AllowHardcodedSubs { get; set; }
|
||||
public string WhitelistedHardcodedSubs { get; set; }
|
||||
public ParsingLeniencyType ParsingLeniency { get; set; }
|
||||
}
|
||||
|
||||
@ -28,9 +28,9 @@ public static IndexerConfigResource ToResource(IConfigService model)
|
||||
Retention = model.Retention,
|
||||
RssSyncInterval = model.RssSyncInterval,
|
||||
PreferIndexerFlags = model.PreferIndexerFlags,
|
||||
AvailabilityDelay = model.AvailabilityDelay,
|
||||
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
||||
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
||||
AvailabilityDelay = model.AvailabilityDelay,
|
||||
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
||||
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
||||
ParsingLeniency = model.ParsingLeniency,
|
||||
};
|
||||
}
|
||||
|
@ -34,14 +34,14 @@ public class MovieBulkImportModule : RadarrRestModule<MovieResource>
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
private readonly IMakeImportDecision _importDecisionMaker;
|
||||
private readonly IDiskScanService _diskScanService;
|
||||
private readonly ICached<Core.Movies.Movie> _mappedMovies;
|
||||
private readonly ICached<Core.Movies.Movie> _mappedMovies;
|
||||
private readonly IParsingService _parsingService;
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly IMovieService _movieService;
|
||||
|
||||
public MovieBulkImportModule(ISearchForNewMovie searchProxy, IRootFolderService rootFolderService,
|
||||
IMakeImportDecision importDecisionMaker,
|
||||
IDiskScanService diskScanService, ICacheManager cacheManager,
|
||||
IDiskScanService diskScanService, ICacheManager cacheManager,
|
||||
IParsingService parsingService, IProfileService profileService, IMovieService movieService)
|
||||
: base("/movies/bulkimport")
|
||||
{
|
||||
@ -49,7 +49,7 @@ public MovieBulkImportModule(ISearchForNewMovie searchProxy, IRootFolderService
|
||||
_rootFolderService = rootFolderService;
|
||||
_importDecisionMaker = importDecisionMaker;
|
||||
_diskScanService = diskScanService;
|
||||
_mappedMovies = cacheManager.GetCache<Core.Movies.Movie>(GetType(), "mappedMoviesCache");
|
||||
_mappedMovies = cacheManager.GetCache<Core.Movies.Movie>(GetType(), "mappedMoviesCache");
|
||||
_movieService = movieService;
|
||||
_profileService = profileService;
|
||||
_parsingService = parsingService;
|
||||
@ -89,73 +89,73 @@ private object Search()
|
||||
var paged = unmapped.GetRange(min, max-min);
|
||||
|
||||
var mapped = paged.Select(f =>
|
||||
{
|
||||
Core.Movies.Movie m = null;
|
||||
{
|
||||
Core.Movies.Movie m = null;
|
||||
|
||||
var mappedMovie = _mappedMovies.Find(f.Name);
|
||||
var mappedMovie = _mappedMovies.Find(f.Name);
|
||||
|
||||
if (mappedMovie != null)
|
||||
{
|
||||
return mappedMovie;
|
||||
}
|
||||
if (mappedMovie != null)
|
||||
{
|
||||
return mappedMovie;
|
||||
}
|
||||
|
||||
var parsedTitle = _parsingService.ParseMinimalPathMovieInfo(f.Name);
|
||||
if (parsedTitle == null)
|
||||
{
|
||||
m = new Core.Movies.Movie
|
||||
{
|
||||
Title = f.Name.Replace(".", " ").Replace("-", " "),
|
||||
Path = f.Path,
|
||||
Profile = tempProfile
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
parsedTitle.ImdbId = Parser.ParseImdbId(parsedTitle.SimpleReleaseTitle);
|
||||
var parsedTitle = _parsingService.ParseMinimalPathMovieInfo(f.Name);
|
||||
if (parsedTitle == null)
|
||||
{
|
||||
m = new Core.Movies.Movie
|
||||
{
|
||||
Title = f.Name.Replace(".", " ").Replace("-", " "),
|
||||
Path = f.Path,
|
||||
Profile = tempProfile
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
parsedTitle.ImdbId = Parser.ParseImdbId(parsedTitle.SimpleReleaseTitle);
|
||||
|
||||
m = new Core.Movies.Movie
|
||||
{
|
||||
Title = parsedTitle.MovieTitle,
|
||||
Year = parsedTitle.Year,
|
||||
ImdbId = parsedTitle.ImdbId,
|
||||
Path = f.Path,
|
||||
Profile = tempProfile
|
||||
};
|
||||
}
|
||||
m = new Core.Movies.Movie
|
||||
{
|
||||
Title = parsedTitle.MovieTitle,
|
||||
Year = parsedTitle.Year,
|
||||
ImdbId = parsedTitle.ImdbId,
|
||||
Path = f.Path,
|
||||
Profile = tempProfile
|
||||
};
|
||||
}
|
||||
|
||||
var files = _diskScanService.GetVideoFiles(f.Path);
|
||||
var files = _diskScanService.GetVideoFiles(f.Path);
|
||||
|
||||
var decisions = _importDecisionMaker.GetImportDecisions(files.ToList(), m);
|
||||
var decisions = _importDecisionMaker.GetImportDecisions(files.ToList(), m);
|
||||
|
||||
var decision = decisions.Where(d => d.Approved && !d.Rejections.Any()).FirstOrDefault();
|
||||
var decision = decisions.Where(d => d.Approved && !d.Rejections.Any()).FirstOrDefault();
|
||||
|
||||
if (decision != null)
|
||||
{
|
||||
var local = decision.LocalMovie;
|
||||
if (decision != null)
|
||||
{
|
||||
var local = decision.LocalMovie;
|
||||
|
||||
m.MovieFile = new MovieFile
|
||||
{
|
||||
Path = local.Path,
|
||||
Edition = local.Edition,
|
||||
Quality = local.Quality,
|
||||
MediaInfo = local.MediaInfo,
|
||||
ReleaseGroup = local.ReleaseGroup,
|
||||
RelativePath = f.Path.GetRelativePath(local.Path)
|
||||
};
|
||||
}
|
||||
m.MovieFile = new MovieFile
|
||||
{
|
||||
Path = local.Path,
|
||||
Edition = local.Edition,
|
||||
Quality = local.Quality,
|
||||
MediaInfo = local.MediaInfo,
|
||||
ReleaseGroup = local.ReleaseGroup,
|
||||
RelativePath = f.Path.GetRelativePath(local.Path)
|
||||
};
|
||||
}
|
||||
|
||||
mappedMovie = _searchProxy.MapMovieToTmdbMovie(m);
|
||||
mappedMovie = _searchProxy.MapMovieToTmdbMovie(m);
|
||||
|
||||
if (mappedMovie != null)
|
||||
{
|
||||
mappedMovie.Monitored = true;
|
||||
if (mappedMovie != null)
|
||||
{
|
||||
mappedMovie.Monitored = true;
|
||||
|
||||
_mappedMovies.Set(f.Name, mappedMovie, TimeSpan.FromDays(2));
|
||||
_mappedMovies.Set(f.Name, mappedMovie, TimeSpan.FromDays(2));
|
||||
|
||||
return mappedMovie;
|
||||
}
|
||||
return mappedMovie;
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
});
|
||||
|
||||
return new PagingResource<MovieResource>
|
||||
|
@ -47,7 +47,7 @@ public MovieResource()
|
||||
|
||||
//Editing Only
|
||||
public bool Monitored { get; set; }
|
||||
public MovieStatusType MinimumAvailability { get; set; }
|
||||
public MovieStatusType MinimumAvailability { get; set; }
|
||||
public bool IsAvailable { get; set; }
|
||||
public string FolderName { get; set; }
|
||||
|
||||
@ -145,7 +145,7 @@ public static MovieResource ToResource(this Core.Movies.Movie model)
|
||||
|
||||
Monitored = model.Monitored,
|
||||
MinimumAvailability = model.MinimumAvailability,
|
||||
|
||||
|
||||
IsAvailable = model.IsAvailable(),
|
||||
FolderName = model.FolderName(),
|
||||
|
||||
@ -205,7 +205,7 @@ public static Core.Movies.Movie ToModel(this MovieResource resource)
|
||||
|
||||
Monitored = resource.Monitored,
|
||||
MinimumAvailability = resource.MinimumAvailability,
|
||||
|
||||
|
||||
Runtime = resource.Runtime,
|
||||
LastInfoSync = resource.LastInfoSync,
|
||||
CleanTitle = resource.CleanTitle,
|
||||
|
@ -81,10 +81,10 @@ namespace TinyIoC
|
||||
#endif
|
||||
|
||||
#if NETFX_CORE
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage.Search;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Storage.Search;
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml.Shapes;
|
||||
using Windows.UI.Xaml.Shapes;
|
||||
#endif
|
||||
|
||||
#region SafeDictionary
|
||||
@ -322,32 +322,32 @@ static TypeExtensions()
|
||||
}
|
||||
|
||||
//#if NETFX_CORE
|
||||
// /// <summary>
|
||||
// /// Gets a generic method from a type given the method name, generic types and parameter types
|
||||
// /// </summary>
|
||||
// /// <param name="sourceType">Source type</param>
|
||||
// /// <param name="methodName">Name of the method</param>
|
||||
// /// <param name="genericTypes">Generic types to use to make the method generic</param>
|
||||
// /// <param name="parameterTypes">Method parameters</param>
|
||||
// /// <returns>MethodInfo or null if no matches found</returns>
|
||||
// /// <exception cref="System.Reflection.AmbiguousMatchException"/>
|
||||
// /// <exception cref="System.ArgumentException"/>
|
||||
// public static MethodInfo GetGenericMethod(this Type sourceType, string methodName, Type[] genericTypes, Type[] parameterTypes)
|
||||
// {
|
||||
// MethodInfo method;
|
||||
// var cacheKey = new GenericMethodCacheKey(sourceType, methodName, genericTypes, parameterTypes);
|
||||
// /// <summary>
|
||||
// /// Gets a generic method from a type given the method name, generic types and parameter types
|
||||
// /// </summary>
|
||||
// /// <param name="sourceType">Source type</param>
|
||||
// /// <param name="methodName">Name of the method</param>
|
||||
// /// <param name="genericTypes">Generic types to use to make the method generic</param>
|
||||
// /// <param name="parameterTypes">Method parameters</param>
|
||||
// /// <returns>MethodInfo or null if no matches found</returns>
|
||||
// /// <exception cref="System.Reflection.AmbiguousMatchException"/>
|
||||
// /// <exception cref="System.ArgumentException"/>
|
||||
// public static MethodInfo GetGenericMethod(this Type sourceType, string methodName, Type[] genericTypes, Type[] parameterTypes)
|
||||
// {
|
||||
// MethodInfo method;
|
||||
// var cacheKey = new GenericMethodCacheKey(sourceType, methodName, genericTypes, parameterTypes);
|
||||
|
||||
// // Shouldn't need any additional locking
|
||||
// // we don't care if we do the method info generation
|
||||
// // more than once before it gets cached.
|
||||
// if (!_genericMethodCache.TryGetValue(cacheKey, out method))
|
||||
// {
|
||||
// method = GetMethod(sourceType, methodName, genericTypes, parameterTypes);
|
||||
// _genericMethodCache[cacheKey] = method;
|
||||
// }
|
||||
// // Shouldn't need any additional locking
|
||||
// // we don't care if we do the method info generation
|
||||
// // more than once before it gets cached.
|
||||
// if (!_genericMethodCache.TryGetValue(cacheKey, out method))
|
||||
// {
|
||||
// method = GetMethod(sourceType, methodName, genericTypes, parameterTypes);
|
||||
// _genericMethodCache[cacheKey] = method;
|
||||
// }
|
||||
|
||||
// return method;
|
||||
// }
|
||||
// return method;
|
||||
// }
|
||||
//#else
|
||||
/// <summary>
|
||||
/// Gets a generic method from a type given the method name, binding flags, generic types and parameter types
|
||||
@ -514,14 +514,14 @@ private int GenerateHashCode()
|
||||
|
||||
// @mbrit - 2012-05-22 - shim for ForEach call on List<T>...
|
||||
#if NETFX_CORE
|
||||
internal static class ListExtender
|
||||
{
|
||||
internal static void ForEach<T>(this List<T> list, Action<T> callback)
|
||||
{
|
||||
foreach (T obj in list)
|
||||
callback(obj);
|
||||
}
|
||||
}
|
||||
internal static class ListExtender
|
||||
{
|
||||
internal static void ForEach<T>(this List<T> list, Action<T> callback)
|
||||
{
|
||||
foreach (T obj in list)
|
||||
callback(obj);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
@ -771,33 +771,33 @@ static AppDomain()
|
||||
CurrentDomain = new AppDomain();
|
||||
}
|
||||
|
||||
// @mbrit - 2012-05-30 - in WinRT, this should be done async...
|
||||
// @mbrit - 2012-05-30 - in WinRT, this should be done async...
|
||||
public async Task<List<Assembly>> GetAssembliesAsync()
|
||||
{
|
||||
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
||||
|
||||
List<Assembly> assemblies = new List<Assembly>();
|
||||
|
||||
var files = await folder.GetFilesAsync();
|
||||
var files = await folder.GetFilesAsync();
|
||||
|
||||
foreach (StorageFile file in files)
|
||||
{
|
||||
if (file.FileType == ".dll" || file.FileType == ".exe")
|
||||
{
|
||||
AssemblyName name = new AssemblyName() { Name = System.IO.Path.GetFileNameWithoutExtension(file.Name) };
|
||||
try
|
||||
{
|
||||
var asm = Assembly.Load(name);
|
||||
assemblies.Add(asm);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore exceptions here...
|
||||
}
|
||||
try
|
||||
{
|
||||
var asm = Assembly.Load(name);
|
||||
assemblies.Add(asm);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore exceptions here...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return assemblies;
|
||||
return assemblies;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1387,7 +1387,7 @@ public MultiRegisterOptions RegisterMultiple(Type registrationType, IEnumerable<
|
||||
|
||||
foreach (var type in implementationTypes)
|
||||
//#if NETFX_CORE
|
||||
// if (!registrationType.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
|
||||
// if (!registrationType.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()))
|
||||
//#else
|
||||
if (!registrationType.IsAssignableFrom(type))
|
||||
//#endif
|
||||
@ -2446,8 +2446,8 @@ private class MultiInstanceFactory : ObjectFactoryBase
|
||||
public MultiInstanceFactory(Type registerType, Type registerImplementation)
|
||||
{
|
||||
//#if NETFX_CORE
|
||||
// if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface())
|
||||
// throw new TinyIoCRegistrationTypeException(registerImplementation, "MultiInstanceFactory");
|
||||
// if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface())
|
||||
// throw new TinyIoCRegistrationTypeException(registerImplementation, "MultiInstanceFactory");
|
||||
//#else
|
||||
if (registerImplementation.IsAbstract() || registerImplementation.IsInterface())
|
||||
throw new TinyIoCRegistrationTypeException(registerImplementation, "MultiInstanceFactory");
|
||||
@ -2713,7 +2713,7 @@ private class SingletonFactory : ObjectFactoryBase, IDisposable
|
||||
public SingletonFactory(Type registerType, Type registerImplementation)
|
||||
{
|
||||
//#if NETFX_CORE
|
||||
// if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface())
|
||||
// if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface())
|
||||
//#else
|
||||
if (registerImplementation.IsAbstract() || registerImplementation.IsInterface())
|
||||
//#endif
|
||||
@ -2789,7 +2789,7 @@ public CustomObjectLifetimeFactory(Type registerType, Type registerImplementatio
|
||||
throw new TinyIoCRegistrationTypeException(registerImplementation, "SingletonFactory");
|
||||
|
||||
//#if NETFX_CORE
|
||||
// if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface())
|
||||
// if (registerImplementation.GetTypeInfo().IsAbstract() || registerImplementation.GetTypeInfo().IsInterface())
|
||||
//#else
|
||||
if (registerImplementation.IsAbstract() || registerImplementation.IsInterface())
|
||||
//#endif
|
||||
@ -3093,7 +3093,7 @@ private void RemoveRegistration(TypeRegistration typeRegistration)
|
||||
private ObjectFactoryBase GetDefaultObjectFactory(Type registerType, Type registerImplementation)
|
||||
{
|
||||
//#if NETFX_CORE
|
||||
// if (registerType.GetTypeInfo().IsInterface() || registerType.GetTypeInfo().IsAbstract())
|
||||
// if (registerType.GetTypeInfo().IsInterface() || registerType.GetTypeInfo().IsAbstract())
|
||||
//#else
|
||||
if (registerType.IsInterface() || registerType.IsAbstract())
|
||||
//#endif
|
||||
@ -3185,7 +3185,7 @@ private bool IsAutomaticLazyFactoryRequest(Type type)
|
||||
|
||||
// 2 parameter func with string as first parameter (name)
|
||||
//#if NETFX_CORE
|
||||
// if ((genericType == typeof(Func<,>) && type.GetTypeInfo().GenericTypeArguments[0] == typeof(string)))
|
||||
// if ((genericType == typeof(Func<,>) && type.GetTypeInfo().GenericTypeArguments[0] == typeof(string)))
|
||||
//#else
|
||||
if ((genericType == typeof(Func<,>) && type.GetGenericArguments()[0] == typeof(string)))
|
||||
//#endif
|
||||
@ -3193,7 +3193,7 @@ private bool IsAutomaticLazyFactoryRequest(Type type)
|
||||
|
||||
// 3 parameter func with string as first parameter (name) and IDictionary<string, object> as second (parameters)
|
||||
//#if NETFX_CORE
|
||||
// if ((genericType == typeof(Func<,,>) && type.GetTypeInfo().GenericTypeArguments[0] == typeof(string) && type.GetTypeInfo().GenericTypeArguments[1] == typeof(IDictionary<String, object>)))
|
||||
// if ((genericType == typeof(Func<,,>) && type.GetTypeInfo().GenericTypeArguments[0] == typeof(string) && type.GetTypeInfo().GenericTypeArguments[1] == typeof(IDictionary<String, object>)))
|
||||
//#else
|
||||
if ((genericType == typeof(Func<,,>) && type.GetGenericArguments()[0] == typeof(string) && type.GetGenericArguments()[1] == typeof(IDictionary<string, object>)))
|
||||
//#endif
|
||||
@ -3331,7 +3331,7 @@ private object GetLazyAutomaticFactoryRequest(Type type)
|
||||
|
||||
Type genericType = type.GetGenericTypeDefinition();
|
||||
//#if NETFX_CORE
|
||||
// Type[] genericArguments = type.GetTypeInfo().GenericTypeArguments.ToArray();
|
||||
// Type[] genericArguments = type.GetTypeInfo().GenericTypeArguments.ToArray();
|
||||
//#else
|
||||
Type[] genericArguments = type.GetGenericArguments();
|
||||
//#endif
|
||||
@ -3342,7 +3342,7 @@ private object GetLazyAutomaticFactoryRequest(Type type)
|
||||
Type returnType = genericArguments[0];
|
||||
|
||||
//#if NETFX_CORE
|
||||
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => !mi.GetParameters().Any());
|
||||
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => !mi.GetParameters().Any());
|
||||
//#else
|
||||
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { });
|
||||
//#endif
|
||||
@ -3361,7 +3361,7 @@ private object GetLazyAutomaticFactoryRequest(Type type)
|
||||
Type returnType = genericArguments[1];
|
||||
|
||||
//#if NETFX_CORE
|
||||
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 1 && mi.GetParameters()[0].GetType() == typeof(String));
|
||||
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 1 && mi.GetParameters()[0].GetType() == typeof(String));
|
||||
//#else
|
||||
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(string) });
|
||||
//#endif
|
||||
@ -3377,7 +3377,7 @@ private object GetLazyAutomaticFactoryRequest(Type type)
|
||||
|
||||
// 3 parameter func with string as first parameter (name) and IDictionary<string, object> as second (parameters)
|
||||
//#if NETFX_CORE
|
||||
// if ((genericType == typeof(Func<,,>) && type.GenericTypeArguments[0] == typeof(string) && type.GenericTypeArguments[1] == typeof(IDictionary<string, object>)))
|
||||
// if ((genericType == typeof(Func<,,>) && type.GenericTypeArguments[0] == typeof(string) && type.GenericTypeArguments[1] == typeof(IDictionary<string, object>)))
|
||||
//#else
|
||||
if ((genericType == typeof(Func<,,>) && type.GetGenericArguments()[0] == typeof(string) && type.GetGenericArguments()[1] == typeof(IDictionary<string, object>)))
|
||||
//#endif
|
||||
@ -3388,7 +3388,7 @@ private object GetLazyAutomaticFactoryRequest(Type type)
|
||||
var parameters = Expression.Parameter(typeof(IDictionary<string, object>), "parameters");
|
||||
|
||||
//#if NETFX_CORE
|
||||
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 2 && mi.GetParameters()[0].GetType() == typeof(String) && mi.GetParameters()[1].GetType() == typeof(NamedParameterOverloads));
|
||||
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 2 && mi.GetParameters()[0].GetType() == typeof(String) && mi.GetParameters()[1].GetType() == typeof(NamedParameterOverloads));
|
||||
//#else
|
||||
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(string), typeof(NamedParameterOverloads) });
|
||||
//#endif
|
||||
@ -3407,7 +3407,7 @@ private object GetLazyAutomaticFactoryRequest(Type type)
|
||||
private object GetIEnumerableRequest(Type type)
|
||||
{
|
||||
//#if NETFX_CORE
|
||||
// var genericResolveAllMethod = this.GetType().GetGenericMethod("ResolveAll", type.GenericTypeArguments, new[] { typeof(bool) });
|
||||
// var genericResolveAllMethod = this.GetType().GetGenericMethod("ResolveAll", type.GenericTypeArguments, new[] { typeof(bool) });
|
||||
//#else
|
||||
var genericResolveAllMethod = this.GetType().GetGenericMethod(BindingFlags.Public | BindingFlags.Instance, "ResolveAll", type.GetGenericArguments(), new[] { typeof(bool) });
|
||||
//#endif
|
||||
@ -3428,7 +3428,7 @@ private bool CanConstruct(ConstructorInfo ctor, NamedParameterOverloads paramete
|
||||
var isParameterOverload = parameters.ContainsKey(parameter.Name);
|
||||
|
||||
//#if NETFX_CORE
|
||||
// if (parameter.ParameterType.GetTypeInfo().IsPrimitive && !isParameterOverload)
|
||||
// if (parameter.ParameterType.GetTypeInfo().IsPrimitive && !isParameterOverload)
|
||||
//#else
|
||||
if (parameter.ParameterType.IsPrimitive() && !isParameterOverload)
|
||||
//#endif
|
||||
@ -3447,7 +3447,7 @@ private ConstructorInfo GetBestConstructor(Type type, NamedParameterOverloads pa
|
||||
throw new ArgumentNullException("parameters");
|
||||
|
||||
//#if NETFX_CORE
|
||||
// if (type.GetTypeInfo().IsValueType)
|
||||
// if (type.GetTypeInfo().IsValueType)
|
||||
//#else
|
||||
if (type.IsValueType())
|
||||
//#endif
|
||||
@ -3469,7 +3469,7 @@ private ConstructorInfo GetBestConstructor(Type type, NamedParameterOverloads pa
|
||||
private IEnumerable<ConstructorInfo> GetTypeConstructors(Type type)
|
||||
{
|
||||
//#if NETFX_CORE
|
||||
// return type.GetTypeInfo().DeclaredConstructors.OrderByDescending(ctor => ctor.GetParameters().Count());
|
||||
// return type.GetTypeInfo().DeclaredConstructors.OrderByDescending(ctor => ctor.GetParameters().Count());
|
||||
//#else
|
||||
return type.GetConstructors().OrderByDescending(ctor => ctor.GetParameters().Count());
|
||||
//#endif
|
||||
@ -3605,9 +3605,9 @@ private static ObjectConstructor CreateObjectConstructionDelegateWithCache(Const
|
||||
private void BuildUpInternal(object input, ResolveOptions resolveOptions)
|
||||
{
|
||||
//#if NETFX_CORE
|
||||
// var properties = from property in input.GetType().GetTypeInfo().DeclaredProperties
|
||||
// where (property.GetMethod != null) && (property.SetMethod != null) && !property.PropertyType.GetTypeInfo().IsValueType
|
||||
// select property;
|
||||
// var properties = from property in input.GetType().GetTypeInfo().DeclaredProperties
|
||||
// where (property.GetMethod != null) && (property.SetMethod != null) && !property.PropertyType.GetTypeInfo().IsValueType
|
||||
// select property;
|
||||
//#else
|
||||
var properties = from property in input.GetType().GetProperties()
|
||||
where (property.GetGetMethod() != null) && (property.GetSetMethod() != null) && !property.PropertyType.IsValueType()
|
||||
@ -3653,26 +3653,26 @@ private IEnumerable<object> ResolveAllInternal(Type resolveType, bool includeUnn
|
||||
private static bool IsValidAssignment(Type registerType, Type registerImplementation)
|
||||
{
|
||||
//#if NETFX_CORE
|
||||
// var registerTypeDef = registerType.GetTypeInfo();
|
||||
// var registerImplementationDef = registerImplementation.GetTypeInfo();
|
||||
// var registerTypeDef = registerType.GetTypeInfo();
|
||||
// var registerImplementationDef = registerImplementation.GetTypeInfo();
|
||||
|
||||
// if (!registerTypeDef.IsGenericTypeDefinition)
|
||||
// {
|
||||
// if (!registerTypeDef.IsAssignableFrom(registerImplementationDef))
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (registerTypeDef.IsInterface())
|
||||
// {
|
||||
// if (!registerImplementationDef.ImplementedInterfaces.Any(t => t.GetTypeInfo().Name == registerTypeDef.Name))
|
||||
// return false;
|
||||
// }
|
||||
// else if (registerTypeDef.IsAbstract() && registerImplementationDef.BaseType() != registerType)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// if (!registerTypeDef.IsGenericTypeDefinition)
|
||||
// {
|
||||
// if (!registerTypeDef.IsAssignableFrom(registerImplementationDef))
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (registerTypeDef.IsInterface())
|
||||
// {
|
||||
// if (!registerImplementationDef.ImplementedInterfaces.Any(t => t.GetTypeInfo().Name == registerTypeDef.Name))
|
||||
// return false;
|
||||
// }
|
||||
// else if (registerTypeDef.IsAbstract() && registerImplementationDef.BaseType() != registerType)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//#else
|
||||
if (!registerType.IsGenericTypeDefinition())
|
||||
{
|
||||
|
@ -10,66 +10,66 @@
|
||||
|
||||
namespace NzbDrone.Core.Test.BulkImport
|
||||
{
|
||||
[TestFixture]
|
||||
public class AddMultiMoviesFixture : CoreTest<MovieService>
|
||||
{
|
||||
private List<Movie> fakeMovies;
|
||||
[TestFixture]
|
||||
public class AddMultiMoviesFixture : CoreTest<MovieService>
|
||||
{
|
||||
private List<Movie> fakeMovies;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
fakeMovies = Builder<Movie>.CreateListOfSize(3).BuildList();
|
||||
fakeMovies.ForEach(m =>
|
||||
{
|
||||
m.Path = null;
|
||||
m.RootFolderPath = @"C:\Test\TV";
|
||||
});
|
||||
}
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
fakeMovies = Builder<Movie>.CreateListOfSize(3).BuildList();
|
||||
fakeMovies.ForEach(m =>
|
||||
{
|
||||
m.Path = null;
|
||||
m.RootFolderPath = @"C:\Test\TV";
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void movies_added_event_should_have_proper_path()
|
||||
{
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(It.IsAny<Movie>(), null))
|
||||
.Returns((Movie m, NamingConfig n) => m.Title);
|
||||
[Test]
|
||||
public void movies_added_event_should_have_proper_path()
|
||||
{
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(It.IsAny<Movie>(), null))
|
||||
.Returns((Movie m, NamingConfig n) => m.Title);
|
||||
|
||||
var movies = Subject.AddMovies(fakeMovies);
|
||||
var movies = Subject.AddMovies(fakeMovies);
|
||||
|
||||
foreach (Movie movie in movies)
|
||||
{
|
||||
movie.Path.Should().NotBeNullOrEmpty();
|
||||
}
|
||||
foreach (Movie movie in movies)
|
||||
{
|
||||
movie.Path.Should().NotBeNullOrEmpty();
|
||||
}
|
||||
|
||||
//Subject.GetAllMovies().Should().HaveCount(3);
|
||||
}
|
||||
//Subject.GetAllMovies().Should().HaveCount(3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void movies_added_should_ignore_already_added()
|
||||
{
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(It.IsAny<Movie>(), null))
|
||||
.Returns((Movie m, NamingConfig n) => m.Title);
|
||||
[Test]
|
||||
public void movies_added_should_ignore_already_added()
|
||||
{
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(It.IsAny<Movie>(), null))
|
||||
.Returns((Movie m, NamingConfig n) => m.Title);
|
||||
|
||||
Mocker.GetMock<IMovieRepository>().Setup(s => s.All()).Returns(new List<Movie> { fakeMovies[0] });
|
||||
Mocker.GetMock<IMovieRepository>().Setup(s => s.All()).Returns(new List<Movie> { fakeMovies[0] });
|
||||
|
||||
var movies = Subject.AddMovies(fakeMovies);
|
||||
var movies = Subject.AddMovies(fakeMovies);
|
||||
|
||||
Mocker.GetMock<IMovieRepository>().Verify(v => v.InsertMany(It.Is<List<Movie>>(l => l.Count == 2)));
|
||||
}
|
||||
Mocker.GetMock<IMovieRepository>().Verify(v => v.InsertMany(It.Is<List<Movie>>(l => l.Count == 2)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void movies_added_should_ignore_duplicates()
|
||||
{
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(It.IsAny<Movie>(), null))
|
||||
.Returns((Movie m, NamingConfig n) => m.Title);
|
||||
[Test]
|
||||
public void movies_added_should_ignore_duplicates()
|
||||
{
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(It.IsAny<Movie>(), null))
|
||||
.Returns((Movie m, NamingConfig n) => m.Title);
|
||||
|
||||
fakeMovies[2].TmdbId = fakeMovies[0].TmdbId;
|
||||
fakeMovies[2].TmdbId = fakeMovies[0].TmdbId;
|
||||
|
||||
var movies = Subject.AddMovies(fakeMovies);
|
||||
var movies = Subject.AddMovies(fakeMovies);
|
||||
|
||||
Mocker.GetMock<IMovieRepository>().Verify(v => v.InsertMany(It.Is<List<Movie>>(l => l.Count == 2)));
|
||||
}
|
||||
Mocker.GetMock<IMovieRepository>().Verify(v => v.InsertMany(It.Is<List<Movie>>(l => l.Count == 2)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -36,26 +36,26 @@ public void Setup()
|
||||
CustomFormatsFixture.GivenCustomFormats(CustomFormats.CustomFormat.None, _customFormat1, _customFormat2);
|
||||
}
|
||||
|
||||
private RemoteMovie GivenRemoteMovie(QualityModel quality, int age = 0, long size = 0, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
{
|
||||
var remoteMovie = new RemoteMovie();
|
||||
remoteMovie.ParsedMovieInfo = new ParsedMovieInfo();
|
||||
remoteMovie.ParsedMovieInfo.MovieTitle = "A Movie";
|
||||
remoteMovie.ParsedMovieInfo.Year = 1998;
|
||||
remoteMovie.ParsedMovieInfo.Quality = quality;
|
||||
private RemoteMovie GivenRemoteMovie(QualityModel quality, int age = 0, long size = 0, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
{
|
||||
var remoteMovie = new RemoteMovie();
|
||||
remoteMovie.ParsedMovieInfo = new ParsedMovieInfo();
|
||||
remoteMovie.ParsedMovieInfo.MovieTitle = "A Movie";
|
||||
remoteMovie.ParsedMovieInfo.Year = 1998;
|
||||
remoteMovie.ParsedMovieInfo.Quality = quality;
|
||||
|
||||
remoteMovie.Movie = Builder<Movie>.CreateNew().With(m => m.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
PreferredTags = new List<string> { "DTS-HD", "SPARKS"}, FormatItems = CustomFormatsFixture.GetSampleFormatItems() })
|
||||
.With(m => m.Title = "A Movie").Build();
|
||||
remoteMovie.Movie = Builder<Movie>.CreateNew().With(m => m.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
PreferredTags = new List<string> { "DTS-HD", "SPARKS"}, FormatItems = CustomFormatsFixture.GetSampleFormatItems() })
|
||||
.With(m => m.Title = "A Movie").Build();
|
||||
|
||||
remoteMovie.Release = new ReleaseInfo();
|
||||
remoteMovie.Release.PublishDate = DateTime.Now.AddDays(-age);
|
||||
remoteMovie.Release.Size = size;
|
||||
remoteMovie.Release.DownloadProtocol = downloadProtocol;
|
||||
remoteMovie.Release.Title = "A Movie 1998";
|
||||
remoteMovie.Release = new ReleaseInfo();
|
||||
remoteMovie.Release.PublishDate = DateTime.Now.AddDays(-age);
|
||||
remoteMovie.Release.Size = size;
|
||||
remoteMovie.Release.DownloadProtocol = downloadProtocol;
|
||||
remoteMovie.Release.Title = "A Movie 1998";
|
||||
|
||||
return remoteMovie;
|
||||
}
|
||||
return remoteMovie;
|
||||
}
|
||||
|
||||
private void GivenPreferredDownloadProtocol(DownloadProtocol downloadProtocol)
|
||||
{
|
||||
@ -70,7 +70,7 @@ private void GivenPreferredDownloadProtocol(DownloadProtocol downloadProtocol)
|
||||
[Test]
|
||||
public void should_put_propers_before_non_propers()
|
||||
{
|
||||
var remoteEpisode1 = GivenRemoteMovie(new QualityModel(Quality.HDTV720p, new Revision(version: 1)));
|
||||
var remoteEpisode1 = GivenRemoteMovie(new QualityModel(Quality.HDTV720p, new Revision(version: 1)));
|
||||
var remoteEpisode2 = GivenRemoteMovie(new QualityModel(Quality.HDTV720p, new Revision(version: 2)));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
@ -177,8 +177,8 @@ public void should_prefer_releases_with_more_seeders()
|
||||
|
||||
remoteEpisode1.Release = torrentInfo1;
|
||||
remoteEpisode1.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
@ -207,8 +207,8 @@ public void should_prefer_releases_with_more_peers_given_equal_number_of_seeds()
|
||||
|
||||
remoteEpisode1.Release = torrentInfo1;
|
||||
remoteEpisode1.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
@ -238,8 +238,8 @@ public void should_prefer_releases_with_more_peers_no_seeds()
|
||||
|
||||
remoteEpisode1.Release = torrentInfo1;
|
||||
remoteEpisode1.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
@ -268,9 +268,9 @@ public void should_prefer_first_release_if_peers_and_size_are_too_similar()
|
||||
torrentInfo1.Size = 250.Megabytes();
|
||||
|
||||
remoteEpisode1.Release = torrentInfo1;
|
||||
remoteEpisode1.Release.Title = "A Movie 1998";
|
||||
remoteEpisode1.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release = torrentInfo2;
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
remoteEpisode2.Release.Title = "A Movie 1998";
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
@ -300,22 +300,22 @@ public void should_prefer_first_release_if_age_and_size_are_too_similar()
|
||||
qualifiedReports.First().RemoteMovie.Release.Should().Be(remoteEpisode1.Release);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_prefer_more_prioritized_words()
|
||||
{
|
||||
var remoteEpisode1 = GivenRemoteMovie(new QualityModel(Quality.HDTV720p));
|
||||
var remoteEpisode2 = GivenRemoteMovie(new QualityModel(Quality.HDTV720p));
|
||||
[Test]
|
||||
public void should_prefer_more_prioritized_words()
|
||||
{
|
||||
var remoteEpisode1 = GivenRemoteMovie(new QualityModel(Quality.HDTV720p));
|
||||
var remoteEpisode2 = GivenRemoteMovie(new QualityModel(Quality.HDTV720p));
|
||||
|
||||
remoteEpisode1.Release.Title += " DTS-HD";
|
||||
remoteEpisode2.Release.Title += " DTS-HD SPARKS";
|
||||
remoteEpisode1.Release.Title += " DTS-HD";
|
||||
remoteEpisode2.Release.Title += " DTS-HD SPARKS";
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
decisions.Add(new DownloadDecision(remoteEpisode2));
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteEpisode1));
|
||||
decisions.Add(new DownloadDecision(remoteEpisode2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisionsForMovies(decisions);
|
||||
qualifiedReports.First().RemoteMovie.Release.Should().Be(remoteEpisode2.Release);
|
||||
}
|
||||
var qualifiedReports = Subject.PrioritizeDecisionsForMovies(decisions);
|
||||
qualifiedReports.First().RemoteMovie.Release.Should().Be(remoteEpisode2.Release);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_prefer_better_custom_format()
|
||||
|
@ -71,14 +71,14 @@ public void Setup()
|
||||
|
||||
private void GivenExistingFile(QualityModel quality)
|
||||
{
|
||||
//_remoteEpisode.Episodes.First().EpisodeFileId = 1;
|
||||
//_remoteEpisode.Episodes.First().EpisodeFileId = 1;
|
||||
|
||||
//_remoteEpisode.Episodes.First().EpisodeFile = new LazyLoaded<EpisodeFile>(new EpisodeFile
|
||||
// {
|
||||
// Quality = quality
|
||||
// });
|
||||
//_remoteEpisode.Episodes.First().EpisodeFile = new LazyLoaded<EpisodeFile>(new EpisodeFile
|
||||
// {
|
||||
// Quality = quality
|
||||
// });
|
||||
|
||||
_remoteEpisode.Movie.MovieFile = new LazyLoaded<MovieFile>(new MovieFile { Quality = quality });
|
||||
_remoteEpisode.Movie.MovieFile = new LazyLoaded<MovieFile>(new MovieFile { Quality = quality });
|
||||
}
|
||||
|
||||
private void GivenUpgradeForExistingFile()
|
||||
|
@ -63,9 +63,9 @@ public void Setup()
|
||||
|
||||
private RemoteMovie BuildRemoteMovie()
|
||||
{
|
||||
return new RemoteMovie
|
||||
{
|
||||
Movie = new Movie()
|
||||
return new RemoteMovie
|
||||
{
|
||||
Movie = new Movie()
|
||||
};
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ public void should_not_mark_as_imported_if_no_episodes_were_parsed()
|
||||
new LocalMovie {Path = @"C:\TestPath\Droned.1998.mkv"},new Rejection("Rejected!")), "Test Failure")
|
||||
});
|
||||
|
||||
_trackedDownload.RemoteMovie.Movie = null;
|
||||
_trackedDownload.RemoteMovie.Movie = null;
|
||||
|
||||
Subject.Process(_trackedDownload);
|
||||
|
||||
@ -318,7 +318,7 @@ public void should_not_import_when_there_is_a_title_mismatch()
|
||||
|
||||
[Test]
|
||||
public void should_mark_as_import_title_mismatch_if_ignore_warnings_is_true()
|
||||
{
|
||||
{
|
||||
|
||||
Mocker.GetMock<IDownloadedMovieImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Movie>(), It.IsAny<DownloadClientItem>()))
|
||||
|
@ -34,19 +34,19 @@ private Movie GetMovie(int id)
|
||||
{
|
||||
return Builder<Movie>.CreateNew()
|
||||
.With(e => e.Id = id)
|
||||
.With(m => m.Tags = new HashSet<int>())
|
||||
.With(m => m.Tags = new HashSet<int>())
|
||||
|
||||
.Build();
|
||||
}
|
||||
|
||||
private RemoteMovie GetRemoteMovie(QualityModel quality, Movie movie = null, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
{
|
||||
if (movie == null)
|
||||
{
|
||||
movie = GetMovie(1);
|
||||
}
|
||||
private RemoteMovie GetRemoteMovie(QualityModel quality, Movie movie = null, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
{
|
||||
if (movie == null)
|
||||
{
|
||||
movie = GetMovie(1);
|
||||
}
|
||||
|
||||
movie.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities(), PreferredTags = new List<string>() };
|
||||
movie.Profile = new Profile { Items = Qualities.QualityFixture.GetDefaultQualities(), PreferredTags = new List<string>() };
|
||||
|
||||
var remoteMovie = new RemoteMovie()
|
||||
{
|
||||
@ -67,8 +67,8 @@ private RemoteMovie GetRemoteMovie(QualityModel quality, Movie movie = null, Dow
|
||||
}
|
||||
};
|
||||
|
||||
return remoteMovie;
|
||||
}
|
||||
return remoteMovie;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_download_report_if_movie_was_not_already_downloaded()
|
||||
@ -129,14 +129,14 @@ public void should_return_downloaded_reports()
|
||||
public void should_return_all_downloaded_reports()
|
||||
{
|
||||
var remoteMovie1 = GetRemoteMovie(
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(1)
|
||||
);
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(1)
|
||||
);
|
||||
|
||||
var remoteMovie2 = GetRemoteMovie(
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(2)
|
||||
);
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(2)
|
||||
);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteMovie1));
|
||||
@ -149,18 +149,18 @@ public void should_return_all_downloaded_reports()
|
||||
public void should_only_return_downloaded_reports()
|
||||
{
|
||||
var remoteMovie1 = GetRemoteMovie(
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(1)
|
||||
);
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(1)
|
||||
);
|
||||
|
||||
var remoteMovie2 = GetRemoteMovie(
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(2)
|
||||
);
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(2)
|
||||
);
|
||||
|
||||
var remoteMovie3 = GetRemoteMovie(
|
||||
new QualityModel(Quality.HDTV720p),
|
||||
GetMovie(2)
|
||||
GetMovie(2)
|
||||
);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
|
@ -345,7 +345,7 @@ public void should_report_diskspace_unpack_error_as_warning()
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Series")]
|
||||
[Ignore("Series")]
|
||||
public void Download_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
|
||||
{
|
||||
Mocker.GetMock<ISabnzbdProxy>()
|
||||
|
@ -24,7 +24,7 @@ public class AddFixture : CoreTest<PendingReleaseService>
|
||||
private Movie _movie;
|
||||
private Profile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedMovieInfo _parsedMovieInfo;
|
||||
private ParsedMovieInfo _parsedMovieInfo;
|
||||
private RemoteMovie _remoteMovie;
|
||||
private List<PendingRelease> _heldReleases;
|
||||
|
||||
@ -54,7 +54,7 @@ public void Setup()
|
||||
_parsedMovieInfo.Quality = new QualityModel(Quality.HDTV720p);
|
||||
|
||||
_remoteMovie = new RemoteMovie();
|
||||
_remoteMovie.Movie = _movie;
|
||||
_remoteMovie.Movie = _movie;
|
||||
_remoteMovie.ParsedMovieInfo = _parsedMovieInfo;
|
||||
_remoteMovie.Release = _release;
|
||||
|
||||
|
@ -25,7 +25,7 @@ public class RemoveRejectedFixture : CoreTest<PendingReleaseService>
|
||||
private Movie _movie;
|
||||
private Profile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedMovieInfo _parsedMovieInfo;
|
||||
private ParsedMovieInfo _parsedMovieInfo;
|
||||
private RemoteMovie _remoteMovie;
|
||||
|
||||
[SetUp]
|
||||
@ -75,7 +75,7 @@ public void Setup()
|
||||
.Returns(new List<Movie> { _movie });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetMovie(It.IsAny<string>()))
|
||||
.Setup(s => s.GetMovie(It.IsAny<string>()))
|
||||
.Returns(_movie);
|
||||
|
||||
Mocker.GetMock<IPrioritizeDownloadDecision>()
|
||||
|
@ -30,7 +30,7 @@ private void GivenDownloadHistory()
|
||||
new History.History(){
|
||||
DownloadId = "35238",
|
||||
SourceTitle = "TV Series S01",
|
||||
MovieId = 3,
|
||||
MovieId = 3,
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -74,7 +74,7 @@ public void should_track_downloads_using_the_source_title_if_it_cannot_be_found_
|
||||
trackedDownload.Should().NotBeNull();
|
||||
trackedDownload.RemoteMovie.Should().NotBeNull();
|
||||
trackedDownload.RemoteMovie.Movie.Should().NotBeNull();
|
||||
trackedDownload.RemoteMovie.Movie.Id.Should().Be(3);
|
||||
trackedDownload.RemoteMovie.Movie.Id.Should().Be(3);
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ public void should_not_delete_unorphaned()
|
||||
Db.Insert(history);
|
||||
|
||||
Subject.Clean();
|
||||
AllStoredModels.Should().HaveCount(1);
|
||||
AllStoredModels.Should().HaveCount(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public void should_set_last_execution_time_to_now_when_its_in_the_future()
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
AllStoredModels.ToList().ForEach(t => t.LastExecution.Should().NotBeAfter(DateTime.UtcNow));
|
||||
AllStoredModels.ToList().ForEach(t => t.LastExecution.Should().NotBeAfter(DateTime.UtcNow));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -27,7 +27,7 @@ public void SetUp()
|
||||
|
||||
_movieSearchCriteria = new MovieSearchCriteria
|
||||
{
|
||||
Movie = new Movies.Movie { ImdbId = "tt0076759", Title = "Star Wars", Year = 1977 }
|
||||
Movie = new Movies.Movie { ImdbId = "tt0076759", Title = "Star Wars", Year = 1977 }
|
||||
};
|
||||
|
||||
_capabilities = new NewznabCapabilities();
|
||||
@ -107,7 +107,7 @@ public void should_not_search_by_imdbid_if_not_supported()
|
||||
[Test]
|
||||
public void should_search_by_imdbid_if_supported()
|
||||
{
|
||||
_capabilities.SupportedMovieSearchParameters = new[] { "q", "imdbid" };
|
||||
_capabilities.SupportedMovieSearchParameters = new[] { "q", "imdbid" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
@ -20,7 +20,7 @@
|
||||
namespace NzbDrone.Core.Test.MediaFiles.MovieImport
|
||||
{
|
||||
[TestFixture]
|
||||
//TODO: Add tests to ensure helpers for augmenters are correctly passed.
|
||||
//TODO: Add tests to ensure helpers for augmenters are correctly passed.
|
||||
public class ImportDecisionMakerFixture : CoreTest<ImportDecisionMaker>
|
||||
{
|
||||
private List<string> _videoFiles;
|
||||
|
@ -8,32 +8,32 @@
|
||||
|
||||
namespace NzbDrone.Core.Test.MovieTests.MovieServiceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AddMovieFixture : CoreTest<MovieService>
|
||||
{
|
||||
private Movie fakeMovie;
|
||||
[TestFixture]
|
||||
public class AddMovieFixture : CoreTest<MovieService>
|
||||
{
|
||||
private Movie fakeMovie;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
fakeMovie = Builder<Movie>.CreateNew().Build();
|
||||
}
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
fakeMovie = Builder<Movie>.CreateNew().Build();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void movie_added_event_should_have_proper_path()
|
||||
{
|
||||
fakeMovie.Path = null;
|
||||
fakeMovie.RootFolderPath = @"C:\Test\Movies";
|
||||
[Test]
|
||||
public void movie_added_event_should_have_proper_path()
|
||||
{
|
||||
fakeMovie.Path = null;
|
||||
fakeMovie.RootFolderPath = @"C:\Test\Movies";
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(fakeMovie, null))
|
||||
.Returns(fakeMovie.Title);
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetMovieFolder(fakeMovie, null))
|
||||
.Returns(fakeMovie.Title);
|
||||
|
||||
var series = Subject.AddMovie(fakeMovie);
|
||||
var series = Subject.AddMovie(fakeMovie);
|
||||
|
||||
series.Path.Should().NotBeNull();
|
||||
series.Path.Should().NotBeNull();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,17 +32,17 @@ public void should_remove_accents_from_title()
|
||||
}
|
||||
|
||||
//Note: This assumes extended language parser is activated
|
||||
[TestCase("The.Man.from.U.N.C.L.E.2015.1080p.BluRay.x264-SPARKS", "The Man from U.N.C.L.E.")]
|
||||
[TestCase("1941.1979.EXTENDED.720p.BluRay.X264-AMIABLE", "1941")]
|
||||
[TestCase("MY MOVIE (2016) [R][Action, Horror][720p.WEB-DL.AVC.8Bit.6ch.AC3].mkv", "MY MOVIE")]
|
||||
[TestCase("R.I.P.D.2013.720p.BluRay.x264-SPARKS", "R.I.P.D.")]
|
||||
[TestCase("V.H.S.2.2013.LIMITED.720p.BluRay.x264-GECKOS", "V.H.S. 2")]
|
||||
[TestCase("This Is A Movie (1999) [IMDB #] <Genre, Genre, Genre> {ACTORS} !DIRECTOR +MORE_SILLY_STUFF_NO_ONE_NEEDS ?", "This Is A Movie")]
|
||||
[TestCase("We Are the Best!.2013.720p.H264.mkv", "We Are the Best!")]
|
||||
[TestCase("(500).Days.Of.Summer.(2009).DTS.1080p.BluRay.x264.NLsubs", "(500) Days Of Summer")]
|
||||
[TestCase("To.Live.and.Die.in.L.A.1985.1080p.BluRay", "To Live and Die in L.A.")]
|
||||
[TestCase("A.I.Artificial.Intelligence.(2001)", "A.I. Artificial Intelligence")]
|
||||
[TestCase("A.Movie.Name.(1998)", "A Movie Name")]
|
||||
[TestCase("The.Man.from.U.N.C.L.E.2015.1080p.BluRay.x264-SPARKS", "The Man from U.N.C.L.E.")]
|
||||
[TestCase("1941.1979.EXTENDED.720p.BluRay.X264-AMIABLE", "1941")]
|
||||
[TestCase("MY MOVIE (2016) [R][Action, Horror][720p.WEB-DL.AVC.8Bit.6ch.AC3].mkv", "MY MOVIE")]
|
||||
[TestCase("R.I.P.D.2013.720p.BluRay.x264-SPARKS", "R.I.P.D.")]
|
||||
[TestCase("V.H.S.2.2013.LIMITED.720p.BluRay.x264-GECKOS", "V.H.S. 2")]
|
||||
[TestCase("This Is A Movie (1999) [IMDB #] <Genre, Genre, Genre> {ACTORS} !DIRECTOR +MORE_SILLY_STUFF_NO_ONE_NEEDS ?", "This Is A Movie")]
|
||||
[TestCase("We Are the Best!.2013.720p.H264.mkv", "We Are the Best!")]
|
||||
[TestCase("(500).Days.Of.Summer.(2009).DTS.1080p.BluRay.x264.NLsubs", "(500) Days Of Summer")]
|
||||
[TestCase("To.Live.and.Die.in.L.A.1985.1080p.BluRay", "To Live and Die in L.A.")]
|
||||
[TestCase("A.I.Artificial.Intelligence.(2001)", "A.I. Artificial Intelligence")]
|
||||
[TestCase("A.Movie.Name.(1998)", "A Movie Name")]
|
||||
[TestCase("www.Torrenting.com - Revenge.2008.720p.X264-DIMENSION", "Revenge")]
|
||||
[TestCase("Thor: The Dark World 2013", "Thor The Dark World")]
|
||||
[TestCase("Resident.Evil.The.Final.Chapter.2016", "Resident Evil The Final Chapter")]
|
||||
@ -51,14 +51,14 @@ public void should_remove_accents_from_title()
|
||||
[TestCase("Valana la Legende FRENCH BluRay 720p 2016 kjhlj", "Valana la Legende")]
|
||||
[TestCase("Valana la Legende TRUEFRENCH BluRay 720p 2016 kjhlj", "Valana la Legende")]
|
||||
[TestCase("Mission Impossible: Rogue Nation (2015)<29>[XviD - Ita Ac3 - SoftSub Ita]azione, spionaggio, thriller *Prima Visione* Team mulnic Tom Cruise", "Mission Impossible Rogue Nation")]
|
||||
[TestCase("Scary.Movie.2000.FRENCH..BluRay.-AiRLiNE", "Scary Movie")]
|
||||
[TestCase("My Movie 1999 German Bluray", "My Movie")]
|
||||
[TestCase("Scary.Movie.2000.FRENCH..BluRay.-AiRLiNE", "Scary Movie")]
|
||||
[TestCase("My Movie 1999 German Bluray", "My Movie")]
|
||||
[TestCase("Leaving Jeruselem by Railway (1897) [DVD].mp4", "Leaving Jeruselem by Railway")]
|
||||
[TestCase("Climax.2018.1080p.AMZN.WEB-DL.DD5.1.H.264-NTG", "Climax")]
|
||||
[TestCase("Movie.Title.Imax.2018.1080p.AMZN.WEB-DL.DD5.1.H.264-NTG", "Movie Title")]
|
||||
public void should_parse_movie_title(string postTitle, string title)
|
||||
{
|
||||
Parser.Parser.ParseMovieTitle(postTitle, true).MovieTitle.Should().Be(title);
|
||||
{
|
||||
Parser.Parser.ParseMovieTitle(postTitle, true).MovieTitle.Should().Be(title);
|
||||
}
|
||||
|
||||
[TestCase("(1995) Ghost in the Shell", "Ghost in the Shell")]
|
||||
@ -72,9 +72,9 @@ public void should_parse_movie_folder_name(string postTitle, string title)
|
||||
[TestCase("Der.Soldat.James.German.Bluray.FuckYou.Pso.Why.cant.you.follow.scene.rules.1998", 1998)]
|
||||
[TestCase("Leaving Jeruselem by Railway (1897) [DVD].mp4", 1897)]
|
||||
public void should_parse_movie_year(string postTitle, int year)
|
||||
{
|
||||
Parser.Parser.ParseMovieTitle(postTitle, false).Year.Should().Be(year);
|
||||
}
|
||||
{
|
||||
Parser.Parser.ParseMovieTitle(postTitle, false).Year.Should().Be(year);
|
||||
}
|
||||
|
||||
[TestCase("Prometheus 2012 Directors Cut", "Directors Cut")]
|
||||
[TestCase("Star Wars Episode IV - A New Hope 1999 (Despecialized).mkv", "Despecialized")]
|
||||
|
@ -18,39 +18,39 @@ namespace NzbDrone.Core.Test.ParserTests.ParsingServiceTests
|
||||
[TestFixture]
|
||||
public class MapFixture : TestBase<ParsingService>
|
||||
{
|
||||
private Movie _movie;
|
||||
private ParsedMovieInfo _parsedMovieInfo;
|
||||
private ParsedMovieInfo _wrongYearInfo;
|
||||
private Movie _movie;
|
||||
private ParsedMovieInfo _parsedMovieInfo;
|
||||
private ParsedMovieInfo _wrongYearInfo;
|
||||
private ParsedMovieInfo _wrongTitleInfo;
|
||||
private ParsedMovieInfo _romanTitleInfo;
|
||||
private ParsedMovieInfo _alternativeTitleInfo;
|
||||
private ParsedMovieInfo _romanTitleInfo;
|
||||
private ParsedMovieInfo _alternativeTitleInfo;
|
||||
private ParsedMovieInfo _umlautInfo;
|
||||
private ParsedMovieInfo _umlautAltInfo;
|
||||
private MovieSearchCriteria _movieSearchCriteria;
|
||||
private MovieSearchCriteria _movieSearchCriteria;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
|
||||
_movie = Builder<Movie>.CreateNew()
|
||||
.With(m => m.Title = "Fack Ju Göthe 2")
|
||||
.With(m => m.CleanTitle = "fackjugoethe2")
|
||||
.With(m => m.Year = 2015)
|
||||
.With(m => m.AlternativeTitles = new LazyList<AlternativeTitle>( new List<AlternativeTitle> {new AlternativeTitle("Fack Ju Göthe 2: Same same")}))
|
||||
.Build();
|
||||
_movie = Builder<Movie>.CreateNew()
|
||||
.With(m => m.Title = "Fack Ju Göthe 2")
|
||||
.With(m => m.CleanTitle = "fackjugoethe2")
|
||||
.With(m => m.Year = 2015)
|
||||
.With(m => m.AlternativeTitles = new LazyList<AlternativeTitle>( new List<AlternativeTitle> {new AlternativeTitle("Fack Ju Göthe 2: Same same")}))
|
||||
.Build();
|
||||
|
||||
_parsedMovieInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.Title,
|
||||
Year = _movie.Year,
|
||||
_parsedMovieInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.Title,
|
||||
Year = _movie.Year,
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
_wrongYearInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.Title,
|
||||
Year = 1900,
|
||||
};
|
||||
_wrongYearInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.Title,
|
||||
Year = 1900,
|
||||
};
|
||||
|
||||
_wrongTitleInfo = new ParsedMovieInfo
|
||||
{
|
||||
@ -58,17 +58,17 @@ public void Setup()
|
||||
Year = 2015
|
||||
};
|
||||
|
||||
_alternativeTitleInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.AlternativeTitles.First().Title,
|
||||
Year = _movie.Year,
|
||||
};
|
||||
_alternativeTitleInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = _movie.AlternativeTitles.First().Title,
|
||||
Year = _movie.Year,
|
||||
};
|
||||
|
||||
_romanTitleInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = "Fack Ju Göthe II",
|
||||
Year = _movie.Year,
|
||||
};
|
||||
_romanTitleInfo = new ParsedMovieInfo
|
||||
{
|
||||
MovieTitle = "Fack Ju Göthe II",
|
||||
Year = _movie.Year,
|
||||
};
|
||||
|
||||
_umlautInfo = new ParsedMovieInfo
|
||||
{
|
||||
@ -82,10 +82,10 @@ public void Setup()
|
||||
Year = _movie.Year
|
||||
};
|
||||
|
||||
_movieSearchCriteria = new MovieSearchCriteria
|
||||
{
|
||||
Movie = _movie
|
||||
};
|
||||
_movieSearchCriteria = new MovieSearchCriteria
|
||||
{
|
||||
Movie = _movie
|
||||
};
|
||||
}
|
||||
|
||||
private void GivenMatchByMovieTitle()
|
||||
@ -119,9 +119,9 @@ public void should_use_search_criteria_movie_title()
|
||||
|
||||
[Test]
|
||||
public void should_not_match_with_wrong_year()
|
||||
{
|
||||
GivenMatchByMovieTitle();
|
||||
Subject.Map(_wrongYearInfo, "", _movieSearchCriteria).MappingResultType.Should().Be(MappingResultType.WrongYear);
|
||||
{
|
||||
GivenMatchByMovieTitle();
|
||||
Subject.Map(_wrongYearInfo, "", _movieSearchCriteria).MappingResultType.Should().Be(MappingResultType.WrongYear);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -141,17 +141,17 @@ public void should_return_title_not_found_when_all_is_null()
|
||||
.Be(MappingResultType.TitleNotFound);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_match_alternative_title()
|
||||
{
|
||||
Subject.Map(_alternativeTitleInfo, "", _movieSearchCriteria).Movie.Should().Be(_movieSearchCriteria.Movie);
|
||||
}
|
||||
[Test]
|
||||
public void should_match_alternative_title()
|
||||
{
|
||||
Subject.Map(_alternativeTitleInfo, "", _movieSearchCriteria).Movie.Should().Be(_movieSearchCriteria.Movie);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_match_roman_title()
|
||||
{
|
||||
Subject.Map(_romanTitleInfo, "", _movieSearchCriteria).Movie.Should().Be(_movieSearchCriteria.Movie);
|
||||
}
|
||||
[Test]
|
||||
public void should_match_roman_title()
|
||||
{
|
||||
Subject.Map(_romanTitleInfo, "", _movieSearchCriteria).Movie.Should().Be(_movieSearchCriteria.Movie);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_match_umlauts()
|
||||
|
@ -7,7 +7,7 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||
{
|
||||
/*
|
||||
[TestFixture]
|
||||
[Ignore("Series")]//Is this really necessary with movies? I dont think so
|
||||
[Ignore("Series")]//Is this really necessary with movies? I dont think so
|
||||
public class PathParserFixture : CoreTest
|
||||
{
|
||||
[TestCase(@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)]
|
||||
|
@ -235,12 +235,12 @@ public void should_parse_bluray1080p_quality(string title, bool proper)
|
||||
ParseAndVerifyQuality(title, Source.BLURAY, proper, Resolution.R1080p);
|
||||
}
|
||||
|
||||
[TestCase("Movie.Name.2004.576p.BDRip.x264-HANDJOB")]
|
||||
[TestCase("Hannibal.S01E05.576p.BluRay.DD5.1.x264-HiSD")]
|
||||
public void should_parse_bluray576p_quality(string title)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R576p);
|
||||
}
|
||||
[TestCase("Movie.Name.2004.576p.BDRip.x264-HANDJOB")]
|
||||
[TestCase("Hannibal.S01E05.576p.BluRay.DD5.1.x264-HiSD")]
|
||||
public void should_parse_bluray576p_quality(string title)
|
||||
{
|
||||
ParseAndVerifyQuality(title, Source.BLURAY, false, Resolution.R576p);
|
||||
}
|
||||
|
||||
[TestCase("Contract.to.Kill.2016.REMUX.1080p.BluRay.AVC.DTS-HD.MA.5.1-iFT")]
|
||||
[TestCase("27.Dresses.2008.REMUX.1080p.Bluray.AVC.DTS-HR.MA.5.1-LEGi0N")]
|
||||
|
@ -110,12 +110,12 @@ public void should_get_root_folder_with_subfolders_excluding_special_sub_folders
|
||||
var rootFolder = Builder<RootFolder>.CreateNew()
|
||||
.With(r => r.Path = @"C:\Test\TV")
|
||||
.Build();
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
rootFolder = Builder<RootFolder>.CreateNew()
|
||||
.With(r => r.Path = @"/Test/TV")
|
||||
.Build();
|
||||
}
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
rootFolder = Builder<RootFolder>.CreateNew()
|
||||
.With(r => r.Path = @"/Test/TV")
|
||||
.Build();
|
||||
}
|
||||
|
||||
|
||||
var subFolders = new[]
|
||||
@ -128,10 +128,10 @@ public void should_get_root_folder_with_subfolders_excluding_special_sub_folders
|
||||
|
||||
var folders = subFolders.Select(f => Path.Combine(@"C:\Test\TV", f)).ToArray();
|
||||
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
folders = subFolders.Select(f => Path.Combine(@"/Test/TV", f)).ToArray();
|
||||
}
|
||||
if (OsInfo.IsNotWindows)
|
||||
{
|
||||
folders = subFolders.Select(f => Path.Combine(@"/Test/TV", f)).ToArray();
|
||||
}
|
||||
|
||||
Mocker.GetMock<IRootFolderRepository>()
|
||||
.Setup(s => s.Get(It.IsAny<int>()))
|
||||
|
@ -31,7 +31,7 @@ public class UpdateServiceFixture : CoreTest<InstallUpdateService>
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
if (OsInfo.IsLinux || OsInfo.IsOsx)
|
||||
if (OsInfo.IsLinux || OsInfo.IsOsx)
|
||||
{
|
||||
_updatePackage = new UpdatePackage
|
||||
{
|
||||
|
@ -57,15 +57,15 @@ public interface IConfigService
|
||||
|
||||
bool PreferIndexerFlags { get; set; }
|
||||
|
||||
int AvailabilityDelay { get; set; }
|
||||
int AvailabilityDelay { get; set; }
|
||||
|
||||
bool AllowHardcodedSubs { get; set; }
|
||||
string WhitelistedHardcodedSubs { get; set; }
|
||||
bool AllowHardcodedSubs { get; set; }
|
||||
string WhitelistedHardcodedSubs { get; set; }
|
||||
ParsingLeniencyType ParsingLeniency { get; set; }
|
||||
|
||||
int NetImportSyncInterval { get; set; }
|
||||
string ListSyncLevel { get; set; }
|
||||
string ImportExclusions { get; set; }
|
||||
string ListSyncLevel { get; set; }
|
||||
string ImportExclusions { get; set; }
|
||||
|
||||
//UI
|
||||
int FirstDayOfWeek { get; set; }
|
||||
|
@ -8,12 +8,12 @@
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(131)]
|
||||
public class make_parsed_episode_info_nullable : NzbDroneMigrationBase
|
||||
[Migration(131)]
|
||||
public class make_parsed_episode_info_nullable : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("PendingReleases").AlterColumn("ParsedEpisodeInfo").AsString().Nullable();
|
||||
Alter.Table("PendingReleases").AlterColumn("ParsedEpisodeInfo").AsString().Nullable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("NetImport").AddColumn("MinimumAvailability").AsInt32().WithDefaultValue(MovieStatusType.PreDB);
|
||||
}
|
||||
if (!this.Schema.Schema("dbo").Table("Movies").Column("MinimumAvailability").Exists())
|
||||
{
|
||||
Alter.Table("Movies").AddColumn("MinimumAvailability").AsInt32().WithDefaultValue(MovieStatusType.PreDB);
|
||||
}
|
||||
if (!this.Schema.Schema("dbo").Table("Movies").Column("MinimumAvailability").Exists())
|
||||
{
|
||||
Alter.Table("Movies").AddColumn("MinimumAvailability").AsInt32().WithDefaultValue(MovieStatusType.PreDB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ public class add_haspredbentry_to_movies : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Movies").AddColumn("HasPreDBEntry").AsBoolean().WithDefaultValue(false);
|
||||
Alter.Table("Movies").AddColumn("HasPreDBEntry").AsBoolean().WithDefaultValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public class add_pathstate_to_movies : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Movies").AddColumn("PathState").AsInt32().WithDefaultValue(2);
|
||||
Alter.Table("Movies").AddColumn("PathState").AsInt32().WithDefaultValue(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ public class add_physical_release_note : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Movies").AddColumn("PhysicalReleaseNote").AsString().Nullable();
|
||||
Alter.Table("Movies").AddColumn("PhysicalReleaseNote").AsString().Nullable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class DownloadDecisionMaker : IMakeDownloadDecision
|
||||
{
|
||||
private readonly IEnumerable<IDecisionEngineSpecification> _specifications;
|
||||
private readonly IParsingService _parsingService;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IQualityDefinitionService _definitionService;
|
||||
private readonly Logger _logger;
|
||||
|
||||
@ -35,7 +35,7 @@ public DownloadDecisionMaker(IEnumerable<IDecisionEngineSpecification> specifica
|
||||
{
|
||||
_specifications = specifications;
|
||||
_parsingService = parsingService;
|
||||
_configService = configService;
|
||||
_configService = configService;
|
||||
_definitionService = qualityDefinitionService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ public Decision IsSatisfiedBy(RemoteMovie subject, SearchCriteriaBase searchCrit
|
||||
var qualityDefinition = _qualityDefinitionService.Get(quality);
|
||||
|
||||
if (subject.Movie.Runtime == 0)
|
||||
{
|
||||
_logger.Warn("{0} has no runtime information using median movie runtime of 110 minutes.", subject.Movie);
|
||||
subject.Movie.Runtime = 110;
|
||||
}
|
||||
{
|
||||
_logger.Warn("{0} has no runtime information using median movie runtime of 110 minutes.", subject.Movie);
|
||||
subject.Movie.Runtime = 110;
|
||||
}
|
||||
|
||||
if (qualityDefinition.MinSize.HasValue)
|
||||
{
|
||||
|
@ -124,9 +124,9 @@ private void Import(TrackedDownload trackedDownload)
|
||||
.Select(v =>
|
||||
{
|
||||
if (v.ImportDecision.LocalMovie == null)
|
||||
{
|
||||
{
|
||||
return new TrackedDownloadStatusMessage("", v.Errors);
|
||||
}
|
||||
}
|
||||
return new TrackedDownloadStatusMessage(Path.GetFileName(v.ImportDecision.LocalMovie.Path), v.Errors);
|
||||
})
|
||||
.ToArray();
|
||||
|
@ -291,22 +291,22 @@ private List<PendingRelease> IncludeRemoteMovies(List<PendingRelease> releases,
|
||||
|
||||
private void Insert(DownloadDecision decision, PendingReleaseReason reason)
|
||||
{
|
||||
var release = new PendingRelease
|
||||
var release = new PendingRelease
|
||||
{
|
||||
MovieId = decision.RemoteMovie.Movie.Id,
|
||||
ParsedMovieInfo = decision.RemoteMovie.ParsedMovieInfo,
|
||||
Release = decision.RemoteMovie.Release,
|
||||
Title = decision.RemoteMovie.Release.Title,
|
||||
Added = DateTime.UtcNow,
|
||||
MovieId = decision.RemoteMovie.Movie.Id,
|
||||
ParsedMovieInfo = decision.RemoteMovie.ParsedMovieInfo,
|
||||
Release = decision.RemoteMovie.Release,
|
||||
Title = decision.RemoteMovie.Release.Title,
|
||||
Added = DateTime.UtcNow,
|
||||
Reason = reason
|
||||
};
|
||||
|
||||
if (release.ParsedMovieInfo == null)
|
||||
{
|
||||
_logger.Warn("Pending release {0} does not have ParsedMovieInfo, will cause issues.", release.Title);
|
||||
}
|
||||
{
|
||||
_logger.Warn("Pending release {0} does not have ParsedMovieInfo, will cause issues.", release.Title);
|
||||
}
|
||||
|
||||
_repository.Insert(release);
|
||||
_repository.Insert(release);
|
||||
|
||||
_eventAggregator.PublishEvent(new PendingReleasesUpdatedEvent());
|
||||
}
|
||||
@ -338,7 +338,7 @@ private void RemoveGrabbed(RemoteMovie remoteMovie)
|
||||
var pendingReleases = GetPendingReleases(remoteMovie.Movie.Id);
|
||||
|
||||
|
||||
var existingReports = pendingReleases.Where(r => r.RemoteMovie.Movie.Id == remoteMovie.Movie.Id)
|
||||
var existingReports = pendingReleases.Where(r => r.RemoteMovie.Movie.Id == remoteMovie.Movie.Id)
|
||||
.ToList();
|
||||
|
||||
if (existingReports.Empty())
|
||||
|
@ -2,17 +2,17 @@
|
||||
|
||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||
{
|
||||
public class CleanupAdditionalUsers : IHousekeepingTask
|
||||
{
|
||||
private readonly IMainDatabase _database;
|
||||
public class CleanupAdditionalUsers : IHousekeepingTask
|
||||
{
|
||||
private readonly IMainDatabase _database;
|
||||
|
||||
public CleanupAdditionalUsers(IMainDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
public CleanupAdditionalUsers(IMainDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
public void Clean()
|
||||
{
|
||||
using (var mapper = _database.GetDataMapper())
|
||||
{
|
||||
|
||||
@ -22,6 +22,6 @@ SELECT ID FROM Users
|
||||
LIMIT 1)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,24 +2,24 @@
|
||||
|
||||
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
||||
{
|
||||
public class FixWronglyMatchedMovieFiles : IHousekeepingTask
|
||||
{
|
||||
private readonly IMainDatabase _database;
|
||||
public class FixWronglyMatchedMovieFiles : IHousekeepingTask
|
||||
{
|
||||
private readonly IMainDatabase _database;
|
||||
|
||||
public FixWronglyMatchedMovieFiles(IMainDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
public FixWronglyMatchedMovieFiles(IMainDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public void Clean()
|
||||
{
|
||||
/*var mapper = _database.GetDataMapper();
|
||||
public void Clean()
|
||||
{
|
||||
/*var mapper = _database.GetDataMapper();
|
||||
|
||||
mapper.ExecuteNonQuery(@"UPDATE Movies
|
||||
SET MovieFileId =
|
||||
(Select Id FROM MovieFiles WHERE Movies.Id == MovieFiles.MovieId)
|
||||
WHERE MovieFileId !=
|
||||
(SELECT Id FROM MovieFiles WHERE Movies.Id == MovieFiles.MovieId)");*/
|
||||
}
|
||||
}
|
||||
mapper.ExecuteNonQuery(@"UPDATE Movies
|
||||
SET MovieFileId =
|
||||
(Select Id FROM MovieFiles WHERE Movies.Id == MovieFiles.MovieId)
|
||||
WHERE MovieFileId !=
|
||||
(SELECT Id FROM MovieFiles WHERE Movies.Id == MovieFiles.MovieId)");*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,11 +62,11 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
{
|
||||
var id = torrent.Id;
|
||||
var title = torrent.ReleaseName;
|
||||
IndexerFlags flags = 0;
|
||||
IndexerFlags flags = 0;
|
||||
|
||||
if (torrent.GoldenPopcorn)
|
||||
{
|
||||
flags |= IndexerFlags.PTP_Golden;//title = $"{title} 🍿";
|
||||
flags |= IndexerFlags.PTP_Golden;//title = $"{title} 🍿";
|
||||
}
|
||||
|
||||
if (torrent.Checked)
|
||||
|
@ -167,11 +167,11 @@ protected override string GetMagnetUrl(XElement item)
|
||||
return base.GetPeers(item);
|
||||
}
|
||||
|
||||
protected IndexerFlags GetFlags(XElement item)
|
||||
{
|
||||
IndexerFlags flags = 0;
|
||||
protected IndexerFlags GetFlags(XElement item)
|
||||
{
|
||||
IndexerFlags flags = 0;
|
||||
|
||||
var downloadFactor = TryGetFloatTorznabAttribute(item, "downloadvolumefactor", 1);
|
||||
var downloadFactor = TryGetFloatTorznabAttribute(item, "downloadvolumefactor", 1);
|
||||
|
||||
var uploadFactor = TryGetFloatTorznabAttribute(item, "uploadvolumefactor", 1);
|
||||
|
||||
@ -191,7 +191,7 @@ protected IndexerFlags GetFlags(XElement item)
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
|
||||
protected string TryGetTorznabAttribute(XElement item, string key, string defaultValue = "")
|
||||
{
|
||||
@ -205,7 +205,7 @@ protected string TryGetTorznabAttribute(XElement item, string key, string defaul
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
protected float TryGetFloatTorznabAttribute(XElement item, string key, float defaultValue = 0)
|
||||
protected float TryGetFloatTorznabAttribute(XElement item, string key, float defaultValue = 0)
|
||||
{
|
||||
var attr = TryGetTorznabAttribute(item, key, defaultValue.ToString());
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class RenameMovieFolderCommand : Command
|
||||
|
||||
public RenameMovieFolderCommand(List<int> ids)
|
||||
{
|
||||
MovieIds = ids;
|
||||
MovieIds = ids;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class DiskScanService :
|
||||
private readonly IRootFolderService _rootFolderService;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IMediaFileService _movieFileRepository;
|
||||
private readonly IRenameMovieFileService _renameMovieFiles;
|
||||
private readonly IRenameMovieFileService _renameMovieFiles;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DiskScanService(IDiskProvider diskProvider,
|
||||
@ -53,7 +53,7 @@ public DiskScanService(IDiskProvider diskProvider,
|
||||
IRootFolderService rootFolderService,
|
||||
IEventAggregator eventAggregator,
|
||||
IMediaFileService movieFileRepository,
|
||||
IRenameMovieFileService renameMovieFiles,
|
||||
IRenameMovieFileService renameMovieFiles,
|
||||
Logger logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
@ -65,7 +65,7 @@ public DiskScanService(IDiskProvider diskProvider,
|
||||
_rootFolderService = rootFolderService;
|
||||
_eventAggregator = eventAggregator;
|
||||
_movieFileRepository = movieFileRepository;
|
||||
_renameMovieFiles = renameMovieFiles;
|
||||
_renameMovieFiles = renameMovieFiles;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ private void EnsureMovieFolder(MovieFile movieFile, LocalMovie localMovie, strin
|
||||
private void EnsureMovieFolder(MovieFile movieFile, Movie movie, string filePath)
|
||||
{
|
||||
var movieFolder = Path.GetDirectoryName(filePath);
|
||||
//movie.Path = movieFolder;
|
||||
//movie.Path = movieFolder;
|
||||
var rootFolder = new OsPath(movieFolder).Directory.FullPath;
|
||||
var fileName = Path.GetFileName(filePath);
|
||||
|
||||
|
@ -21,13 +21,13 @@ namespace NzbDrone.Core.MediaFiles
|
||||
public interface IRenameMovieFileService
|
||||
{
|
||||
List<RenameMovieFilePreview> GetRenamePreviews(int movieId);
|
||||
void RenameMoviePath(Movie movie, bool shouldRenameFiles);
|
||||
void RenameMoviePath(Movie movie, bool shouldRenameFiles);
|
||||
}
|
||||
|
||||
public class RenameMovieFileService : IRenameMovieFileService,
|
||||
IExecute<RenameFilesCommand>,
|
||||
IExecute<RenameMovieCommand>,
|
||||
IExecute<RenameMovieFolderCommand>
|
||||
IExecute<RenameMovieFolderCommand>
|
||||
{
|
||||
private readonly IMovieService _movieService;
|
||||
private readonly IMediaFileService _mediaFileService;
|
||||
@ -138,33 +138,33 @@ private void RenameFiles(List<MovieFile> movieFiles, Movie movie, string oldMovi
|
||||
}
|
||||
}
|
||||
|
||||
public void RenameMoviePath(Movie movie, bool shouldRenameFiles = true)
|
||||
{
|
||||
var newFolder = _filenameBuilder.BuildMoviePath(movie);
|
||||
if (newFolder != movie.Path && movie.PathState == MoviePathState.Dynamic)
|
||||
{
|
||||
public void RenameMoviePath(Movie movie, bool shouldRenameFiles = true)
|
||||
{
|
||||
var newFolder = _filenameBuilder.BuildMoviePath(movie);
|
||||
if (newFolder != movie.Path && movie.PathState == MoviePathState.Dynamic)
|
||||
{
|
||||
|
||||
if (!_configService.AutoRenameFolders)
|
||||
{
|
||||
_logger.Info("{0}'s movie should be {1} according to your naming config.", movie, newFolder);
|
||||
return;
|
||||
}
|
||||
if (!_configService.AutoRenameFolders)
|
||||
{
|
||||
_logger.Info("{0}'s movie should be {1} according to your naming config.", movie, newFolder);
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.Info("{0}'s movie folder changed to: {1}", movie, newFolder);
|
||||
_logger.Info("{0}'s movie folder changed to: {1}", movie, newFolder);
|
||||
var oldFolder = movie.Path;
|
||||
movie.Path = newFolder;
|
||||
|
||||
_diskProvider.MoveFolder(oldFolder, movie.Path);
|
||||
_diskProvider.MoveFolder(oldFolder, movie.Path);
|
||||
|
||||
// if (false)
|
||||
// {
|
||||
// var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
||||
// _logger.ProgressInfo("Renaming movie files for {0}", movie.Title);
|
||||
// RenameFiles(movieFiles, movie, oldFolder);
|
||||
// _logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
|
||||
// }
|
||||
// if (false)
|
||||
// {
|
||||
// var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
||||
// _logger.ProgressInfo("Renaming movie files for {0}", movie.Title);
|
||||
// RenameFiles(movieFiles, movie, oldFolder);
|
||||
// _logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
|
||||
// }
|
||||
|
||||
_movieService.UpdateMovie(movie);
|
||||
_movieService.UpdateMovie(movie);
|
||||
|
||||
if (_diskProvider.GetFiles(oldFolder, SearchOption.AllDirectories).Count() == 0)
|
||||
{
|
||||
@ -172,14 +172,14 @@ public void RenameMoviePath(Movie movie, bool shouldRenameFiles = true)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (movie.PathState == MoviePathState.StaticOnce)
|
||||
{
|
||||
movie.PathState = MoviePathState.Dynamic;
|
||||
_movieService.UpdateMovie(movie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(RenameFilesCommand message)
|
||||
{
|
||||
@ -206,24 +206,24 @@ public void Execute(RenameMovieCommand message)
|
||||
|
||||
}
|
||||
|
||||
public void Execute(RenameMovieFolderCommand message)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.Debug("Renaming movie folder for selected movie if necessary");
|
||||
var moviesToRename = _movieService.GetMovies(message.MovieIds);
|
||||
foreach(var movie in moviesToRename)
|
||||
{
|
||||
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
||||
//_logger.ProgressInfo("Renaming movie folder for {0}", movie.Title);
|
||||
RenameMoviePath(movie);
|
||||
}
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
public void Execute(RenameMovieFolderCommand message)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.Debug("Renaming movie folder for selected movie if necessary");
|
||||
var moviesToRename = _movieService.GetMovies(message.MovieIds);
|
||||
foreach(var movie in moviesToRename)
|
||||
{
|
||||
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
|
||||
//_logger.ProgressInfo("Renaming movie folder for {0}", movie.Title);
|
||||
RenameMoviePath(movie);
|
||||
}
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
_logger.Warn(ex, "wtf: {0}, {1}", ex.ResultCode, ex.Data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class UpgradeMediaFileService : IUpgradeMediaFiles
|
||||
private readonly IRecycleBinProvider _recycleBinProvider;
|
||||
private readonly IMediaFileService _mediaFileService;
|
||||
private readonly IMoveMovieFiles _movieFileMover;
|
||||
private readonly IRenameMovieFileService _movieFileRenamer;
|
||||
private readonly IRenameMovieFileService _movieFileRenamer;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
@ -24,14 +24,14 @@ public UpgradeMediaFileService(IRecycleBinProvider recycleBinProvider,
|
||||
IMediaFileService mediaFileService,
|
||||
IMoveMovieFiles movieFileMover,
|
||||
IDiskProvider diskProvider,
|
||||
IRenameMovieFileService movieFileRenamer,
|
||||
IRenameMovieFileService movieFileRenamer,
|
||||
Logger logger)
|
||||
{
|
||||
_recycleBinProvider = recycleBinProvider;
|
||||
_mediaFileService = mediaFileService;
|
||||
_movieFileMover = movieFileMover;
|
||||
_diskProvider = diskProvider;
|
||||
_movieFileRenamer = movieFileRenamer;
|
||||
_movieFileRenamer = movieFileRenamer;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@ -56,9 +56,9 @@ public MovieFileMoveResult UpgradeMovieFile(MovieFile movieFile, LocalMovie loca
|
||||
_mediaFileService.Delete(existingFile, DeleteMediaFileReason.Upgrade);
|
||||
}
|
||||
|
||||
//Temporary for correctly getting path
|
||||
localMovie.Movie.MovieFileId = 1;
|
||||
localMovie.Movie.MovieFile = movieFile;
|
||||
//Temporary for correctly getting path
|
||||
localMovie.Movie.MovieFileId = 1;
|
||||
localMovie.Movie.MovieFile = movieFile;
|
||||
|
||||
if (copyOnly)
|
||||
{
|
||||
@ -72,7 +72,7 @@ public MovieFileMoveResult UpgradeMovieFile(MovieFile movieFile, LocalMovie loca
|
||||
localMovie.Movie.MovieFileId = existingFile?.Id ?? 0;
|
||||
localMovie.Movie.MovieFile = existingFile;
|
||||
|
||||
//_movieFileRenamer.RenameMoviePath(localMovie.Movie, false);
|
||||
//_movieFileRenamer.RenameMoviePath(localMovie.Movie, false);
|
||||
|
||||
return moveFileResult;
|
||||
}
|
||||
|
@ -81,36 +81,36 @@ private List<PreDBResult> GetResults(string category = "", string search = "")
|
||||
|
||||
var response = _httpClient.Get(request);
|
||||
|
||||
if (response.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
_logger.Warn("Non 200 StatusCode {0} encountered while searching PreDB.", response.StatusCode);
|
||||
return new List<PreDBResult>();
|
||||
}
|
||||
if (response.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
_logger.Warn("Non 200 StatusCode {0} encountered while searching PreDB.", response.StatusCode);
|
||||
return new List<PreDBResult>();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var reader = XmlReader.Create(new StringReader(response.Content));
|
||||
try
|
||||
{
|
||||
var reader = XmlReader.Create(new StringReader(response.Content));
|
||||
|
||||
var items = SyndicationFeed.Load(reader);
|
||||
var items = SyndicationFeed.Load(reader);
|
||||
|
||||
var results = new List<PreDBResult>();
|
||||
var results = new List<PreDBResult>();
|
||||
|
||||
foreach (SyndicationItem item in items.Items)
|
||||
{
|
||||
var result = new PreDBResult();
|
||||
result.Title = item.Title.Text;
|
||||
result.Link = item.Links[0].Uri.ToString();
|
||||
results.Add(result);
|
||||
}
|
||||
foreach (SyndicationItem item in items.Items)
|
||||
{
|
||||
var result = new PreDBResult();
|
||||
result.Title = item.Title.Text;
|
||||
result.Link = item.Links[0].Uri.ToString();
|
||||
results.Add(result);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Error while searching PreDB.");
|
||||
}
|
||||
return results;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Error while searching PreDB.");
|
||||
}
|
||||
|
||||
return new List<PreDBResult>(); */
|
||||
return new List<PreDBResult>(); */
|
||||
}
|
||||
|
||||
private List<Movie> FindMatchesToResults(List<PreDBResult> results)
|
||||
@ -157,7 +157,7 @@ public void Execute(PreDBSyncCommand message)
|
||||
{
|
||||
if (!movie.HasPreDBEntry)
|
||||
{
|
||||
movie.HasPreDBEntry = true;
|
||||
movie.HasPreDBEntry = true;
|
||||
_movieService.UpdateMovie(movie);
|
||||
}
|
||||
|
||||
@ -172,32 +172,32 @@ public void Execute(PreDBSyncCommand message)
|
||||
|
||||
public bool HasReleases(Movie movie)
|
||||
{
|
||||
try
|
||||
{
|
||||
var results = GetResults("movies", movie.Title);
|
||||
try
|
||||
{
|
||||
var results = GetResults("movies", movie.Title);
|
||||
|
||||
foreach (PreDBResult result in results)
|
||||
{
|
||||
var parsed = Parser.Parser.ParseMovieTitle(result.Title, true);
|
||||
if (parsed == null)
|
||||
{
|
||||
parsed = new Parser.Model.ParsedMovieInfo { MovieTitle = result.Title, Year = 0 };
|
||||
}
|
||||
var match = _parsingService.Map(parsed, "", new MovieSearchCriteria { Movie = movie });
|
||||
foreach (PreDBResult result in results)
|
||||
{
|
||||
var parsed = Parser.Parser.ParseMovieTitle(result.Title, true);
|
||||
if (parsed == null)
|
||||
{
|
||||
parsed = new Parser.Model.ParsedMovieInfo { MovieTitle = result.Title, Year = 0 };
|
||||
}
|
||||
var match = _parsingService.Map(parsed, "", new MovieSearchCriteria { Movie = movie });
|
||||
|
||||
if (match != null && match.RemoteMovie.Movie != null && match.RemoteMovie.Movie.Id == movie.Id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (match != null && match.RemoteMovie.Movie != null && match.RemoteMovie.Movie.Id == movie.Id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Error while looking on predb.me.");
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Error while looking on predb.me.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -128,17 +128,17 @@ public Movie GetMovieInfo(int TmdbId, Profile profile = null, bool hasPreDBEntry
|
||||
return null;
|
||||
}
|
||||
|
||||
var movie = new Movie();
|
||||
var movie = new Movie();
|
||||
var altTitles = new List<AlternativeTitle>();
|
||||
|
||||
if (langCode != "en")
|
||||
{
|
||||
var iso = IsoLanguages.Find(resource.original_language);
|
||||
if (iso != null)
|
||||
{
|
||||
altTitles.Add(new AlternativeTitle(resource.original_title, SourceType.TMDB, TmdbId, iso.Language));
|
||||
}
|
||||
}
|
||||
if (langCode != "en")
|
||||
{
|
||||
var iso = IsoLanguages.Find(resource.original_language);
|
||||
if (iso != null)
|
||||
{
|
||||
altTitles.Add(new AlternativeTitle(resource.original_title, SourceType.TMDB, TmdbId, iso.Language));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var alternativeTitle in resource.alternative_titles.titles)
|
||||
{
|
||||
@ -244,7 +244,7 @@ public Movie GetMovieInfo(int TmdbId, Profile profile = null, bool hasPreDBEntry
|
||||
//otherwise the title has only been announced
|
||||
else
|
||||
{
|
||||
movie.Status = MovieStatusType.Announced;
|
||||
movie.Status = MovieStatusType.Announced;
|
||||
}
|
||||
|
||||
//since TMDB lacks alot of information lets assume that stuff is released if its been in cinemas for longer than 3 months.
|
||||
@ -253,17 +253,17 @@ public Movie GetMovieInfo(int TmdbId, Profile profile = null, bool hasPreDBEntry
|
||||
movie.Status = MovieStatusType.Released;
|
||||
}
|
||||
|
||||
if (!hasPreDBEntry)
|
||||
{
|
||||
if (_predbService.HasReleases(movie))
|
||||
{
|
||||
movie.HasPreDBEntry = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
movie.HasPreDBEntry = false;
|
||||
}
|
||||
}
|
||||
if (!hasPreDBEntry)
|
||||
{
|
||||
if (_predbService.HasReleases(movie))
|
||||
{
|
||||
movie.HasPreDBEntry = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
movie.HasPreDBEntry = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (resource.videos != null)
|
||||
{
|
||||
@ -533,37 +533,37 @@ public Movie MapMovie(MovieResult result)
|
||||
|
||||
|
||||
var now = DateTime.Now;
|
||||
//handle the case when we have both theatrical and physical release dates
|
||||
if (imdbMovie.InCinemas.HasValue && imdbMovie.PhysicalRelease.HasValue)
|
||||
{
|
||||
if (now < imdbMovie.InCinemas)
|
||||
imdbMovie.Status = MovieStatusType.Announced;
|
||||
else if (now >= imdbMovie.InCinemas)
|
||||
imdbMovie.Status = MovieStatusType.InCinemas;
|
||||
if (now >= imdbMovie.PhysicalRelease)
|
||||
imdbMovie.Status = MovieStatusType.Released;
|
||||
}
|
||||
//handle the case when we have theatrical release dates but we dont know the physical release date
|
||||
else if (imdbMovie.InCinemas.HasValue && (now >= imdbMovie.InCinemas))
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.InCinemas;
|
||||
}
|
||||
//handle the case where we only have a physical release date
|
||||
else if (imdbMovie.PhysicalRelease.HasValue && (now >= imdbMovie.PhysicalRelease))
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.Released;
|
||||
}
|
||||
//otherwise the title has only been announced
|
||||
else
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.Announced;
|
||||
}
|
||||
//handle the case when we have both theatrical and physical release dates
|
||||
if (imdbMovie.InCinemas.HasValue && imdbMovie.PhysicalRelease.HasValue)
|
||||
{
|
||||
if (now < imdbMovie.InCinemas)
|
||||
imdbMovie.Status = MovieStatusType.Announced;
|
||||
else if (now >= imdbMovie.InCinemas)
|
||||
imdbMovie.Status = MovieStatusType.InCinemas;
|
||||
if (now >= imdbMovie.PhysicalRelease)
|
||||
imdbMovie.Status = MovieStatusType.Released;
|
||||
}
|
||||
//handle the case when we have theatrical release dates but we dont know the physical release date
|
||||
else if (imdbMovie.InCinemas.HasValue && (now >= imdbMovie.InCinemas))
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.InCinemas;
|
||||
}
|
||||
//handle the case where we only have a physical release date
|
||||
else if (imdbMovie.PhysicalRelease.HasValue && (now >= imdbMovie.PhysicalRelease))
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.Released;
|
||||
}
|
||||
//otherwise the title has only been announced
|
||||
else
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.Announced;
|
||||
}
|
||||
|
||||
//since TMDB lacks alot of information lets assume that stuff is released if its been in cinemas for longer than 3 months.
|
||||
if (!imdbMovie.PhysicalRelease.HasValue && (imdbMovie.Status == MovieStatusType.InCinemas) && (((DateTime.Now).Subtract(imdbMovie.InCinemas.Value)).TotalSeconds > 60 * 60 * 24 * 30 * 3))
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.Released;
|
||||
}
|
||||
//since TMDB lacks alot of information lets assume that stuff is released if its been in cinemas for longer than 3 months.
|
||||
if (!imdbMovie.PhysicalRelease.HasValue && (imdbMovie.Status == MovieStatusType.InCinemas) && (((DateTime.Now).Subtract(imdbMovie.InCinemas.Value)).TotalSeconds > 60 * 60 * 24 * 30 * 3))
|
||||
{
|
||||
imdbMovie.Status = MovieStatusType.Released;
|
||||
}
|
||||
|
||||
imdbMovie.TitleSlug += "-" + imdbMovie.TmdbId;
|
||||
|
||||
@ -659,48 +659,48 @@ private static MediaCoverTypes MapCoverType(string coverType)
|
||||
|
||||
public Movie MapMovieToTmdbMovie(Movie movie)
|
||||
{
|
||||
try
|
||||
{
|
||||
Movie newMovie = movie;
|
||||
if (movie.TmdbId > 0)
|
||||
{
|
||||
newMovie = GetMovieInfo(movie.TmdbId);
|
||||
}
|
||||
else if (movie.ImdbId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
newMovie = GetMovieInfo(movie.ImdbId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var yearStr = "";
|
||||
if (movie.Year > 1900)
|
||||
{
|
||||
yearStr = $" {movie.Year}";
|
||||
}
|
||||
newMovie = SearchForNewMovie(movie.Title + yearStr).FirstOrDefault();
|
||||
}
|
||||
try
|
||||
{
|
||||
Movie newMovie = movie;
|
||||
if (movie.TmdbId > 0)
|
||||
{
|
||||
newMovie = GetMovieInfo(movie.TmdbId);
|
||||
}
|
||||
else if (movie.ImdbId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
newMovie = GetMovieInfo(movie.ImdbId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var yearStr = "";
|
||||
if (movie.Year > 1900)
|
||||
{
|
||||
yearStr = $" {movie.Year}";
|
||||
}
|
||||
newMovie = SearchForNewMovie(movie.Title + yearStr).FirstOrDefault();
|
||||
}
|
||||
|
||||
if (newMovie == null)
|
||||
{
|
||||
_logger.Warn("Couldn't map movie {0} to a movie on The Movie DB. It will not be added :(", movie.Title);
|
||||
return null;
|
||||
}
|
||||
if (newMovie == null)
|
||||
{
|
||||
_logger.Warn("Couldn't map movie {0} to a movie on The Movie DB. It will not be added :(", movie.Title);
|
||||
return null;
|
||||
}
|
||||
|
||||
newMovie.Path = movie.Path;
|
||||
newMovie.RootFolderPath = movie.RootFolderPath;
|
||||
newMovie.ProfileId = movie.ProfileId;
|
||||
newMovie.Monitored = movie.Monitored;
|
||||
newMovie.MovieFile = movie.MovieFile;
|
||||
newMovie.MinimumAvailability = movie.MinimumAvailability;
|
||||
newMovie.Tags = movie.Tags;
|
||||
newMovie.Path = movie.Path;
|
||||
newMovie.RootFolderPath = movie.RootFolderPath;
|
||||
newMovie.ProfileId = movie.ProfileId;
|
||||
newMovie.Monitored = movie.Monitored;
|
||||
newMovie.MovieFile = movie.MovieFile;
|
||||
newMovie.MinimumAvailability = movie.MinimumAvailability;
|
||||
newMovie.Tags = movie.Tags;
|
||||
|
||||
return newMovie;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Couldn't map movie {0} to a movie on The Movie DB. It will not be added :(", movie.Title);
|
||||
return null;
|
||||
}
|
||||
return newMovie;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Warn(ex, "Couldn't map movie {0} to a movie on The Movie DB. It will not be added :(", movie.Title);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,12 @@ public interface IAlternativeTitleRepository : IBasicRepository<AlternativeTitle
|
||||
|
||||
public class AlternativeTitleRepository : BasicRepository<AlternativeTitle>, IAlternativeTitleRepository
|
||||
{
|
||||
protected IMainDatabase _database;
|
||||
protected IMainDatabase _database;
|
||||
|
||||
public AlternativeTitleRepository(IMainDatabase database, IEventAggregator eventAggregator)
|
||||
: base(database, eventAggregator)
|
||||
{
|
||||
_database = database;
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public AlternativeTitle FindBySourceId(int sourceId)
|
||||
|
@ -29,7 +29,7 @@ public Movie()
|
||||
public MovieStatusType Status { get; set; }
|
||||
public string Overview { get; set; }
|
||||
public bool Monitored { get; set; }
|
||||
public MovieStatusType MinimumAvailability { get; set; }
|
||||
public MovieStatusType MinimumAvailability { get; set; }
|
||||
public int ProfileId { get; set; }
|
||||
public DateTime? LastInfoSync { get; set; }
|
||||
public int Runtime { get; set; }
|
||||
@ -52,7 +52,7 @@ public Movie()
|
||||
public HashSet<int> Tags { get; set; }
|
||||
public AddMovieOptions AddOptions { get; set; }
|
||||
public MovieFile MovieFile { get; set; }
|
||||
public bool HasPreDBEntry { get; set; }
|
||||
public bool HasPreDBEntry { get; set; }
|
||||
public int MovieFileId { get; set; }
|
||||
//Get Loaded via a Join Query
|
||||
public List<AlternativeTitle> AlternativeTitles { get; set; }
|
||||
@ -83,11 +83,11 @@ public bool IsRecentMovie
|
||||
|
||||
public string FolderName()
|
||||
{
|
||||
if (Path.IsNullOrWhiteSpace())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
//Well what about Path = Null?
|
||||
if (Path.IsNullOrWhiteSpace())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
//Well what about Path = Null?
|
||||
//return new DirectoryInfo(Path).Name;
|
||||
return Path;
|
||||
}
|
||||
@ -119,10 +119,10 @@ public bool IsAvailable(int delay = 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (HasPreDBEntry && MinimumAvailability == MovieStatusType.PreDB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (HasPreDBEntry && MinimumAvailability == MovieStatusType.PreDB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (MinimumAvailabilityDate == DateTime.MinValue || MinimumAvailabilityDate == DateTime.MaxValue)
|
||||
{
|
||||
|
@ -32,12 +32,12 @@ public interface IMovieRepository : IBasicRepository<Movie>
|
||||
|
||||
public class MovieRepository : BasicRepository<Movie>, IMovieRepository
|
||||
{
|
||||
protected IMainDatabase _database;
|
||||
protected IMainDatabase _database;
|
||||
|
||||
public MovieRepository(IMainDatabase database, IEventAggregator eventAggregator)
|
||||
: base(database, eventAggregator)
|
||||
{
|
||||
_database = database;
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public bool MoviePathExists(string path)
|
||||
@ -122,7 +122,7 @@ public PagingSpec<Movie> MoviesWhereCutoffUnmet(PagingSpec<Movie> pagingSpec, Li
|
||||
}
|
||||
|
||||
private SortBuilder<Movie> MoviesWhereCutoffUnmetQuery(PagingSpec<Movie> pagingSpec, List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
||||
{
|
||||
{
|
||||
return Query
|
||||
.Join<Movie, MovieFile>(JoinType.Left, e => e.MovieFile, (e, s) => e.MovieFileId == s.Id)
|
||||
.Where(pagingSpec.FilterExpressions.FirstOrDefault())
|
||||
@ -148,20 +148,20 @@ private string BuildQualityCutoffWhereClause(List<QualitiesBelowCutoff> qualitie
|
||||
return string.Format("({0})", string.Join(" OR ", clauses));
|
||||
}
|
||||
|
||||
private string BuildQualityCutoffWhereClauseSpecial(List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
private string BuildQualityCutoffWhereClauseSpecial(List<QualitiesBelowCutoff> qualitiesBelowCutoff)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
|
||||
foreach (var profile in qualitiesBelowCutoff)
|
||||
{
|
||||
foreach (var belowCutoff in profile.QualityIds)
|
||||
{
|
||||
clauses.Add(string.Format("(Movies.ProfileId = {0} AND MovieFiles.Quality LIKE '%_quality_: {1},%')", profile.ProfileId, belowCutoff));
|
||||
}
|
||||
}
|
||||
foreach (var profile in qualitiesBelowCutoff)
|
||||
{
|
||||
foreach (var belowCutoff in profile.QualityIds)
|
||||
{
|
||||
clauses.Add(string.Format("(Movies.ProfileId = {0} AND MovieFiles.Quality LIKE '%_quality_: {1},%')", profile.ProfileId, belowCutoff));
|
||||
}
|
||||
}
|
||||
|
||||
return string.Format("({0})", string.Join(" OR ", clauses));
|
||||
}
|
||||
return string.Format("({0})", string.Join(" OR ", clauses));
|
||||
}
|
||||
|
||||
private Movie FindByTitle(string cleanTitle, int? year)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public interface IMovieService
|
||||
{
|
||||
Movie GetMovie(int movieId);
|
||||
List<Movie> GetMovies(IEnumerable<int> movieIds);
|
||||
PagingSpec<Movie> Paged(PagingSpec<Movie> pagingSpec);
|
||||
PagingSpec<Movie> Paged(PagingSpec<Movie> pagingSpec);
|
||||
Movie AddMovie(Movie newMovie);
|
||||
List<Movie> AddMovies(List<Movie> newMovies);
|
||||
Movie FindByImdbId(string imdbid);
|
||||
@ -35,7 +35,7 @@ public interface IMovieService
|
||||
Movie GetMovieByFileId(int fileId);
|
||||
List<Movie> GetMoviesBetweenDates(DateTime start, DateTime end, bool includeUnmonitored);
|
||||
PagingSpec<Movie> MoviesWithoutFiles(PagingSpec<Movie> pagingSpec);
|
||||
void SetFileId(Movie movie, MovieFile movieFile);
|
||||
void SetFileId(Movie movie, MovieFile movieFile);
|
||||
void DeleteMovie(int movieId, bool deleteFiles, bool addExclusion = false);
|
||||
List<Movie> GetAllMovies();
|
||||
List<Movie> AllForTag(int tagId);
|
||||
@ -141,10 +141,10 @@ public List<Movie> GetMovies(IEnumerable<int> movieIds)
|
||||
return _movieRepository.Get(movieIds).ToList();
|
||||
}
|
||||
|
||||
public PagingSpec<Movie> Paged(PagingSpec<Movie> pagingSpec)
|
||||
{
|
||||
return _movieRepository.GetPaged(pagingSpec);
|
||||
}
|
||||
public PagingSpec<Movie> Paged(PagingSpec<Movie> pagingSpec)
|
||||
{
|
||||
return _movieRepository.GetPaged(pagingSpec);
|
||||
}
|
||||
|
||||
public Movie AddMovie(Movie newMovie)
|
||||
{
|
||||
@ -185,10 +185,10 @@ public List<Movie> AddMovies(List<Movie> newMovies)
|
||||
newMovies.ForEach(m =>
|
||||
{
|
||||
MoviePathState defaultState = MoviePathState.Static;
|
||||
if (!_configService.PathsDefaultStatic)
|
||||
{
|
||||
defaultState = MoviePathState.Dynamic;
|
||||
}
|
||||
if (!_configService.PathsDefaultStatic)
|
||||
{
|
||||
defaultState = MoviePathState.Dynamic;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(m.Path))
|
||||
{
|
||||
var folderName = _fileNameBuilder.GetMovieFolder(m);
|
||||
@ -371,11 +371,11 @@ public void Handle(MovieFileAddedEvent message)
|
||||
_logger.Info("Linking [{0}] > [{1}]", message.MovieFile.RelativePath, message.MovieFile.Movie.Value);
|
||||
}
|
||||
|
||||
public void SetFileId(Movie movie, MovieFile movieFile)
|
||||
{
|
||||
_movieRepository.SetFileId(movieFile.Id, movie.Id);
|
||||
_logger.Info("Linking [{0}] > [{1}]", movieFile.RelativePath, movie);
|
||||
}
|
||||
public void SetFileId(Movie movie, MovieFile movieFile)
|
||||
{
|
||||
_movieRepository.SetFileId(movieFile.Id, movie.Id);
|
||||
_logger.Info("Linking [{0}] > [{1}]", movieFile.RelativePath, movie);
|
||||
}
|
||||
|
||||
public void Handle(MovieFileDeletedEvent message)
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ protected virtual IList<Movie> FetchPage(NetImportRequest request, IParseNetImpo
|
||||
m.RootFolderPath = ((NetImportDefinition) Definition).RootFolderPath;
|
||||
m.ProfileId = ((NetImportDefinition) Definition).ProfileId;
|
||||
m.Monitored = ((NetImportDefinition) Definition).ShouldMonitor;
|
||||
m.MinimumAvailability = ((NetImportDefinition) Definition).MinimumAvailability;
|
||||
m.MinimumAvailability = ((NetImportDefinition) Definition).MinimumAvailability;
|
||||
m.Tags = ((NetImportDefinition) Definition).Tags;
|
||||
return m;
|
||||
}).ToList();
|
||||
|
@ -20,12 +20,12 @@ public interface IImportExclusionsRepository : IBasicRepository<ImportExclusion>
|
||||
|
||||
public class ImportExclusionsRepository : BasicRepository<ImportExclusion>, IImportExclusionsRepository
|
||||
{
|
||||
protected IMainDatabase _database;
|
||||
protected IMainDatabase _database;
|
||||
|
||||
public ImportExclusionsRepository(IMainDatabase database, IEventAggregator eventAggregator)
|
||||
: base(database, eventAggregator)
|
||||
{
|
||||
_database = database;
|
||||
_database = database;
|
||||
}
|
||||
|
||||
public bool IsMovieExcluded(int tmdbid)
|
||||
|
@ -113,7 +113,7 @@ public void Execute(NetImportSyncCommand message)
|
||||
//if there are no lists that are enabled for automatic import then dont do anything
|
||||
if((_netImportFactory.GetAvailableProviders()).Where(a => ((NetImportDefinition)a.Definition).EnableAuto).Empty())
|
||||
{
|
||||
_logger.Info("No lists are enabled for auto-import.");
|
||||
_logger.Info("No lists are enabled for auto-import.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
{
|
||||
public class RefreshRequestResponse
|
||||
{
|
||||
public string access_token { get; set; }
|
||||
public string access_token { get; set; }
|
||||
public string token_type { get; set; }
|
||||
public int expires_in { get; set; }
|
||||
public string refresh_token { get; set; }
|
||||
@ -20,7 +20,7 @@ public class RefreshRequestResponse
|
||||
|
||||
public class TraktRequestGenerator : INetImportRequestGenerator
|
||||
{
|
||||
public IConfigService _configService;
|
||||
public IConfigService _configService;
|
||||
public IHttpClient HttpClient { get; set; }
|
||||
public TraktSettings Settings { get; set; }
|
||||
|
||||
|
@ -34,7 +34,7 @@ public override void OnDownload(DownloadMessage message)
|
||||
public override void OnMovieRename(Movie movie)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override string Name => "Notify My Android";
|
||||
|
||||
public override ValidationResult Test()
|
||||
|
@ -33,7 +33,7 @@ public override void OnDownload(DownloadMessage message)
|
||||
public override void OnMovieRename(Movie movie)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override string Name => "Pushalot";
|
||||
|
||||
public override ValidationResult Test()
|
||||
|
@ -18,7 +18,7 @@ public interface IBuildFileNames
|
||||
{
|
||||
string BuildFileName(Movie movie, MovieFile movieFile, NamingConfig namingConfig = null);
|
||||
string BuildFilePath(Movie movie, string fileName, string extension);
|
||||
string BuildMoviePath(Movie movie, NamingConfig namingConfig = null);
|
||||
string BuildMoviePath(Movie movie, NamingConfig namingConfig = null);
|
||||
BasicNamingConfig GetBasicNamingConfig(NamingConfig nameSpec);
|
||||
string GetMovieFolder(Movie movie, NamingConfig namingConfig = null);
|
||||
}
|
||||
@ -214,10 +214,10 @@ public static string TitleThe(string title)
|
||||
{
|
||||
string[] prefixes = { "The ", "An ", "A " };
|
||||
|
||||
if (title.Length < 5)
|
||||
{
|
||||
return title;
|
||||
}
|
||||
if (title.Length < 5)
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
foreach (string prefix in prefixes)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ public class ReleaseInfo
|
||||
public string Codec { get; set; }
|
||||
public string Resolution { get; set; }
|
||||
|
||||
public IndexerFlags IndexerFlags { get; set; }
|
||||
public IndexerFlags IndexerFlags { get; set; }
|
||||
|
||||
public int Age
|
||||
{
|
||||
@ -94,18 +94,18 @@ public virtual string ToString(string format)
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum IndexerFlags
|
||||
{
|
||||
G_Freeleech = 1, //General
|
||||
G_Halfleech = 2, //General, only 1/2 of download counted
|
||||
G_DoubleUpload = 4, //General
|
||||
PTP_Golden = 8, //PTP
|
||||
PTP_Approved = 16, //PTP
|
||||
[Flags]
|
||||
public enum IndexerFlags
|
||||
{
|
||||
G_Freeleech = 1, //General
|
||||
G_Halfleech = 2, //General, only 1/2 of download counted
|
||||
G_DoubleUpload = 4, //General
|
||||
PTP_Golden = 8, //PTP
|
||||
PTP_Approved = 16, //PTP
|
||||
HDB_Internal = 32, //HDBits, internal
|
||||
AHD_Internal = 64, // AHD, internal
|
||||
G_Scene = 128, //General, the torrent comes from the "scene"
|
||||
G_Freeleech75 = 256, //Currently only used for AHD, signifies a torrent counts towards 75 percent of your download quota.
|
||||
G_Freeleech25 = 512 //Currently only used for AHD, signifies a torrent counts towards 25 percent of your download quota.
|
||||
}
|
||||
AHD_Internal = 64, // AHD, internal
|
||||
G_Scene = 128, //General, the torrent comes from the "scene"
|
||||
G_Freeleech75 = 256, //Currently only used for AHD, signifies a torrent counts towards 75 percent of your download quota.
|
||||
G_Freeleech25 = 512 //Currently only used for AHD, signifies a torrent counts towards 25 percent of your download quota.
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ public static class Parser
|
||||
//That did not work? Maybe some tool uses [] for years. Who would do that?
|
||||
new Regex(@"^(?<title>(?![(\[]).+?)?(?:(?:[-_\W](?<![)!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\W\d+)))+(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
//As a last resort for movies that have ( or [ in their title.
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
//As a last resort for movies that have ( or [ in their title.
|
||||
new Regex(@"^(?<title>.+?)?(?:(?:[-_\W](?<![)\[!]))*(?<year>(1(8|9)|20)\d{2}(?!p|i|\d+|\]|\W\d+)))+(\W+|_|$)(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
|
||||
};
|
||||
|
||||
@ -467,40 +467,40 @@ private static ParsedMovieInfo ParseMovieMatchCollection(MatchCollection matchCo
|
||||
var movieName = matchCollection[0].Groups["title"].Value./*Replace('.', ' ').*/Replace('_', ' ');
|
||||
movieName = RequestInfoRegex.Replace(movieName, "").Trim(' ');
|
||||
|
||||
var parts = movieName.Split('.');
|
||||
movieName = "";
|
||||
int n = 0;
|
||||
bool previousAcronym = false;
|
||||
string nextPart = "";
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (parts.Length >= n+2)
|
||||
{
|
||||
nextPart = parts[n+1];
|
||||
}
|
||||
if (part.Length == 1 && part.ToLower() != "a" && !int.TryParse(part, out n))
|
||||
{
|
||||
movieName += part + ".";
|
||||
previousAcronym = true;
|
||||
}
|
||||
else if (part.ToLower() == "a" && (previousAcronym == true || nextPart.Length == 1))
|
||||
{
|
||||
movieName += part + ".";
|
||||
previousAcronym = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (previousAcronym)
|
||||
{
|
||||
movieName += " ";
|
||||
previousAcronym = false;
|
||||
}
|
||||
movieName += part + " ";
|
||||
}
|
||||
n++;
|
||||
}
|
||||
var parts = movieName.Split('.');
|
||||
movieName = "";
|
||||
int n = 0;
|
||||
bool previousAcronym = false;
|
||||
string nextPart = "";
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (parts.Length >= n+2)
|
||||
{
|
||||
nextPart = parts[n+1];
|
||||
}
|
||||
if (part.Length == 1 && part.ToLower() != "a" && !int.TryParse(part, out n))
|
||||
{
|
||||
movieName += part + ".";
|
||||
previousAcronym = true;
|
||||
}
|
||||
else if (part.ToLower() == "a" && (previousAcronym == true || nextPart.Length == 1))
|
||||
{
|
||||
movieName += part + ".";
|
||||
previousAcronym = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (previousAcronym)
|
||||
{
|
||||
movieName += " ";
|
||||
previousAcronym = false;
|
||||
}
|
||||
movieName += part + " ";
|
||||
}
|
||||
n++;
|
||||
}
|
||||
|
||||
movieName = movieName.Trim(' ');
|
||||
movieName = movieName.Trim(' ');
|
||||
|
||||
int airYear;
|
||||
int.TryParse(matchCollection[0].Groups["year"].Value, out airYear);
|
||||
|
@ -149,7 +149,7 @@ private List<UnmappedFolder> GetUnmappedFolders(string path)
|
||||
foreach (string unmappedFolder in unmappedFolders)
|
||||
{
|
||||
var di = new DirectoryInfo(unmappedFolder.Normalize());
|
||||
if ((!di.Attributes.HasFlag(FileAttributes.System) && !di.Attributes.HasFlag(FileAttributes.Hidden)) || di.Attributes.ToString() == "-1")
|
||||
if ((!di.Attributes.HasFlag(FileAttributes.System) && !di.Attributes.HasFlag(FileAttributes.Hidden)) || di.Attributes.ToString() == "-1")
|
||||
{
|
||||
results.Add(new UnmappedFolder { Name = di.Name, Path = di.FullName });
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public void should_resolve_command_executor_by_name()
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Shit appveyor")]
|
||||
[Ignore("Shit appveyor")]
|
||||
public void should_return_same_instance_of_singletons()
|
||||
{
|
||||
var first = _container.ResolveAll<IHandle<ApplicationShutdownRequested>>().OfType<Scheduler>().Single();
|
||||
|
@ -30,7 +30,7 @@ private void HandlerCancelKeyPress(object sender, ConsoleCancelEventArgs e)
|
||||
{
|
||||
// Tell system to ignore the Ctrl+C and not terminate. We'll do that.
|
||||
e.Cancel = true;
|
||||
|
||||
|
||||
var shouldTerminate = false;
|
||||
lock (_syncRoot)
|
||||
{
|
||||
@ -46,7 +46,7 @@ private void HandlerCancelKeyPress(object sender, ConsoleCancelEventArgs e)
|
||||
else
|
||||
{
|
||||
GracefulShutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GracefulShutdown()
|
||||
|
@ -11,9 +11,9 @@ public class IndexerConfigResource : RestResource
|
||||
public int Retention { get; set; }
|
||||
public int RssSyncInterval { get; set; }
|
||||
public bool PreferIndexerFlags { get; set; }
|
||||
public int AvailabilityDelay { get; set; }
|
||||
public bool AllowHardcodedSubs { get; set; }
|
||||
public string WhitelistedHardcodedSubs { get; set; }
|
||||
public int AvailabilityDelay { get; set; }
|
||||
public bool AllowHardcodedSubs { get; set; }
|
||||
public string WhitelistedHardcodedSubs { get; set; }
|
||||
public ParsingLeniencyType ParsingLeniency { get; set; }
|
||||
}
|
||||
|
||||
@ -28,9 +28,9 @@ public static IndexerConfigResource ToResource(IConfigService model)
|
||||
Retention = model.Retention,
|
||||
RssSyncInterval = model.RssSyncInterval,
|
||||
PreferIndexerFlags = model.PreferIndexerFlags,
|
||||
AvailabilityDelay = model.AvailabilityDelay,
|
||||
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
||||
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
||||
AvailabilityDelay = model.AvailabilityDelay,
|
||||
AllowHardcodedSubs = model.AllowHardcodedSubs,
|
||||
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
|
||||
ParsingLeniency = model.ParsingLeniency,
|
||||
};
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ namespace Radarr.Api.V3.Config
|
||||
public class NetImportConfigResource : RestResource
|
||||
{
|
||||
public int NetImportSyncInterval { get; set; }
|
||||
public string ListSyncLevel { get; set; }
|
||||
public string ImportExclusions { get; set; }
|
||||
public string ListSyncLevel { get; set; }
|
||||
public string ImportExclusions { get; set; }
|
||||
}
|
||||
|
||||
public static class NetImportConfigResourceMapper
|
||||
@ -17,8 +17,8 @@ public static NetImportConfigResource ToResource(IConfigService model)
|
||||
return new NetImportConfigResource
|
||||
{
|
||||
NetImportSyncInterval = model.NetImportSyncInterval,
|
||||
ListSyncLevel = model.ListSyncLevel,
|
||||
ImportExclusions = model.ImportExclusions
|
||||
ListSyncLevel = model.ListSyncLevel,
|
||||
ImportExclusions = model.ImportExclusions
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public MovieResource()
|
||||
|
||||
//Editing Only
|
||||
public bool Monitored { get; set; }
|
||||
public MovieStatusType MinimumAvailability { get; set; }
|
||||
public MovieStatusType MinimumAvailability { get; set; }
|
||||
public bool IsAvailable { get; set; }
|
||||
public string FolderName { get; set; }
|
||||
|
||||
@ -105,7 +105,7 @@ public static MovieResource ToResource(this Movie model)
|
||||
|
||||
Monitored = model.Monitored,
|
||||
MinimumAvailability = model.MinimumAvailability,
|
||||
|
||||
|
||||
IsAvailable = model.IsAvailable(),
|
||||
FolderName = model.FolderName(),
|
||||
|
||||
@ -158,7 +158,7 @@ public static Movie ToModel(this MovieResource resource)
|
||||
|
||||
Monitored = resource.Monitored,
|
||||
MinimumAvailability = resource.MinimumAvailability,
|
||||
|
||||
|
||||
Runtime = resource.Runtime,
|
||||
LastInfoSync = resource.LastInfoSync,
|
||||
CleanTitle = resource.CleanTitle,
|
||||
|
Loading…
Reference in New Issue
Block a user