diff --git a/medusa/__main__.py b/medusa/__main__.py index db55f04627..4e246cf66d 100755 --- a/medusa/__main__.py +++ b/medusa/__main__.py @@ -643,6 +643,7 @@ def initialize(self, console_logging=True): app.PROCESS_METHOD = check_setting_str(app.CFG, 'General', 'process_method', 'copy' if app.KEEP_PROCESSED_DIR else 'move') app.DELRARCONTENTS = bool(check_setting_int(app.CFG, 'General', 'del_rar_contents', 0)) app.MOVE_ASSOCIATED_FILES = bool(check_setting_int(app.CFG, 'General', 'move_associated_files', 0)) + app.PROCESS_IF_FILE_SIZE_DIFFERENT = bool(check_setting_int(app.CFG, 'General', 'process_if_file_size_different', 0)) app.POSTPONE_IF_SYNC_FILES = bool(check_setting_int(app.CFG, 'General', 'postpone_if_sync_files', 1)) app.POSTPONE_IF_NO_SUBS = bool(check_setting_int(app.CFG, 'General', 'postpone_if_no_subs', 0)) app.SYNC_FILES = check_setting_list(app.CFG, 'General', 'sync_files', app.SYNC_FILES) @@ -1563,6 +1564,7 @@ def save_config(): new_config['General']['move_associated_files'] = int(app.MOVE_ASSOCIATED_FILES) new_config['General']['sync_files'] = app.SYNC_FILES new_config['General']['postpone_if_sync_files'] = int(app.POSTPONE_IF_SYNC_FILES) + new_config['General']['process_if_file_size_different'] = int(app.PROCESS_IF_FILE_SIZE_DIFFERENT) new_config['General']['postpone_if_no_subs'] = int(app.POSTPONE_IF_NO_SUBS) new_config['General']['nfo_rename'] = int(app.NFO_RENAME) new_config['General']['process_automatically'] = int(app.PROCESS_AUTOMATICALLY) diff --git a/medusa/app.py b/medusa/app.py index 151071edf7..24d27347fa 100644 --- a/medusa/app.py +++ b/medusa/app.py @@ -283,6 +283,7 @@ def __init__(self): self.PROCESS_METHOD = None self.DELRARCONTENTS = False self.MOVE_ASSOCIATED_FILES = False + self.PROCESS_IF_FILE_SIZE_DIFFERENT = False self.POSTPONE_IF_SYNC_FILES = True self.POSTPONE_IF_NO_SUBS = False self.NFO_RENAME = True diff --git a/medusa/post_processor.py b/medusa/post_processor.py index 589a0acf0e..beb45e641e 100644 --- a/medusa/post_processor.py +++ b/medusa/post_processor.py @@ -905,7 +905,7 @@ def _is_priority(self, old_ep_quality, new_ep_quality): return any([self.in_history, self.is_priority, self.manually_searched]) @staticmethod - def _should_process(current_quality, new_quality, allowed, preferred): + def _should_process(current_quality, new_quality, allowed, preferred, existing_file_status): """ Determine if a quality should be processed according to the quality system. @@ -918,6 +918,7 @@ def _should_process(current_quality, new_quality, allowed, preferred): :param new_quality: The new quality of the episode that is being processed :param allowed: Qualities that are allowed :param preferred: Qualities that are preferred + :param existing_file_status: PostProcessor enum with existing file status :return: Tuple with Boolean if the quality should be processed and String with reason if should process or not """ if new_quality in preferred: @@ -927,6 +928,8 @@ def _should_process(current_quality, new_quality, allowed, preferred): elif new_quality < current_quality: return False, 'New quality is lower than current Preferred. Ignoring quality' else: + if app.PROCESS_IF_FILE_SIZE_DIFFERENT and existing_file_status != PostProcessor.EXISTS_SAME: + return True, 'New size is different. Accepting quality' return False, 'New quality is equal than current Preferred. Ignoring quality' return True, 'New quality is Preferred' elif new_quality in allowed: @@ -939,6 +942,8 @@ def _should_process(current_quality, new_quality, allowed, preferred): elif new_quality < current_quality: return False, 'New quality is lower than current Allowed. Ignoring quality' else: + if app.PROCESS_IF_FILE_SIZE_DIFFERENT and existing_file_status != PostProcessor.EXISTS_SAME: + return True, 'New size is different. Accepting quality' return False, 'New quality is equal to current Allowed. Ignoring quality' else: return False, 'New quality is not in Allowed|Preferred. Ignoring quality' @@ -1081,7 +1086,8 @@ def process(self): (Quality.qualityStrings[new_ep_quality], Quality.qualityStrings[old_ep_quality])) should_process, should_process_reason = self._should_process(old_ep_quality, new_ep_quality, - allowed_qualities, preferred_qualities) + allowed_qualities, preferred_qualities, + existing_file_status) if not should_process: raise EpisodePostProcessingFailedException( u'File exists. Marking it unsafe to replace. Reason: {0}'.format(should_process_reason)) diff --git a/medusa/server/api/v2/config.py b/medusa/server/api/v2/config.py index 058bb61e40..a5335d372f 100644 --- a/medusa/server/api/v2/config.py +++ b/medusa/server/api/v2/config.py @@ -217,6 +217,7 @@ class ConfigHandler(BaseRequestHandler): 'postProcessing.deleteRarContent': BooleanField(app, 'DELRARCONTENTS'), 'postProcessing.unpack': BooleanField(app, 'UNPACK'), 'postProcessing.noDelete': BooleanField(app, 'NO_DELETE'), + 'postProcessing.processIfFileSizeDifferent': BooleanField(app, 'PROCESS_IF_FILE_SIZE_DIFFERENT'), 'postProcessing.postponeIfSyncFiles': BooleanField(app, 'POSTPONE_IF_SYNC_FILES'), 'postProcessing.autoPostprocessorFrequency': IntegerField(app, 'AUTOPOSTPROCESSOR_FREQUENCY'), 'postProcessing.airdateEpisodes': BooleanField(app, 'AIRDATE_EPISODES'), @@ -1127,6 +1128,7 @@ def data_postprocessing(): section_data['naming']['stripYear'] = bool(app.NAMING_STRIP_YEAR) section_data['showDownloadDir'] = app.TV_DOWNLOAD_DIR section_data['processAutomatically'] = bool(app.PROCESS_AUTOMATICALLY) + section_data['processIfFileSizeDifferent'] = bool(app.PROCESS_IF_FILE_SIZE_DIFFERENT) section_data['postponeIfSyncFiles'] = bool(app.POSTPONE_IF_SYNC_FILES) section_data['postponeIfNoSubs'] = bool(app.POSTPONE_IF_NO_SUBS) section_data['renameEpisodes'] = bool(app.RENAME_EPISODES) diff --git a/tests/apiv2/test_config.py b/tests/apiv2/test_config.py index 951f166fcd..653fbed6d4 100644 --- a/tests/apiv2/test_config.py +++ b/tests/apiv2/test_config.py @@ -374,6 +374,7 @@ def config_postprocessing(): section_data['naming']['stripYear'] = bool(app.NAMING_STRIP_YEAR) section_data['showDownloadDir'] = app.TV_DOWNLOAD_DIR section_data['processAutomatically'] = bool(app.PROCESS_AUTOMATICALLY) + section_data['processIfFileSizeDifferent'] = bool(app.PROCESS_IF_FILE_SIZE_DIFFERENT) section_data['postponeIfSyncFiles'] = bool(app.POSTPONE_IF_SYNC_FILES) section_data['postponeIfNoSubs'] = bool(app.POSTPONE_IF_NO_SUBS) section_data['renameEpisodes'] = bool(app.RENAME_EPISODES) diff --git a/themes-default/slim/package.json b/themes-default/slim/package.json index 2cb42e97fe..0145aba60a 100644 --- a/themes-default/slim/package.json +++ b/themes-default/slim/package.json @@ -55,7 +55,9 @@ "vue-snotify": "3.2.1", "vue-template-compiler": "2.6.11", "vue-truncate-collapsed": "2.1.0", - "vuex": "3.1.3" + "vuex": "3.1.3", + "yarn": "^1.22.4", + "yarn-cli": "^0.5.7" }, "devDependencies": { "@babel/core": "7.9.0", @@ -99,7 +101,7 @@ "timekeeper": "2.2.0", "vue-jest": "3.0.5", "vue-loader": "15.9.1", - "webpack": "4.42.1", + "webpack": "^4.42.1", "webpack-cli": "3.3.11" }, "stylelint": { diff --git a/themes-default/slim/src/components/config-post-processing.vue b/themes-default/slim/src/components/config-post-processing.vue index 6afac331b2..f378912e61 100644 --- a/themes-default/slim/src/components/config-post-processing.vue +++ b/themes-default/slim/src/components/config-post-processing.vue @@ -86,6 +86,16 @@ +
+ +
+ + If a download is of the same existing quality but file sizes are different, process anyhow. +
+
+