From 59c07cc5f3bfc9d8e8e7fc4569efcc0467290654 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Thu, 16 Mar 2017 18:43:06 -0400 Subject: [PATCH] Patch/onedr0p 3 16 17 (#1200) * clear localStorage on radarr update.. ya mon * Fix when movie folder is deleted from disk and keeps showing up as downloaded in radarr * Clear all UI localStorage items on update, set pageSize to what it needs to be. --- .../MediaFiles/DiskScanService.cs | 18 ++++++++++++++---- src/UI/Shared/NzbDroneController.js | 9 ++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index 2e124bee9..e78092576 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -44,6 +44,7 @@ namespace NzbDrone.Core.MediaFiles private readonly IMediaFileTableCleanupService _mediaFileTableCleanupService; private readonly IEventAggregator _eventAggregator; private readonly IMovieService _movieService; + private readonly IMovieFileRepository _movieFileRepository; private readonly Logger _logger; public DiskScanService(IDiskProvider diskProvider, @@ -55,6 +56,7 @@ namespace NzbDrone.Core.MediaFiles IMediaFileTableCleanupService mediaFileTableCleanupService, IEventAggregator eventAggregator, IMovieService movieService, + IMovieFileRepository movieFileRepository, Logger logger) { _diskProvider = diskProvider; @@ -66,6 +68,7 @@ namespace NzbDrone.Core.MediaFiles _mediaFileTableCleanupService = mediaFileTableCleanupService; _eventAggregator = eventAggregator; _movieService = movieService; + _movieFileRepository = movieFileRepository; _logger = logger; } @@ -136,14 +139,14 @@ namespace NzbDrone.Core.MediaFiles if (!_diskProvider.FolderExists(rootFolder)) { - _logger.Warn("Series' root folder ({0}) doesn't exist.", rootFolder); + _logger.Warn("Movies' root folder ({0}) doesn't exist.", rootFolder); _eventAggregator.PublishEvent(new MovieScanSkippedEvent(movie, MovieScanSkippedReason.RootFolderDoesNotExist)); return; } if (_diskProvider.GetDirectories(rootFolder).Empty()) { - _logger.Warn("Series' root folder ({0}) is empty.", rootFolder); + _logger.Warn("Movies' root folder ({0}) is empty.", rootFolder); _eventAggregator.PublishEvent(new MovieScanSkippedEvent(movie, MovieScanSkippedReason.RootFolderIsEmpty)); return; } @@ -155,13 +158,20 @@ namespace NzbDrone.Core.MediaFiles if (_configService.CreateEmptySeriesFolders && _diskProvider.FolderExists(rootFolder)) { - _logger.Debug("Creating missing series folder: {0}", movie.Path); + _logger.Debug("Creating missing movies folder: {0}", movie.Path); _diskProvider.CreateFolder(movie.Path); SetPermissions(movie.Path); } else { - _logger.Debug("Series folder doesn't exist: {0}", movie.Path); + // Delete Movie from MovieFiles + _movieFileRepository.Delete(movie.MovieFileId); + + // Update Movie + movie.MovieFileId = 0; + _movieService.UpdateMovie(movie); + + _logger.Debug("Movies folder doesn't exist: {0}", movie.Path); } _eventAggregator.PublishEvent(new MovieScanSkippedEvent(movie, MovieScanSkippedReason.MovieFolderDoesNotExist)); diff --git a/src/UI/Shared/NzbDroneController.js b/src/UI/Shared/NzbDroneController.js index 4eae5c9a6..a16b5aedf 100644 --- a/src/UI/Shared/NzbDroneController.js +++ b/src/UI/Shared/NzbDroneController.js @@ -3,6 +3,7 @@ var AppLayout = require('../AppLayout'); var Marionette = require('marionette'); var NotFoundView = require('./NotFoundView'); var Messenger = require('./Messenger'); +var Config = require('../Config'); module.exports = Marionette.AppRouter.extend({ initialize : function() { @@ -41,7 +42,7 @@ module.exports = Marionette.AppRouter.extend({ var label = window.location.pathname === window.NzbDrone.UrlBase + '/system/updates' ? 'Reload' : 'View Changes'; Messenger.show({ - message : 'Radarr has been updated', + message : 'Radarr has been updated, some UI configuration has been reset', hideAfter : 0, id : 'sonarrUpdated', actions : { @@ -54,6 +55,12 @@ module.exports = Marionette.AppRouter.extend({ } }); + // Only for pre-release development + var pageSize = Config.getValue("pageSize"); + window.localStorage.clear(); + Config.setValue("pageSize", pageSize); + // Remove above when out of pre-release :) + this.pendingUpdate = true; },