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