1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-03-06 13:31:28 -05:00

Compare commits

...

28 Commits

Author SHA1 Message Date
Leonardo Galli
48559cf964 Updated legend with number of movies 2017-01-10 17:36:04 +01:00
Leonardo Galli
c734e8bc7e Update legend for missing status colors. 2017-01-10 17:07:32 +01:00
Leonardo Galli
3c7d7756e6 Fix issues with media managment config not getting saved. 2017-01-10 17:05:37 +01:00
Leonardo Galli
683bda49d8 Movie Editor works now. Fixes #99. 2017-01-10 16:51:56 +01:00
Leonardo Galli
52fb29ee18 Fixes a few things with importing: Sample check is done even when file is already in movie folder. Fixed importing of movies with "DC". 2017-01-10 16:23:07 +01:00
Leonardo Galli
236e16c9a5 Update sample detection runtime minutes. Some trailers can be long. 2017-01-10 15:43:35 +01:00
Leonardo Galli
0584038273 Fix queue specification. 2017-01-10 15:33:39 +01:00
Leonardo Galli
6685aea144 Movie search should now work, even when titles returned from the TMDB do not have a release date set. Fixes #27. 2017-01-10 15:29:20 +01:00
Leonardo Galli
e4f7aa52df History now correctly shows movie title. Fixes #92 2017-01-10 15:15:15 +01:00
Leonardo Galli
f61c4feb00 Redownloading failed downloads works again. Fixes #89. 2017-01-10 14:15:27 +01:00
Leonardo Galli
04e8c635e0 Use correct Modal for editing movies in table view. Fixes #90 2017-01-10 14:05:01 +01:00
Leonardo Galli
93ea5cfdee Merge pull request #88 from schumi2004/develop
Replace Sonarr with Radarr in Test notification messages
2017-01-10 11:31:39 +01:00
schumi2004
1b7288e7cb Replace Sonarr with Radarr in Test notification messages 2017-01-10 11:21:09 +01:00
Tim Turner
f1914082b8 Merge pull request #74 from fedoranimus/develop
Taking a pass at Library import and rename/organize
2017-01-09 17:31:25 -05:00
Tim Turner
6016948329 Merge remote-tracking branch 'refs/remotes/galli-leo/develop' into develop 2017-01-09 17:26:25 -05:00
Tim Turner
708db1a75c Organize & Rename work 2017-01-09 17:26:13 -05:00
Leonardo Galli
994e881ba6 Fixes an issue with movies not being added with same title slug as existing movies. 2017-01-09 23:16:54 +01:00
Leonardo Galli
893e20c27b Fix some links under status. Needs further changing further down the line. 2017-01-09 22:17:17 +01:00
Tim Turner
23aace6149 Merge remote-tracking branch 'refs/remotes/galli-leo/develop' into develop
# Conflicts:
#	src/NzbDrone.Api/Series/MovieResource.cs
2017-01-09 15:59:25 -05:00
Leonardo Galli
e774e6a038 Fix for importing movie folders with the at the end. 2017-01-09 21:37:37 +01:00
Tim Turner
74c5664a7f Taking another pass at organization/renaming
Works once in a while
2017-01-08 22:16:14 -05:00
Tim Turner
4c9abe3d84 Merge remote-tracking branch 'refs/remotes/galli-leo/develop' into develop 2017-01-08 19:48:14 -05:00
Tim Turner
7a45394820 Unable to properly parse many movie titles 2017-01-08 19:48:04 -05:00
Tim Turner
14bf63e21d Merge remote-tracking branch 'refs/remotes/galli-leo/develop' into develop 2017-01-08 17:01:47 -05:00
Tim Turner
b5d932866a Second Pass at rename/organize 2017-01-08 17:01:37 -05:00
Tim Turner
cd4863b974 Display UI for MovieEditor, remove reference to SeasonPass 2017-01-08 09:16:24 -05:00
Tim Turner
d006df8d7c Merge remote-tracking branch 'refs/remotes/galli-leo/develop' into develop 2017-01-08 06:51:47 -05:00
Tim Turner
1ebd639e36 Merge remote-tracking branch 'refs/remotes/galli-leo/develop' into develop 2017-01-07 21:05:30 -05:00
68 changed files with 1021 additions and 166 deletions

View File

@@ -34,11 +34,11 @@ namespace NzbDrone.Api.Config
Get["/samples"] = x => GetExamples(this.Bind<NamingConfigResource>());
SharedValidator.RuleFor(c => c.MultiEpisodeStyle).InclusiveBetween(0, 5);
SharedValidator.RuleFor(c => c.StandardEpisodeFormat).ValidEpisodeFormat();
/*SharedValidator.RuleFor(c => c.StandardEpisodeFormat).ValidEpisodeFormat();
SharedValidator.RuleFor(c => c.DailyEpisodeFormat).ValidDailyEpisodeFormat();
SharedValidator.RuleFor(c => c.AnimeEpisodeFormat).ValidAnimeEpisodeFormat();
SharedValidator.RuleFor(c => c.SeriesFolderFormat).ValidSeriesFolderFormat();
SharedValidator.RuleFor(c => c.SeasonFolderFormat).ValidSeasonFolderFormat();
SharedValidator.RuleFor(c => c.SeasonFolderFormat).ValidSeasonFolderFormat();*/
SharedValidator.RuleFor(c => c.StandardMovieFormat).ValidMovieFormat();
SharedValidator.RuleFor(c => c.MovieFolderFormat).ValidMovieFolderFormat();
}

View File

@@ -107,8 +107,8 @@ namespace NzbDrone.Api.Indexers
ReleaseGroup = parsedMovieInfo.ReleaseGroup,
ReleaseHash = parsedMovieInfo.ReleaseHash,
Title = releaseInfo.Title,
FullSeason = parsedMovieInfo.FullSeason,
SeasonNumber = parsedMovieInfo.SeasonNumber,
//FullSeason = parsedMovieInfo.FullSeason,
//SeasonNumber = parsedMovieInfo.SeasonNumber,
Language = parsedMovieInfo.Language,
AirDate = "",
SeriesTitle = parsedMovieInfo.MovieTitle,
@@ -138,7 +138,7 @@ namespace NzbDrone.Api.Indexers
IsDaily = false,
IsAbsoluteNumbering = false,
IsPossibleSpecialEpisode = false,
Special = parsedMovieInfo.Special,
//Special = parsedMovieInfo.Special,
};
}

View File

@@ -0,0 +1,31 @@
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Api.Extensions;
using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Movie
{
public class MovieEditorModule : NzbDroneApiModule
{
private readonly IMovieService _movieService;
public MovieEditorModule(IMovieService movieService)
: base("/movie/editor")
{
_movieService = movieService;
Put["/"] = Movie => SaveAll();
}
private Response SaveAll()
{
var resources = Request.Body.FromJson<List<MovieResource>>();
var Movie = resources.Select(MovieResource => MovieResource.ToModel(_movieService.GetMovie(MovieResource.Id))).ToList();
return _movieService.UpdateMovie(Movie)
.ToResource()
.AsResponse(HttpStatusCode.Accepted);
}
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Api.Movies
{
class MovieModule
{
}
}

View File

@@ -0,0 +1,35 @@
using NzbDrone.Api.REST;
using NzbDrone.Core.MediaFiles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Api.Movies
{
public class RenameMovieModule : NzbDroneRestModule<RenameMovieResource>
{
private readonly IRenameMovieFileService _renameMovieFileService;
public RenameMovieModule(IRenameMovieFileService renameMovieFileService)
: base("rename")
{
_renameMovieFileService = renameMovieFileService;
GetResourceAll = GetMovies; //TODO: GetResourceSingle?
}
private List<RenameMovieResource> GetMovies()
{
if(!Request.Query.MovieId.HasValue)
{
throw new BadRequestException("movieId is missing");
}
var movieId = (int)Request.Query.MovieId;
return _renameMovieFileService.GetRenamePreviews(movieId).ToResource();
}
}
}

View File

@@ -0,0 +1,35 @@
using NzbDrone.Api.REST;
using System.Collections.Generic;
using System.Linq;
namespace NzbDrone.Api.Movies
{
public class RenameMovieResource : RestResource
{
public int MovieId { get; set; }
public int MovieFileId { get; set; }
public string ExistingPath { get; set; }
public string NewPath { get; set; }
}
public static class RenameMovieResourceMapper
{
public static RenameMovieResource ToResource(this Core.MediaFiles.RenameMovieFilePreview model)
{
if (model == null) return null;
return new RenameMovieResource
{
MovieId = model.MovieId,
MovieFileId = model.MovieFileId,
ExistingPath = model.ExistingPath,
NewPath = model.NewPath
};
}
public static List<RenameMovieResource> ToResource(this IEnumerable<Core.MediaFiles.RenameMovieFilePreview> models)
{
return models.Select(ToResource).ToList();
}
}
}

View File

@@ -116,6 +116,10 @@
<Compile Include="Frontend\Mappers\RobotsTxtMapper.cs" />
<Compile Include="Indexers\ReleaseModuleBase.cs" />
<Compile Include="Indexers\ReleasePushModule.cs" />
<Compile Include="Movies\MovieModule.cs" />
<Compile Include="Movies\RenameMovieModule.cs" />
<Compile Include="Movies\RenameMovieResource.cs" />
<Compile Include="Movies\MovieEditorModule.cs" />
<Compile Include="Parse\ParseModule.cs" />
<Compile Include="Parse\ParseResource.cs" />
<Compile Include="ManualImport\ManualImportModule.cs" />

View File

@@ -18,7 +18,7 @@ namespace NzbDrone.Api.Movie
//Todo: Sorters should be done completely on the client
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
//Todo: We should get the entire Profile instead of ID and Name separately
//View Only
public string Title { get; set; }
public List<AlternateTitleResource> AlternateTitles { get; set; }
@@ -33,6 +33,7 @@ namespace NzbDrone.Api.Movie
public bool Downloaded { get; set; }
public string RemotePoster { get; set; }
public int Year { get; set; }
public bool HasFile { get; set; }
//View & Edit
public string Path { get; set; }
@@ -84,12 +85,17 @@ namespace NzbDrone.Api.Movie
long size = 0;
bool downloaded = false;
if(model.MovieFile != null)
{
model.MovieFile.LazyLoad();
}
if (model.MovieFile != null && model.MovieFile.IsLoaded && model.MovieFile.Value != null)
{
size = model.MovieFile.Value.Size;
downloaded = true;
}
//long Size = model.MovieFile != null ? model.MovieFile.Value.Size : 0;
return new MovieResource
{
@@ -100,7 +106,7 @@ namespace NzbDrone.Api.Movie
SortTitle = model.SortTitle,
InCinemas = model.InCinemas,
PhysicalRelease = model.PhysicalRelease,
HasFile = model.HasFile,
Downloaded = downloaded,
//TotalEpisodeCount
//EpisodeCount

View File

@@ -60,7 +60,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
foreach (var remoteEpisode in matchingSeries)
{
_logger.Debug("Checking if existing release in queue meets cutoff. Queued quality is: {0}", remoteEpisode.ParsedEpisodeInfo.Quality);
_logger.Debug("Checking if existing release in queue meets cutoff. Queued quality is: {0}", remoteEpisode.ParsedMovieInfo.Quality);
if (!_qualityUpgradableSpecification.CutoffNotMet(subject.Movie.Profile, remoteEpisode.ParsedMovieInfo.Quality, subject.ParsedMovieInfo.Quality))
{

View File

@@ -94,7 +94,6 @@ namespace NzbDrone.Core.Download
return;
}
var series = _parsingService.GetSeries(trackedDownload.DownloadItem.Title);
if (series == null)
@@ -156,7 +155,7 @@ namespace NzbDrone.Core.Download
trackedDownload.Warn(statusMessages);
}
}
else
else if (trackedDownload.RemoteEpisode.Series != null)
{
var importResults = _downloadedEpisodesImportService.ProcessPath(outputPath, ImportMode.Auto, trackedDownload.RemoteEpisode.Series, trackedDownload.DownloadItem);

View File

@@ -13,6 +13,7 @@ namespace NzbDrone.Core.Download
}
public int SeriesId { get; set; }
public int MovieId { get; set; }
public List<int> EpisodeIds { get; set; }
public QualityModel Quality { get; set; }
public string SourceTitle { get; set; }

View File

@@ -88,6 +88,7 @@ namespace NzbDrone.Core.Download
var downloadFailedEvent = new DownloadFailedEvent
{
SeriesId = historyItem.SeriesId,
MovieId = historyItem.MovieId,
EpisodeIds = historyItems.Select(h => h.EpisodeId).ToList(),
Quality = historyItem.Quality,
SourceTitle = historyItem.SourceTitle,

View File

@@ -34,6 +34,15 @@ namespace NzbDrone.Core.Download
return;
}
if (message.MovieId != 0)
{
_logger.Debug("Failed download contains a movie, searching again.");
_commandQueueManager.Push(new MoviesSearchCommand { MovieId = message.MovieId });
return;
}
if (message.EpisodeIds.Count == 1)
{
_logger.Debug("Failed download only contains one episode, searching again");

View File

@@ -111,6 +111,18 @@ namespace NzbDrone.Core.Extras
}
}
//TODO: Implementing this will fix a lot of our warning exceptions
//public void Handle(MediaCoversUpdatedEvent message)
//{
// var movie = message.Movie;
// var movieFiles = GetMovieFiles(movie.Id);
// foreach (var extraFileManager in _extraFileManagers)
// {
// extraFileManager.CreateAfterMovieScan(movie, movieFiles);
// }
//}
public void Handle(EpisodeFolderCreatedEvent message)
{
var series = message.Series;

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.MediaFiles.Commands

View File

@@ -0,0 +1,19 @@
using NzbDrone.Core.Messaging.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.MediaFiles.Commands
{
public class RenameMovieCommand : Command
{
public List<int> MovieIds { get; set; }
public override bool SendUpdatesToClient => true;
public RenameMovieCommand()
{
}
}
}

View File

@@ -0,0 +1,26 @@
using NzbDrone.Core.Messaging.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.MediaFiles.Commands
{
public class RenameMovieFilesCommand : Command
{
public int MovieId { get; set; }
public List<int> Files { get; set; }
public override bool SendUpdatesToClient => true;
public RenameMovieFilesCommand()
{
}
public RenameMovieFilesCommand(int movieId, List<int> files)
{
MovieId = movieId;
Files = files;
}
}
}

View File

@@ -38,6 +38,7 @@ namespace NzbDrone.Core.MediaFiles
private readonly IDiskProvider _diskProvider;
private readonly IMakeImportDecision _importDecisionMaker;
private readonly IImportApprovedEpisodes _importApprovedEpisodes;
private readonly IImportApprovedMovie _importApprovedMovies;
private readonly IConfigService _configService;
private readonly ISeriesService _seriesService;
private readonly IMediaFileTableCleanupService _mediaFileTableCleanupService;
@@ -48,6 +49,7 @@ namespace NzbDrone.Core.MediaFiles
public DiskScanService(IDiskProvider diskProvider,
IMakeImportDecision importDecisionMaker,
IImportApprovedEpisodes importApprovedEpisodes,
IImportApprovedMovie importApprovedMovies,
IConfigService configService,
ISeriesService seriesService,
IMediaFileTableCleanupService mediaFileTableCleanupService,
@@ -58,6 +60,7 @@ namespace NzbDrone.Core.MediaFiles
_diskProvider = diskProvider;
_importDecisionMaker = importDecisionMaker;
_importApprovedEpisodes = importApprovedEpisodes;
_importApprovedMovies = importApprovedMovies;
_configService = configService;
_seriesService = seriesService;
_mediaFileTableCleanupService = mediaFileTableCleanupService;
@@ -179,7 +182,8 @@ namespace NzbDrone.Core.MediaFiles
decisionsStopwatch.Stop();
_logger.Trace("Import decisions complete for: {0} [{1}]", movie, decisionsStopwatch.Elapsed);
_importApprovedEpisodes.Import(decisions, false);
//_importApprovedEpisodes.Import(decisions, false);
_importApprovedMovies.Import(decisions, false);
_logger.Info("Completed scanning disk for {0}", movie.Title);
_eventAggregator.PublishEvent(new MovieScannedEvent(movie));

View File

@@ -159,7 +159,7 @@ namespace NzbDrone.Core.MediaFiles
}
var cleanedUpName = GetCleanedUpFolderName(directoryInfo.Name);
var folderInfo = Parser.Parser.ParseTitle(directoryInfo.Name);
var folderInfo = Parser.Parser.ParseMovieTitle(directoryInfo.Name);
if (folderInfo != null)
{

View File

@@ -153,7 +153,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
private int GetMinimumAllowedRuntime(Movie movie)
{
return 120; //2 minutes
return 360; //6 minutes
}
private int GetMinimumAllowedRuntime(Series series)

View File

@@ -47,6 +47,8 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
public List<ImportResult> Import(List<ImportDecision> decisions, bool newDownload, DownloadClientItem downloadClientItem = null, ImportMode importMode = ImportMode.Auto)
{
_logger.Debug("Decisions: {0}", decisions.Count);
var qualifiedImports = decisions.Where(c => c.Approved)
.GroupBy(c => c.LocalMovie.Movie.Id, (i, s) => s
.OrderByDescending(c => c.LocalMovie.Quality, new QualityModelComparer(s.First().LocalMovie.Movie.Profile))
@@ -80,7 +82,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
episodeFile.Quality = localMovie.Quality;
episodeFile.MediaInfo = localMovie.MediaInfo;
episodeFile.Movie = localMovie.Movie;
episodeFile.ReleaseGroup = localMovie.ParsedEpisodeInfo.ReleaseGroup;
episodeFile.ReleaseGroup = localMovie.ParsedMovieInfo.ReleaseGroup;
bool copyOnly;
switch (importMode)

View File

@@ -24,15 +24,15 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
{
LocalMovie = localMovie;
Rejections = rejections.ToList();
LocalEpisode = new LocalEpisode
{
Quality = localMovie.Quality,
ExistingFile = localMovie.ExistingFile,
MediaInfo = localMovie.MediaInfo,
ParsedEpisodeInfo = localMovie.ParsedEpisodeInfo,
Path = localMovie.Path,
Size = localMovie.Size
};
//LocalMovie = new LocalMovie
//{
// Quality = localMovie.Quality,
// ExistingFile = localMovie.ExistingFile,
// MediaInfo = localMovie.MediaInfo,
// ParsedMovieInfo = localMovie.ParsedMovieInfo,
// Path = localMovie.Path,
// Size = localMovie.Size
//};
}
}
}

View File

@@ -19,7 +19,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
{
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series);
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie);
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource); //TODO: Needs changing to ParsedMovieInfo!!
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource); //TODO: Needs changing to ParsedMovieInfo!!
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource);
}
@@ -77,7 +77,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
return decisions;
}
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource)
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource)
{
var newFiles = _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie);
@@ -94,7 +94,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
return decisions;
}
private ImportDecision GetDecision(string file, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource, bool shouldUseFolderName)
private ImportDecision GetDecision(string file, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource, bool shouldUseFolderName)
{
ImportDecision decision = null;
@@ -123,18 +123,18 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
else
{
var localEpisode = new LocalEpisode();
localEpisode.Path = file;
localMovie = new LocalMovie();
localMovie.Path = file;
decision = new ImportDecision(localEpisode, new Rejection("Unable to parse file"));
decision = new ImportDecision(localMovie, new Rejection("Unable to parse file"));
}
}
catch (Exception e)
{
_logger.Error(e, "Couldn't import file. " + file);
var localEpisode = new LocalEpisode { Path = file };
decision = new ImportDecision(localEpisode, new Rejection("Unexpected error processing file"));
var localMovie = new LocalMovie { Path = file };
decision = new ImportDecision(localMovie, new Rejection("Unexpected error processing file"));
}
//LocalMovie nullMovie = null;
@@ -291,17 +291,17 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
}) == 1;
}
private bool ShouldUseFolderName(List<string> videoFiles, Movie movie, ParsedEpisodeInfo folderInfo)
private bool ShouldUseFolderName(List<string> videoFiles, Movie movie, ParsedMovieInfo folderInfo)
{
if (folderInfo == null)
{
return false;
}
if (folderInfo.FullSeason)
{
return false;
}
//if (folderInfo.FullSeason)
//{
// return false;
//}
return videoFiles.Count(file =>
{
@@ -325,7 +325,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
}) == 1;
}
private QualityModel GetQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQuality, Movie movie)
private QualityModel GetQuality(ParsedMovieInfo folderInfo, QualityModel fileQuality, Movie movie)
{
if (UseFolderQuality(folderInfo, fileQuality, movie))
{
@@ -347,7 +347,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
return fileQuality;
}
private bool UseFolderQuality(ParsedEpisodeInfo folderInfo, QualityModel fileQuality, Movie movie)
private bool UseFolderQuality(ParsedMovieInfo folderInfo, QualityModel fileQuality, Movie movie)
{
if (folderInfo == null)
{

View File

@@ -40,12 +40,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
public Decision IsSatisfiedBy(LocalMovie localEpisode)
{
if (localEpisode.ExistingFile)
{
_logger.Debug("Existing file, skipping sample check");
return Decision.Accept();
}
var sample = _detectSample.IsSample(localEpisode.Movie,
localEpisode.Quality,
localEpisode.Path,

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Messaging.Events;

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NLog;
@@ -13,9 +13,9 @@ namespace NzbDrone.Core.MediaFiles
{
public interface IMediaFileService
{
MovieFile Add(MovieFile episodeFile);
void Update(MovieFile episodeFile);
void Delete(MovieFile episodeFile, DeleteMediaFileReason reason);
MovieFile Add(MovieFile movieFile);
void Update(MovieFile movieFile);
void Delete(MovieFile movieFile, DeleteMediaFileReason reason);
EpisodeFile Add(EpisodeFile episodeFile);
void Update(EpisodeFile episodeFile);
void Delete(EpisodeFile episodeFile, DeleteMediaFileReason reason);
@@ -27,7 +27,9 @@ namespace NzbDrone.Core.MediaFiles
List<string> FilterExistingFiles(List<string> files, Movie movie);
EpisodeFile Get(int id);
List<EpisodeFile> Get(IEnumerable<int> ids);
List<MovieFile> GetMovies(IEnumerable<int> ids);
//List<MovieFile> Get(IEnumerable<int> ids);
}
public class MediaFileService : IMediaFileService, IHandleAsync<SeriesDeletedEvent>
@@ -125,6 +127,11 @@ namespace NzbDrone.Core.MediaFiles
return _mediaFileRepository.Get(ids).ToList();
}
public List<MovieFile> GetMovies(IEnumerable<int> ids)
{
return _movieFileRepository.Get(ids).ToList();
}
public void HandleAsync(SeriesDeletedEvent message)
{
var files = GetFilesBySeries(message.Series.Id);

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.MediaFiles
{
public class RenameMovieFilePreview
{
public int MovieId { get; set; }
public int MovieFileId { get; set; }
public string ExistingPath { get; set; }
public string NewPath { get; set; }
}
}

View File

@@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using NLog;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.MediaFiles.Commands;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.MediaFiles
{
public interface IRenameMovieFileService
{
List<RenameMovieFilePreview> GetRenamePreviews(int movieId);
}
public class RenameMovieFileService : IRenameMovieFileService,
IExecute<RenameMovieFilesCommand>,
IExecute<RenameMovieCommand>
{
private readonly IMovieService _movieService;
private readonly IMediaFileService _mediaFileService;
private readonly IMoveMovieFiles _movieFileMover;
private readonly IEventAggregator _eventAggregator;
private readonly IBuildFileNames _filenameBuilder;
private readonly Logger _logger;
public RenameMovieFileService(IMovieService movieService,
IMediaFileService mediaFileService,
IMoveMovieFiles movieFileMover,
IEventAggregator eventAggregator,
IBuildFileNames filenameBuilder,
Logger logger)
{
_movieService = movieService;
_mediaFileService = mediaFileService;
_movieFileMover = movieFileMover;
_eventAggregator = eventAggregator;
_filenameBuilder = filenameBuilder;
_logger = logger;
}
public List<RenameMovieFilePreview> GetRenamePreviews(int movieId)
{
var movie = _movieService.GetMovie(movieId);
var file = _mediaFileService.GetFilesByMovie(movieId);
return GetPreviews(movie, file).OrderByDescending(m => m.MovieId).ToList(); //TODO: Would really like to not have these be lists
}
private IEnumerable<RenameMovieFilePreview> GetPreviews(Movie movie, List<MovieFile> files)
{
foreach(var file in files)
{
var movieFilePath = Path.Combine(movie.Path, file.RelativePath);
var newName = _filenameBuilder.BuildFileName(movie, file);
var newPath = _filenameBuilder.BuildFilePath(movie, newName, Path.GetExtension(movieFilePath));
if(!movieFilePath.PathEquals(newPath, StringComparison.Ordinal))
{
yield return new RenameMovieFilePreview
{
MovieId = movie.Id,
MovieFileId = file.Id,
ExistingPath = file.RelativePath,
NewPath = movie.Path.GetRelativePath(newPath)
};
}
}
}
private void RenameFiles(List<MovieFile> movieFiles, Movie movie)
{
var renamed = new List<MovieFile>();
foreach(var movieFile in movieFiles)
{
var movieFilePath = Path.Combine(movie.Path, movieFile.RelativePath);
try
{
_logger.Debug("Renaming movie file: {0}", movieFile);
_movieFileMover.MoveMovieFile(movieFile, movie);
_mediaFileService.Update(movieFile);
renamed.Add(movieFile);
_logger.Debug("Renamed movie file: {0}", movieFile);
}
catch(SameFilenameException ex)
{
_logger.Debug("File not renamed, source and destination are the same: {0}", ex.Filename);
}
catch(Exception ex)
{
_logger.Error(ex, "Failed to rename file: " + movieFilePath);
}
}
}
public void Execute(RenameMovieFilesCommand message)
{
var movie = _movieService.GetMovie(message.MovieId);
var movieFiles = _mediaFileService.GetMovies(message.Files);
_logger.ProgressInfo("Renaming {0} files for {1}", movieFiles.Count, movie.Title);
RenameFiles(movieFiles, movie);
_logger.ProgressInfo("Selected movie files renamed for {0}", movie.Title);
}
public void Execute(RenameMovieCommand message)
{
_logger.Debug("Renaming all files for selected movie");
var moviesToRename = _movieService.GetMovies(message.MovieIds);
foreach(var movie in moviesToRename)
{
var movieFiles = _mediaFileService.GetFilesByMovie(movie.Id);
_logger.ProgressInfo("Renaming all files in movie: {0}", movie.Title);
RenameFiles(movieFiles, movie);
_logger.ProgressInfo("All movie files renamed for {0}", movie.Title);
}
}
}
}

View File

@@ -24,13 +24,15 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
private readonly IHttpRequestBuilderFactory _requestBuilder;
private readonly IHttpRequestBuilderFactory _movieBuilder;
private readonly ITmdbConfigService _configService;
private readonly IMovieService _movieService;
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, Logger logger)
public SkyHookProxy(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, ITmdbConfigService configService, IMovieService movieService, Logger logger)
{
_httpClient = httpClient;
_requestBuilder = requestBuilder.SkyHookTvdb;
_movieBuilder = requestBuilder.TMDB;
_configService = configService;
_movieService = movieService;
_logger = logger;
}
@@ -90,8 +92,18 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
movie.CleanTitle = Parser.Parser.CleanSeriesTitle(movie.Title);
movie.Overview = resource.overview;
movie.Website = resource.homepage;
movie.InCinemas = DateTime.Parse(resource.release_date);
movie.Year = movie.InCinemas.Value.Year;
if (resource.release_date.IsNotNullOrWhiteSpace())
{
movie.InCinemas = DateTime.Parse(resource.release_date);
movie.Year = movie.InCinemas.Value.Year;
}
var slugResult = _movieService.FindByTitleSlug(movie.TitleSlug);
if (slugResult != null)
{
_logger.Debug("Movie with this title slug already exists. Adding year...");
}
movie.TitleSlug += "-" + movie.Year.ToString();
movie.Images.Add(_configService.GetCoverForURL(resource.poster_path, MediaCoverTypes.Poster));//TODO: Update to load image specs from tmdb page!
movie.Images.Add(_configService.GetCoverForURL(resource.backdrop_path, MediaCoverTypes.Banner));
@@ -165,10 +177,10 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
{
if(title.EndsWith(",the"))
{
title = title.Substring(title.Length - 4);
title = title.Substring(0, title.Length - 4);
} else if(title.EndsWith(", the"))
{
title = title.Substring(title.Length - 5);
title = title.Substring(0, title.Length - 5);
}
return title;
}
@@ -319,7 +331,21 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
imdbMovie.Title = result.title;
string titleSlug = result.title;
imdbMovie.TitleSlug = titleSlug.ToLower().Replace(" ", "-");
imdbMovie.Year = DateTime.Parse(result.release_date).Year;
if (result.release_date.IsNotNullOrWhiteSpace())
{
imdbMovie.Year = DateTime.Parse(result.release_date).Year;
}
var slugResult = _movieService.FindByTitleSlug(imdbMovie.TitleSlug);
if (slugResult != null)
{
_logger.Debug("Movie with this title slug already exists. Adding year...");
}
imdbMovie.TitleSlug += "-" + imdbMovie.Year.ToString();
imdbMovie.Images = new List<MediaCover.MediaCover>();
imdbMovie.Overview = result.overview;
try

View File

@@ -43,7 +43,7 @@ namespace NzbDrone.Core.Notifications.Boxcar
try
{
const string title = "Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
SendNotification(title, body, settings);
return null;

View File

@@ -146,7 +146,7 @@ namespace NzbDrone.Core.Notifications.Growl
Register(settings.Host, settings.Port, settings.Password);
const string title = "Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
SendNotification(title, body, "TEST", settings.Host, settings.Port, settings.Password);
}

View File

@@ -41,7 +41,7 @@ namespace NzbDrone.Core.Notifications.Join
public ValidationFailure Test(JoinSettings settings)
{
const string title = "Test Notification";
const string body = "This is a test message from Sonarr.";
const string body = "This is a test message from Radarr.";
try
{

View File

@@ -69,7 +69,7 @@ namespace NzbDrone.Core.Notifications.NotifyMyAndroid
try
{
const string title = "Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
Verify(settings.ApiKey);
SendNotification(title, body, settings.ApiKey, (NotifyMyAndroidPriority)settings.Priority);
}

View File

@@ -88,7 +88,7 @@ namespace NzbDrone.Core.Notifications.Prowl
Verify(settings.ApiKey);
const string title = "Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
SendNotification(title, body, settings.ApiKey);
}

View File

@@ -93,7 +93,7 @@ namespace NzbDrone.Core.Notifications.PushBullet
try
{
const string title = "Sonarr - Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
SendNotification(title, body, settings);
}

View File

@@ -65,7 +65,7 @@ namespace NzbDrone.Core.Notifications.Pushalot
try
{
const string title = "Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
SendNotification(title, body, settings);
}

View File

@@ -53,7 +53,7 @@ namespace NzbDrone.Core.Notifications.Pushover
try
{
const string title = "Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
SendNotification(title, body, settings);
}

View File

@@ -45,7 +45,7 @@ namespace NzbDrone.Core.Notifications.Telegram
try
{
const string title = "Test Notification";
const string body = "This is a test message from Sonarr";
const string body = "This is a test message from Radarr";
SendNotification(title, body, settings);
}

View File

@@ -707,6 +707,8 @@
<Compile Include="MediaFiles\Commands\BackendCommandAttribute.cs" />
<Compile Include="MediaFiles\Commands\CleanUpRecycleBinCommand.cs" />
<Compile Include="MediaFiles\Commands\DownloadedEpisodesScanCommand.cs" />
<Compile Include="MediaFiles\Commands\RenameMovieCommand.cs" />
<Compile Include="MediaFiles\Commands\RenameMovieFilesCommand.cs" />
<Compile Include="MediaFiles\Commands\RescanMovieCommand.cs" />
<Compile Include="MediaFiles\DownloadedMovieCommandService.cs" />
<Compile Include="MediaFiles\MovieFileMovingService.cs" />
@@ -780,6 +782,8 @@
<Compile Include="MediaFiles\RecycleBinProvider.cs" />
<Compile Include="MediaFiles\RenameEpisodeFilePreview.cs" />
<Compile Include="MediaFiles\RenameEpisodeFileService.cs" />
<Compile Include="MediaFiles\RenameMovieFilePreview.cs" />
<Compile Include="MediaFiles\RenameMovieFileService.cs" />
<Compile Include="MediaFiles\SameFilenameException.cs" />
<Compile Include="MediaFiles\UpdateMovieFileService.cs" />
<Compile Include="MediaFiles\UpdateEpisodeFileService.cs" />

View File

@@ -67,6 +67,8 @@ namespace NzbDrone.Core.Organizer
{
var value = context.PropertyValue as string;
return true;
if (!FileNameBuilder.SeasonEpisodePatternRegex.IsMatch(value) &&
!FileNameValidation.OriginalTokenRegex.IsMatch(value))
{
@@ -89,6 +91,8 @@ namespace NzbDrone.Core.Organizer
{
var value = context.PropertyValue as string;
return true;
if (!FileNameBuilder.SeasonEpisodePatternRegex.IsMatch(value) &&
!FileNameBuilder.AirDateRegex.IsMatch(value) &&
!FileNameValidation.OriginalTokenRegex.IsMatch(value))
@@ -112,6 +116,8 @@ namespace NzbDrone.Core.Organizer
{
var value = context.PropertyValue as string;
return true;
if (!FileNameBuilder.SeasonEpisodePatternRegex.IsMatch(value) &&
!FileNameBuilder.AbsoluteEpisodePatternRegex.IsMatch(value) &&
!FileNameValidation.OriginalTokenRegex.IsMatch(value))

View File

@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using System.Collections.Generic;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
@@ -14,7 +14,7 @@ namespace NzbDrone.Core.Parser.Model
public string Path { get; set; }
public long Size { get; set; }
public ParsedEpisodeInfo ParsedEpisodeInfo { get; set; }
public ParsedMovieInfo ParsedMovieInfo { get; set; }
public Movie Movie { get; set; }
public QualityModel Quality { get; set; }
public MediaInfoModel MediaInfo { get; set; }

View File

@@ -1,4 +1,4 @@
using System.Linq;
using System.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Qualities;
@@ -9,10 +9,10 @@ namespace NzbDrone.Core.Parser.Model
public string MovieTitle { get; set; }
public SeriesTitleInfo MovieTitleInfo { get; set; }
public QualityModel Quality { get; set; }
public int SeasonNumber { get; set; }
//public int SeasonNumber { get; set; }
public Language Language { get; set; }
public bool FullSeason { get; set; }
public bool Special { get; set; }
//public bool FullSeason { get; set; }
//public bool Special { get; set; }
public string ReleaseGroup { get; set; }
public string ReleaseHash { get; set; }
public string Edition { get; set;}

View File

@@ -323,6 +323,28 @@ namespace NzbDrone.Core.Parser
return result;
}
public static ParsedMovieInfo ParseMoviePath(string path)
{
var fileInfo = new FileInfo(path);
var result = ParseMovieTitle(fileInfo.Name);
if (result == null)
{
Logger.Debug("Attempting to parse episode info using directory and file names. {0}", fileInfo.Directory.Name);
result = ParseMovieTitle(fileInfo.Directory.Name + " " + fileInfo.Name);
}
if (result == null)
{
Logger.Debug("Attempting to parse episode info using directory name. {0}", fileInfo.Directory.Name);
result = ParseMovieTitle(fileInfo.Directory.Name + fileInfo.Extension);
}
return result;
}
public static ParsedMovieInfo ParseMovieTitle(string title)
{

View File

@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Parser
LocalEpisode GetLocalEpisode(string filename, Series series);
LocalEpisode GetLocalEpisode(string filename, Series series, ParsedEpisodeInfo folderInfo, bool sceneSource);
LocalMovie GetLocalMovie(string filename, Movie movie);
LocalMovie GetLocalMovie(string filename, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource);
LocalMovie GetLocalMovie(string filename, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource);
Series GetSeries(string title);
Movie GetMovie(string title);
RemoteEpisode Map(ParsedEpisodeInfo parsedEpisodeInfo, int tvdbId, int tvRageId, SearchCriteriaBase searchCriteria = null);
@@ -120,26 +120,26 @@ namespace NzbDrone.Core.Parser
return GetLocalMovie(filename, movie, null, false);
}
public LocalMovie GetLocalMovie(string filename, Movie movie, ParsedEpisodeInfo folderInfo, bool sceneSource)
public LocalMovie GetLocalMovie(string filename, Movie movie, ParsedMovieInfo folderInfo, bool sceneSource)
{
ParsedEpisodeInfo parsedEpisodeInfo;
ParsedMovieInfo parsedMovieInfo;
if (folderInfo != null)
{
parsedEpisodeInfo = folderInfo.JsonClone();
parsedEpisodeInfo.Quality = QualityParser.ParseQuality(Path.GetFileName(filename));
parsedMovieInfo = folderInfo.JsonClone();
parsedMovieInfo.Quality = QualityParser.ParseQuality(Path.GetFileName(filename));
}
else
{
parsedEpisodeInfo = Parser.ParsePath(filename);
parsedMovieInfo = Parser.ParseMoviePath(filename);
}
if (parsedEpisodeInfo == null)
if (parsedMovieInfo == null)
{
if (MediaFileExtensions.Extensions.Contains(Path.GetExtension(filename)))
{
_logger.Warn("Unable to parse episode info from path {0}", filename);
_logger.Warn("Unable to parse movie info from path {0}", filename);
}
return null;
@@ -148,9 +148,9 @@ namespace NzbDrone.Core.Parser
return new LocalMovie
{
Movie = movie,
Quality = parsedEpisodeInfo.Quality,
Quality = parsedMovieInfo.Quality,
Path = filename,
ParsedEpisodeInfo = parsedEpisodeInfo,
ParsedMovieInfo = parsedMovieInfo,
ExistingFile = movie.Path.IsParentPath(filename)
};
}
@@ -192,6 +192,11 @@ namespace NzbDrone.Core.Parser
parsedEpisodeInfo.MovieTitleInfo.Year);
}
if (series == null)
{
series = _movieService.FindByTitle(parsedEpisodeInfo.MovieTitle.Replace("DC", "").Trim());
}
return series;
}

View File

@@ -48,6 +48,9 @@ namespace NzbDrone.Core.Tv
public LazyLoaded<MovieFile> MovieFile { get; set; }
public int MovieFileId { get; set; }
public List<string> AlternativeTitles { get; set; }
public bool HasFile => MovieFileId > 0;
public override string ToString()
{
return string.Format("[{0}][{1}]", ImdbId, Title.NullSafe());

View File

@@ -13,6 +13,7 @@ namespace NzbDrone.Core.Tv
Movie FindByTitle(string cleanTitle);
Movie FindByTitle(string cleanTitle, int year);
Movie FindByImdbId(string imdbid);
Movie FindByTitleSlug(string slug);
List<Movie> GetMoviesByFileId(int fileId);
void SetFileId(int fileId, int movieId);
}
@@ -62,11 +63,11 @@ namespace NzbDrone.Core.Tv
cleanNum = cleanNum.Replace(roman, num);
}
var result = Query.Where(s => s.CleanTitle == cleanTitle).SingleOrDefault();
var result = Query.Where(s => s.CleanTitle == cleanTitle).FirstOrDefault();
if (result == null)
{
result = Query.Where(s => s.CleanTitle == cleanNum).OrWhere(s => s.CleanTitle == cleanRoman).SingleOrDefault();
result = Query.Where(s => s.CleanTitle == cleanNum).OrWhere(s => s.CleanTitle == cleanRoman).FirstOrDefault();
if (result == null)
{
@@ -74,7 +75,7 @@ namespace NzbDrone.Core.Tv
result = movies.Where(m => m.AlternativeTitles.Any(t => Parser.Parser.CleanSeriesTitle(t.ToLower()) == cleanTitle ||
Parser.Parser.CleanSeriesTitle(t.ToLower()) == cleanRoman ||
Parser.Parser.CleanSeriesTitle(t.ToLower()) == cleanNum)).SingleOrDefault();
Parser.Parser.CleanSeriesTitle(t.ToLower()) == cleanNum)).FirstOrDefault();
return result;
}
@@ -114,5 +115,9 @@ namespace NzbDrone.Core.Tv
SetFields(new Movie { Id = episodeId, MovieFileId = fileId }, movie => movie.MovieFileId);
}
public Movie FindByTitleSlug(string slug)
{
return Query.Where(m => m.TitleSlug == slug).FirstOrDefault();
}
}
}

View File

@@ -24,6 +24,7 @@ namespace NzbDrone.Core.Tv
Movie FindByTitle(string title);
Movie FindByTitle(string title, int year);
Movie FindByTitleInexact(string title);
Movie FindByTitleSlug(string slug);
Movie GetMovieByFileId(int fileId);
void DeleteMovie(int movieId, bool deleteFiles);
List<Movie> GetAllMovies();
@@ -218,5 +219,10 @@ namespace NzbDrone.Core.Tv
{
return _movieRepository.GetMoviesByFileId(fileId).First();
}
public Movie FindByTitleSlug(string slug)
{
return _movieRepository.FindByTitleSlug(slug);
}
}
}

View File

@@ -2,7 +2,7 @@ var Marionette = require('marionette');
var Backgrid = require('backgrid');
var HistoryCollection = require('./HistoryCollection');
var EventTypeCell = require('../../Cells/EventTypeCell');
var MovieTitleCell = require('../../Cells/MovieTitleCell');
var MovieTitleCell = require('../../Cells/MovieTitleHistoryCell');
var EpisodeNumberCell = require('../../Cells/EpisodeNumberCell');
var EpisodeTitleCell = require('../../Cells/EpisodeTitleCell');
var HistoryQualityCell = require('./HistoryQualityCell');
@@ -31,7 +31,7 @@ module.exports = Marionette.Layout.extend({
{
name : 'movies',
label : 'Movie Title',
cell : MovieTitleCell
cell : MovieTitleCell,
},
/*{
name : 'episode',

View File

@@ -52,7 +52,7 @@
{{> ProfileSelectionPartial profiles}}
</div>
<div class="form-group col-md-2">
{{!--<div class="form-group col-md-2">
<label>Season Folders</label>
<div class="input-group">
@@ -65,7 +65,7 @@
<div class="btn btn-primary slide-button"/>
</label>
</div>
</div>
</div>--}}
{{/unless}}
{{#unless existing}}

View File

@@ -33,7 +33,7 @@ module.exports = NzbDroneCell.extend({
},
_editSeries : function() {
vent.trigger(vent.Commands.EditSeriesCommand, { series : this.model });
vent.trigger(vent.Commands.EditMovieCommand, { movie : this.model });
},
_refreshSeries : function() {

View File

@@ -4,8 +4,4 @@ module.exports = TemplatedCell.extend({
className : 'series-title-cell',
template : 'Cells/SeriesTitleTemplate',
render : function() {
this.$el.html(this.model.get("movie").get("title")); //Hack, but somehow handlebar helper does not work.
return this;
}
});

View File

@@ -1,6 +0,0 @@
var TemplatedCell = require('./TemplatedCell');
module.exports = TemplatedCell.extend({
className : 'series-title-cell',
template : 'Cells/SeriesTitleTemplate',
});

View File

@@ -0,0 +1,14 @@
var TemplatedCell = require('./TemplatedCell');
module.exports = TemplatedCell.extend({
className : 'series-title-cell',
template : 'Cells/SeriesTitleTemplate',
render : function() {
this.$el.html(this.model.get("movie").get("title")); //Hack, but somehow handlebar helper does not work.
debugger;
return this;
}
});

View File

@@ -11,6 +11,7 @@ var ReleaseLayout = require('./Release/ReleaseLayout');
var SystemLayout = require('./System/SystemLayout');
var SeasonPassLayout = require('./SeasonPass/SeasonPassLayout');
var SeriesEditorLayout = require('./Series/Editor/SeriesEditorLayout');
var MovieEditorLayout = require('./Movies/Editor/MovieEditorLayout');
module.exports = NzbDroneController.extend({
addSeries : function(action) {
@@ -61,5 +62,10 @@ module.exports = NzbDroneController.extend({
seriesEditor : function() {
this.setTitle('Series Editor');
this.showMainRegion(new SeriesEditorLayout());
},
movieEditor : function() {
this.setTitle('Movie Editor');
this.showMainRegion(new MovieEditorLayout());
}
});

View File

@@ -97,7 +97,7 @@ module.exports = Marionette.Layout.extend({
CommandController.bindToCommand({
element : this.ui.rename,
command : {
name : 'renameFiles',
name : 'renameMovieFiles',
movieId : this.model.id,
seasonNumber : -1
}
@@ -237,7 +237,7 @@ module.exports = Marionette.Layout.extend({
},
_commandComplete : function(options) {
if (options.command.get('name') === 'renamefiles') {
if (options.command.get('name') === 'renameMoviefiles') {
if (options.command.get('moviesId') === this.model.get('id')) {
this._refresh();
}

View File

@@ -15,7 +15,7 @@
<i class="icon-sonarr-refresh icon-can-spin" title="Update movie info and scan disk"/>
</div>
<div class="x-rename">
<i class="icon-sonarr-rename" title="Preview rename for all episodes"/>
<i class="icon-sonarr-rename" title="Preview rename for movie"/>
</div>
<div class="x-search">
<i class="icon-sonarr-search" title="Search for movie"/>

View File

@@ -0,0 +1,126 @@
var _ = require('underscore');
var Marionette = require('marionette');
var vent = require('vent');
var Profiles = require('../../Profile/ProfileCollection');
var RootFolders = require('../../AddMovies/RootFolders/RootFolderCollection');
var RootFolderLayout = require('../../AddMovies/RootFolders/RootFolderLayout');
var UpdateFilesMoviesView = require('./Organize/OrganizeFilesView');
var Config = require('../../Config');
module.exports = Marionette.ItemView.extend({
template : 'Movies/Editor/MovieEditorFooterViewTemplate',
ui : {
monitored : '.x-monitored',
profile : '.x-profiles',
seasonFolder : '.x-season-folder',
rootFolder : '.x-root-folder',
selectedCount : '.x-selected-count',
container : '.series-editor-footer',
actions : '.x-action'
},
events : {
'click .x-save' : '_updateAndSave',
'change .x-root-folder' : '_rootFolderChanged',
'click .x-organize-files' : '_organizeFiles'
},
templateHelpers : function() {
return {
profiles : Profiles,
rootFolders : RootFolders.toJSON()
};
},
initialize : function(options) {
this.moviesCollection = options.collection;
RootFolders.fetch().done(function() {
RootFolders.synced = true;
});
this.editorGrid = options.editorGrid;
this.listenTo(this.moviesCollection, 'backgrid:selected', this._updateInfo);
this.listenTo(RootFolders, 'all', this.render);
},
onRender : function() {
this._updateInfo();
},
_updateAndSave : function() {
var selected = this.editorGrid.getSelectedModels();
var monitored = this.ui.monitored.val();
var profile = this.ui.profile.val();
var seasonFolder = this.ui.seasonFolder.val();
var rootFolder = this.ui.rootFolder.val();
_.each(selected, function(model) {
if (monitored === 'true') {
model.set('monitored', true);
} else if (monitored === 'false') {
model.set('monitored', false);
}
if (profile !== 'noChange') {
model.set('profileId', parseInt(profile, 10));
}
if (seasonFolder === 'true') {
model.set('seasonFolder', true);
} else if (seasonFolder === 'false') {
model.set('seasonFolder', false);
}
if (rootFolder !== 'noChange') {
var rootFolderPath = RootFolders.get(parseInt(rootFolder, 10));
model.set('rootFolderPath', rootFolderPath.get('path'));
}
model.edited = true;
});
this.moviesCollection.save();
},
_updateInfo : function() {
var selected = this.editorGrid.getSelectedModels();
var selectedCount = selected.length;
this.ui.selectedCount.html('{0} movies selected'.format(selectedCount));
if (selectedCount === 0) {
this.ui.actions.attr('disabled', 'disabled');
} else {
this.ui.actions.removeAttr('disabled');
}
},
_rootFolderChanged : function() {
var rootFolderValue = this.ui.rootFolder.val();
if (rootFolderValue === 'addNew') {
var rootFolderLayout = new RootFolderLayout();
this.listenToOnce(rootFolderLayout, 'folderSelected', this._setRootFolder);
vent.trigger(vent.Commands.OpenModalCommand, rootFolderLayout);
} else {
Config.setValue(Config.Keys.DefaultRootFolderId, rootFolderValue);
}
},
_setRootFolder : function(options) {
vent.trigger(vent.Commands.CloseModalCommand);
this.ui.rootFolder.val(options.model.id);
this._rootFolderChanged();
},
_organizeFiles : function() {
var selected = this.editorGrid.getSelectedModels();
var updateFilesMoviesView = new UpdateFilesMoviesView({ movies : selected });
this.listenToOnce(updateFilesMoviesView, 'updatingFiles', this._afterSave);
vent.trigger(vent.Commands.OpenModalCommand, updateFilesMoviesView);
}
});

View File

@@ -0,0 +1,54 @@
<div class="series-editor-footer">
<div class="row">
<div class="form-group col-md-2">
<label>Monitored</label>
<select class="form-control x-action x-monitored">
<option value="noChange">No change</option>
<option value="true">Monitored</option>
<option value="false">Unmonitored</option>
</select>
</div>
<div class="form-group col-md-2">
<label>Profile</label>
<select class="form-control x-action x-profiles">
<option value="noChange">No change</option>
{{#each profiles.models}}
<option value="{{id}}">{{attributes.name}}</option>
{{/each}}
</select>
</div>
{{!--<div class="form-group col-md-2">
<label>Season Folder</label>
<select class="form-control x-action x-season-folder">
<option value="noChange">No change</option>
<option value="true">Yes</option>
<option value="false">No</option>
</select>
</div>--}}
<div class="form-group col-md-3">
<label>Root Folder</label>
<select class="form-control x-action x-root-folder" validation-name="RootFolderPath">
<option value="noChange">No change</option>
{{#each rootFolders}}
<option value="{{id}}">{{path}}</option>
{{/each}}
<option value="addNew">Add a different path</option>
</select>
</div>
<div class="form-group col-md-3 actions">
<label class="x-selected-count">0 movies selected</label>
<div>
<button class="btn btn-primary x-action x-save">Save</button>
<button class="btn btn-danger x-action x-organize-files" title="Organize and rename movie files">Organize</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,153 @@
var vent = require('vent');
var Marionette = require('marionette');
var Backgrid = require('backgrid');
var EmptyView = require('../Index/EmptyView');
var MoviesCollection = require('../MoviesCollection');
var MovieTitleCell = require('../../Cells/MovieTitleCell');
var ProfileCell = require('../../Cells/ProfileCell');
var SelectAllCell = require('../../Cells/SelectAllCell');
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
var FooterView = require('./MovieEditorFooterView');
require('../../Mixins/backbone.signalr.mixin');
module.exports = Marionette.Layout.extend({
template : 'Movies/Editor/MovieEditorLayoutTemplate',
regions : {
seriesRegion : '#x-series-editor',
toolbar : '#x-toolbar'
},
ui : {
monitored : '.x-monitored',
profiles : '.x-profiles',
rootFolder : '.x-root-folder',
selectedCount : '.x-selected-count'
},
events : {
'click .x-save' : '_updateAndSave',
'change .x-root-folder' : '_rootFolderChanged'
},
columns : [
{
name : '',
cell : SelectAllCell,
headerCell : 'select-all',
sortable : false
},
{
name : 'title',
label : 'Title',
cell : MovieTitleCell,
cellValue : 'this'
},
{
name : 'profileId',
label : 'Profile',
cell : ProfileCell
},
{
name : 'path',
label : 'Path',
cell : 'string'
}
],
leftSideButtons : {
type : 'default',
storeState : false,
items : [
{
title : 'Update Library',
icon : 'icon-sonarr-refresh',
command : 'refreshseries',
successMessage : 'Library was updated!',
errorMessage : 'Library update failed!'
}
]
},
initialize : function() {
this.movieCollection = MoviesCollection.clone();
this.movieCollection.shadowCollection.bindSignalR();
this.listenTo(this.movieCollection, 'save', this.render);
this.filteringOptions = {
type : 'radio',
storeState : true,
menuKey : 'serieseditor.filterMode',
defaultAction : 'all',
items : [
{
key : 'all',
title : '',
tooltip : 'All',
icon : 'icon-sonarr-all',
callback : this._setFilter
},
{
key : 'monitored',
title : '',
tooltip : 'Monitored Only',
icon : 'icon-sonarr-monitored',
callback : this._setFilter
}
]
};
},
onRender : function() {
this._showToolbar();
this._showTable();
},
onClose : function() {
vent.trigger(vent.Commands.CloseControlPanelCommand);
},
_showTable : function() {
if (this.movieCollection.shadowCollection.length === 0) {
this.seriesRegion.show(new EmptyView());
this.toolbar.close();
return;
}
this.columns[0].sortedCollection = this.movieCollection;
this.editorGrid = new Backgrid.Grid({
collection : this.movieCollection,
columns : this.columns,
className : 'table table-hover'
});
this.seriesRegion.show(this.editorGrid);
this._showFooter();
},
_showToolbar : function() {
this.toolbar.show(new ToolbarLayout({
left : [
this.leftSideButtons
],
right : [
this.filteringOptions
],
context : this
}));
},
_showFooter : function() {
vent.trigger(vent.Commands.OpenControlPanelCommand, new FooterView({
editorGrid : this.editorGrid,
collection : this.movieCollection
}));
},
_setFilter : function(buttonContext) {
var mode = buttonContext.model.get('key');
this.movieCollection.setFilterMode(mode);
}
});

View File

@@ -0,0 +1,7 @@
<div id="x-toolbar"></div>
<div class="row">
<div class="col-md-12">
<div id="x-series-editor" class="table-responsive"></div>
</div>
</div>

View File

@@ -0,0 +1,33 @@
var _ = require('underscore');
var vent = require('vent');
var Backbone = require('backbone');
var Marionette = require('marionette');
var CommandController = require('../../../Commands/CommandController');
module.exports = Marionette.ItemView.extend({
template : 'Movies/Editor/Organize/OrganizeFilesViewTemplate',
events : {
'click .x-confirm-organize' : '_organize'
},
initialize : function(options) {
this.movies = options.movies;
this.templateHelpers = {
numberOfMovies : this.movies.length,
movies : new Backbone.Collection(this.movies).toJSON()
};
},
_organize : function() {
var movieIds = _.pluck(this.movies, 'id');
CommandController.Execute('renameMovie', {
name : 'renameMovie',
movieIds : movieIds
});
this.trigger('organizingFiles');
vent.trigger(vent.Commands.CloseModalCommand);
}
});

View File

@@ -0,0 +1,25 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Organize Selected Movies</h3>
</div>
<div class="modal-body update-files-series-modal">
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">&times;</button>
Tip: To preview a rename... select "Cancel" then any movie title and use the <i data-original-title="" class="icon-sonarr-rename" title=""></i>
</div>
Are you sure you want to update all files in the {{numberOfMovies}} selected movies?
{{debug}}
<ul class="selected-series">
{{#each movie}}
<li>{{title}}</li>
{{/each}}
</ul>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">Cancel</button>
<button class="btn btn-danger x-confirm-organize">Organize</button>
</div>
</div>

View File

@@ -1,24 +1,24 @@
<div class="row">
<div class="series-legend legend col-xs-6 col-sm-4">
<ul class='legend-labels'>
<li><span class="progress-bar"></span>Continuing (All episodes downloaded)</li>
<li><span class="progress-bar-success"></span>Ended (All episodes downloaded)</li>
<li><span class="progress-bar-danger"></span>Missing Episodes (Series monitored)</li>
<li><span class="progress-bar-warning"></span>Missing Episodes (Series not monitored)</li>
<li><span class="progress-bar"></span>Missing, but not yet available.</li>
<li><span class="progress-bar-success"></span>Downloaded and imported.</li>
<li><span class="progress-bar-danger"></span>Missing and monitored.</li>
<li><span class="progress-bar-warning"></span>Missing, but not monitored.</li>
</ul>
</div>
<div class="col-xs-5 col-sm-7">
<div class="row">
<div class="series-stats col-sm-4">
<dl class="dl-horizontal">
<dt>Series</dt>
<dt>Movies</dt>
<dd>{{series}}</dd>
<dt>Ended</dt>
<dd>{{ended}}</dd>
<dt>Released</dt>
<dd>{{released}}</dd>
<dt>Continuing</dt>
<dd>{{continuing}}</dd>
<dt>Announced</dt>
<dd>{{announced}}</dd>
</dl>
</div>

View File

@@ -6,7 +6,7 @@ var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
var EmptyView = require('./EmptyView');
var MoviesCollection = require('../MoviesCollection');
var InCinemasCell = require('../../Cells/InCinemasCell');
var MovieTitleCell = require('../../Cells/MovieTitleCell2');
var MovieTitleCell = require('../../Cells/MovieTitleCell');
var TemplatedCell = require('../../Cells/TemplatedCell');
var ProfileCell = require('../../Cells/ProfileCell');
var MovieLinksCell = require('../../Cells/MovieLinksCell');
@@ -80,14 +80,9 @@ module.exports = Marionette.Layout.extend({
route : 'addmovies'
},
{
title : 'Season Pass',
icon : 'icon-sonarr-monitored',
route : 'seasonpass'
},
{
title : 'Series Editor',
title : 'Movie Editor',
icon : 'icon-sonarr-edit',
route : 'serieseditor'
route : 'movieeditor'
},
{
title : 'RSS Sync',
@@ -286,18 +281,18 @@ module.exports = Marionette.Layout.extend({
var series = MoviesCollection.models.length;
var episodes = 0;
var episodeFiles = 0;
var ended = 0;
var continuing = 0;
var announced = 0;
var released = 0;
var monitored = 0;
_.each(MoviesCollection.models, function(model) {
episodes += model.get('episodeCount');
episodeFiles += model.get('episodeFileCount');
if (model.get('status').toLowerCase() === 'ended') {
ended++;
if (model.get('status').toLowerCase() === 'released') {
released++;
} else {
continuing++;
announced++;
}
if (model.get('monitored')) {
@@ -307,9 +302,9 @@ module.exports = Marionette.Layout.extend({
footerModel.set({
series : series,
ended : ended,
continuing : continuing,
monitored : monitored,
released : released,
announced : announced,
monitored : monitored,
unmonitored : series - monitored,
episodes : episodes,
episodeFiles : episodeFiles

View File

@@ -1,3 +1,38 @@
// var Backbone = require('backbone');
// var RenamePreviewModel = require('./RenamePreviewModel');
// module.exports = Backbone.Collection.extend({
// url : window.NzbDrone.ApiRoot + '/rename',
// model : RenamePreviewModel,
// originalFetch : Backbone.Collection.prototype.fetch,
// initialize : function(options) {
// if (!options.seriesId) {
// throw 'seriesId is required';
// }
// this.seriesId = options.seriesId;
// this.seasonNumber = options.seasonNumber;
// },
// fetch : function(options) {
// if (!this.seriesId) {
// throw 'seriesId is required';
// }
// options = options || {};
// options.data = {};
// options.data.seriesId = this.seriesId;
// if (this.seasonNumber !== undefined) {
// options.data.seasonNumber = this.seasonNumber;
// }
// return this.originalFetch.call(this, options);
// }
// });
var Backbone = require('backbone');
var RenamePreviewModel = require('./RenamePreviewModel');
@@ -8,26 +43,26 @@ module.exports = Backbone.Collection.extend({
originalFetch : Backbone.Collection.prototype.fetch,
initialize : function(options) {
if (!options.seriesId) {
throw 'seriesId is required';
if (!options.movieId) {
throw 'movieId is required';
}
this.seriesId = options.seriesId;
this.seasonNumber = options.seasonNumber;
this.movieId = options.movieId;
//this.seasonNumber = options.seasonNumber;
},
fetch : function(options) {
if (!this.seriesId) {
throw 'seriesId is required';
if (!this.movieId) {
throw 'movieId is required';
}
options = options || {};
options.data = {};
options.data.seriesId = this.seriesId;
options.data.movieId = this.movieId;
if (this.seasonNumber !== undefined) {
options.data.seasonNumber = this.seasonNumber;
}
// if (this.seasonNumber !== undefined) {
// options.data.seasonNumber = this.seasonNumber;
//}
return this.originalFetch.call(this, options);
}

View File

@@ -29,12 +29,13 @@ module.exports = Marionette.Layout.extend({
},
initialize : function(options) {
this.model = options.series;
this.model = options.movie;
this.seasonNumber = options.seasonNumber;
var viewOptions = {};
viewOptions.seriesId = this.model.id;
viewOptions.seasonNumber = this.seasonNumber;
//viewOptions.seriesId = this.model.id;
//viewOptions.seasonNumber = this.seasonNumber;
viewOptions.movieId = this.model.id;
this.collection = new RenamePreviewCollection(viewOptions);
this.listenTo(this.collection, 'sync', this._showPreviews);
@@ -66,7 +67,8 @@ module.exports = Marionette.Layout.extend({
}
var files = _.map(this.collection.where({ rename : true }), function(model) {
return model.get('episodeFileId');
//return model.get('episodeFileId');
return model.get('movieFileId');
});
if (files.length === 0) {
@@ -74,21 +76,11 @@ module.exports = Marionette.Layout.extend({
return;
}
if (this.seasonNumber) {
CommandController.Execute('renameFiles', {
name : 'renameFiles',
seriesId : this.model.id,
seasonNumber : this.seasonNumber,
files : files
});
} else {
CommandController.Execute('renameFiles', {
name : 'renameFiles',
seriesId : this.model.id,
seasonNumber : -1,
files : files
});
}
CommandController.Execute('renameMovieFiles', {
name : 'renameMovieFiles',
movieId : this.model.id,
files : files
});
vent.trigger(vent.Commands.CloseModalCommand);
},

View File

@@ -21,7 +21,7 @@ module.exports = Marionette.AppRouter.extend({
'system' : 'system',
'system/:action' : 'system',
'seasonpass' : 'seasonPass',
'serieseditor' : 'seriesEditor',
'movieeditor' : 'movieEditor',
':whatever' : 'showNotFound'
}
});

View File

@@ -3,26 +3,25 @@
<dl class="dl-horizontal info">
<dt>Home page</dt>
<dd><a href="https://sonarr.tv/">sonarr.tv</a></dd>
<dd><a href="https://radarr.tdb/">radarr.tdb</a></dd>
<dt>Wiki</dt>
<dd><a href="https://wiki.sonarr.tv/">wiki.sonarr.tv</a></dd>
<dd><a href="https://wiki.radarr.tdb/">wiki.radarr.tdb</a></dd>
<dt>Forums</dt>
<!-- <dt>Forums</dt>
<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>
<dt>Twitter</dt>
<dd><a href="https://twitter.com/sonarrtv">@sonarrtv</a></dd>
<dt>IRC</dt>
<dd><a href="irc://irc.freenode.net/#sonarr">#sonarr on Freenode</a> or (<a href="http://webchat.freenode.net/?channels=#sonarr">webchat</a>)</dd>
<dd><a href="irc://irc.freenode.net/#sonarr">#sonarr on Freenode</a> or (<a href="http://webchat.freenode.net/?channels=#sonarr">webchat</a>)</dd>-->
<dt>Source</dt>
<dd><a href="https://github.com/Sonarr/Sonarr/">github.com/Sonarr/Sonarr</a></dd>
<dd><a href="https://github.com/galli-leo/Radarr/">github.com/galli-leo/Radarr</a></dd>
<dt>Feature Requests</dt>
<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>
<dd><a href="https://github.com/Sonarr/Sonarr/issues">github.com/Sonarr/Sonarr/issues</a> <b>(Please post issues on the forum first and not on github)</b></dd>
<!--<dd><a href="https://forums.sonarr.tv/">forums.sonarr.tv</a></dd>-->
<dd><a href="https://github.com/galli-leo/Radarr/issues">github.com/galli-leo/Radarr/issues</a></dd>
</dl>
</fieldset>