mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 06:45:19 -07:00
Merge branch 'develop' into MovieEditorFixes
This commit is contained in:
commit
d03ee006fc
8 changed files with 565 additions and 515 deletions
|
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
|||
{
|
||||
if (retries == 5)
|
||||
{
|
||||
throw new DownloadClientException("Try to process same request more than 5 times");
|
||||
throw new DownloadClientException("Try to process request to {0} with {1} more than 5 times", api, arguments.ToJson().ToString());
|
||||
}
|
||||
|
||||
if (!_authenticated && api != DiskStationApi.Info && api != DiskStationApi.DSMInfo)
|
||||
|
@ -72,14 +72,20 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation.Proxies
|
|||
}
|
||||
else
|
||||
{
|
||||
var msg = $"Failed to {operation}. Reason: {responseContent.Error.GetMessage(api)}";
|
||||
_logger.Error(msg);
|
||||
|
||||
if (responseContent.Error.SessionError)
|
||||
{
|
||||
_authenticated = false;
|
||||
return ProcessRequest<T>(api, arguments, settings, operation, method, retries++);
|
||||
|
||||
if (responseContent.Error.Code == 105)
|
||||
{
|
||||
throw new DownloadClientAuthenticationException(msg);
|
||||
}
|
||||
|
||||
var msg = $"Failed to {operation}. Reason: {responseContent.Error.GetMessage(api)}";
|
||||
_logger.Error(msg);
|
||||
return ProcessRequest<T>(api, arguments, settings, operation, method, ++retries);
|
||||
}
|
||||
|
||||
throw new DownloadClientException(msg);
|
||||
}
|
||||
|
|
|
@ -282,7 +282,17 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
|||
{
|
||||
try
|
||||
{
|
||||
var downloadDir = GetDownloadDirectory();
|
||||
var downloadDir = GetDefaultDir();
|
||||
|
||||
if (downloadDir == null)
|
||||
{
|
||||
return new NzbDroneValidationFailure(nameof(Settings.TvDirectory), "No default destination")
|
||||
{
|
||||
DetailedDescription = $"You must login into your Diskstation as {Settings.Username} and manually set it up into DownloadStation settings under BT/HTTP/FTP/NZB -> Location."
|
||||
};
|
||||
}
|
||||
|
||||
downloadDir = GetDownloadDirectory();
|
||||
|
||||
if (downloadDir != null)
|
||||
{
|
||||
|
@ -295,7 +305,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
|||
{
|
||||
return new NzbDroneValidationFailure(fieldName, $"Shared folder does not exist")
|
||||
{
|
||||
DetailedDescription = $"The DownloadStation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?"
|
||||
DetailedDescription = $"The Diskstation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?"
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -310,6 +320,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
|||
|
||||
return null;
|
||||
}
|
||||
catch (DownloadClientAuthenticationException ex) // User could not have permission to access to downloadstation
|
||||
{
|
||||
_logger.Error(ex);
|
||||
return new NzbDroneValidationFailure(string.Empty, ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex);
|
||||
|
|
|
@ -195,7 +195,17 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
|||
{
|
||||
try
|
||||
{
|
||||
var downloadDir = GetDownloadDirectory();
|
||||
var downloadDir = GetDefaultDir();
|
||||
|
||||
if (downloadDir == null)
|
||||
{
|
||||
return new NzbDroneValidationFailure(nameof(Settings.TvDirectory), "No default destination")
|
||||
{
|
||||
DetailedDescription = $"You must login into your Diskstation as {Settings.Username} and manually set it up into DownloadStation settings under BT/HTTP/FTP/NZB -> Location."
|
||||
};
|
||||
}
|
||||
|
||||
downloadDir = GetDownloadDirectory();
|
||||
|
||||
if (downloadDir != null)
|
||||
{
|
||||
|
@ -208,7 +218,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
|||
{
|
||||
return new NzbDroneValidationFailure(fieldName, $"Shared folder does not exist")
|
||||
{
|
||||
DetailedDescription = $"The DownloadStation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?"
|
||||
DetailedDescription = $"The Diskstation does not have a Shared Folder with the name '{sharedFolder}', are you sure you specified it correctly?"
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -223,6 +233,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
|
|||
|
||||
return null;
|
||||
}
|
||||
catch (DownloadClientAuthenticationException ex) // User could not have permission to access to downloadstation
|
||||
{
|
||||
_logger.Error(ex);
|
||||
return new NzbDroneValidationFailure(string.Empty, ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex);
|
||||
|
|
|
@ -36,42 +36,34 @@ namespace NzbDrone.Core.MediaFiles
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
public MovieFileMoveResult UpgradeMovieFile(MovieFile episodeFile, LocalMovie localEpisode, bool copyOnly = false)
|
||||
public MovieFileMoveResult UpgradeMovieFile(MovieFile movieFile, LocalMovie localMovie, bool copyOnly = false)
|
||||
{
|
||||
_logger.Trace("Upgrading existing episode file.");
|
||||
_logger.Trace("Upgrading existing movie file.");
|
||||
var moveFileResult = new MovieFileMoveResult();
|
||||
localEpisode.Movie.MovieFile.LazyLoad();
|
||||
var existingFile = localEpisode.Movie.MovieFile;
|
||||
existingFile.LazyLoad();
|
||||
|
||||
if (existingFile.IsLoaded && existingFile.Value != null)
|
||||
{
|
||||
var file = existingFile.Value;
|
||||
var episodeFilePath = Path.Combine(localEpisode.Movie.Path, file.RelativePath);
|
||||
var existingFile = localMovie.Movie.MovieFile.Value;
|
||||
|
||||
if (_diskProvider.FileExists(episodeFilePath))
|
||||
if (existingFile != null)
|
||||
{
|
||||
_logger.Debug("Removing existing episode file: {0}", file);
|
||||
_recycleBinProvider.DeleteFile(episodeFilePath);
|
||||
var movieFilePath = Path.Combine(localMovie.Movie.Path, existingFile.RelativePath);
|
||||
|
||||
if (_diskProvider.FileExists(movieFilePath))
|
||||
{
|
||||
_logger.Debug("Removing existing movie file: {0}", existingFile);
|
||||
_recycleBinProvider.DeleteFile(movieFilePath);
|
||||
}
|
||||
|
||||
moveFileResult.OldFiles.Add(file);
|
||||
_mediaFileService.Delete(file, DeleteMediaFileReason.Upgrade);
|
||||
moveFileResult.OldFiles.Add(existingFile);
|
||||
_mediaFileService.Delete(existingFile, DeleteMediaFileReason.Upgrade);
|
||||
}
|
||||
else
|
||||
{
|
||||
//_logger.Warn("The existing movie file was not lazy loaded.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (copyOnly)
|
||||
{
|
||||
moveFileResult.MovieFile = _movieFileMover.CopyMovieFile(episodeFile, localEpisode);
|
||||
moveFileResult.MovieFile = _movieFileMover.CopyMovieFile(movieFile, localMovie);
|
||||
}
|
||||
else
|
||||
{
|
||||
moveFileResult.MovieFile= _movieFileMover.MoveMovieFile(episodeFile, localEpisode);
|
||||
moveFileResult.MovieFile = _movieFileMover.MoveMovieFile(movieFile, localMovie);
|
||||
}
|
||||
|
||||
return moveFileResult;
|
||||
|
|
|
@ -31,17 +31,17 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
{
|
||||
var movie = message.Movie;
|
||||
var remoteMovie = message.RemoteMovie;
|
||||
var releaseGroup = remoteMovie.ParsedMovieInfo.ReleaseGroup;
|
||||
var environmentVariables = new StringDictionary();
|
||||
|
||||
environmentVariables.Add("Radarr_EventType", "Grab");
|
||||
environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
|
||||
environmentVariables.Add("Radarr_Movie_Title", movie.Title);
|
||||
environmentVariables.Add("Radarr_Movie_ImdbId", movie.ImdbId.ToString());
|
||||
environmentVariables.Add("Radarr_Movie_ImdbId", movie.ImdbId);
|
||||
environmentVariables.Add("Radarr_Movie_TmdbId", movie.TmdbId.ToString());
|
||||
environmentVariables.Add("Radarr_Release_Title", remoteMovie.Release.Title);
|
||||
environmentVariables.Add("Radarr_Release_Indexer", remoteMovie.Release.Indexer);
|
||||
environmentVariables.Add("Radarr_Release_Size", remoteMovie.Release.Size.ToString());
|
||||
environmentVariables.Add("Radarr_Release_ReleaseGroup", releaseGroup);
|
||||
environmentVariables.Add("Radarr_Release_ReleaseGroup", remoteMovie.ParsedMovieInfo.ReleaseGroup ?? string.Empty);
|
||||
|
||||
ExecuteScript(environmentVariables);
|
||||
}
|
||||
|
@ -57,7 +57,8 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
|
||||
environmentVariables.Add("Radarr_Movie_Title", movie.Title);
|
||||
environmentVariables.Add("Radarr_Movie_Path", movie.Path);
|
||||
environmentVariables.Add("Radarr_Movie_ImdbId", movie.ImdbId.ToString());
|
||||
environmentVariables.Add("Radarr_Movie_ImdbId", movie.ImdbId);
|
||||
environmentVariables.Add("Radarr_Movie_TmdbId", movie.TmdbId.ToString());
|
||||
environmentVariables.Add("Radarr_MovieFile_Id", movieFile.Id.ToString());
|
||||
environmentVariables.Add("Radarr_MovieFile_RelativePath", movieFile.RelativePath);
|
||||
environmentVariables.Add("Radarr_MovieFile_Path", Path.Combine(movie.Path, movieFile.RelativePath));
|
||||
|
@ -79,7 +80,9 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
|||
environmentVariables.Add("Radarr_Movie_Id", movie.Id.ToString());
|
||||
environmentVariables.Add("Radarr_Movie_Title", movie.Title);
|
||||
environmentVariables.Add("Radarr_Movie_Path", movie.Path);
|
||||
environmentVariables.Add("Radarr_Movie_TvdbId", movie.ImdbId.ToString());
|
||||
environmentVariables.Add("Radarr_Movie_ImdbId", movie.ImdbId);
|
||||
environmentVariables.Add("Radarr_Movie_TmdbId", movie.TmdbId.ToString());
|
||||
|
||||
ExecuteScript(environmentVariables);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,12 @@ var PosterCollectionView = require('./Posters/SeriesPostersCollectionView');
|
|||
var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
|
||||
var EmptyView = require('./EmptyView');
|
||||
var MoviesCollection = require('../MoviesCollection');
|
||||
|
||||
var FullMovieCollection = require('../FullMovieCollection');
|
||||
var InCinemasCell = require('../../Cells/InCinemasCell');
|
||||
|
||||
var RelativeDateCell = require('../../Cells/RelativeDateCell');
|
||||
|
||||
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
||||
var TemplatedCell = require('../../Cells/TemplatedCell');
|
||||
var ProfileCell = require('../../Cells/ProfileCell');
|
||||
|
@ -52,6 +56,11 @@ module.exports = Marionette.Layout.extend({
|
|||
cell : MovieTitleCell,
|
||||
cellValue : 'this',
|
||||
},
|
||||
{
|
||||
name : 'added',
|
||||
label : 'Date Added',
|
||||
cell : RelativeDateCell
|
||||
},
|
||||
{
|
||||
name : "downloadedQuality",
|
||||
label : "Downloaded",
|
||||
|
@ -66,7 +75,7 @@ module.exports = Marionette.Layout.extend({
|
|||
{
|
||||
name : 'inCinemas',
|
||||
label : 'In Cinemas',
|
||||
cell : InCinemasCell
|
||||
cell : RelativeDateCell
|
||||
},
|
||||
{
|
||||
name : 'this',
|
||||
|
|
|
@ -37,7 +37,9 @@
|
|||
<div class="col-md-8 col-xs-8">
|
||||
<span class="label label-default">{{GetStatus}}</span>
|
||||
|
||||
<span class="label label-default">{{ShortDate inCinemas}}</span>
|
||||
{{#if inCinemas}}
|
||||
<span class="label label-default">{{RelativeDate inCinemas}}</span>
|
||||
{{/if}}
|
||||
|
||||
{{profile profileId}}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ var MoviesCollection = require('./MoviesCollection');
|
|||
var FullMovieCollection = require("./FullMovieCollection");
|
||||
var MoviesIndexLayout = require('./Index/MoviesIndexLayout');
|
||||
var MoviesDetailsLayout = require('./Details/MoviesDetailsLayout');
|
||||
var SeriesDetailsLayout = require('../Series/Details/SeriesDetailsLayout');
|
||||
|
||||
module.exports = NzbDroneController.extend({
|
||||
_originalInit : NzbDroneController.prototype.initialize,
|
||||
|
@ -23,14 +22,23 @@ module.exports = NzbDroneController.extend({
|
|||
},
|
||||
|
||||
seriesDetails : function(query) {
|
||||
var series = FullMovieCollection.where({ titleSlug : query });
|
||||
if (series.length !== 0) {
|
||||
var targetMovie = series[0];
|
||||
console.log(AppLayout.mainRegion);
|
||||
|
||||
if(FullMovieCollection.length > 0) {
|
||||
this._renderMovieDetails(query);
|
||||
} else {
|
||||
this.listenTo(FullMovieCollection, 'sync', function(model, options) {
|
||||
this._renderMovieDetails(query);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_renderMovieDetails: function(query) {
|
||||
var movies = FullMovieCollection.where({ titleSlug : query });
|
||||
if (movies.length !== 0) {
|
||||
var targetMovie = movies[0];
|
||||
|
||||
this.setTitle(targetMovie.get('title'));
|
||||
//this.showNotFound();
|
||||
//this.showMainRegion(new SeriesDetailsLayout({model : targetMovie}));
|
||||
this.showMainRegion(new MoviesDetailsLayout({ model : targetMovie }));
|
||||
} else {
|
||||
this.showNotFound();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue