Commit db39bd2f authored by echel0n's avatar echel0n

Fixed episode search string fallback.

Added touch file helper function.
parent 6f17262a
# Changelog
- * 8e27f3b - 2018-11-24: Shows now flagged with `scene numbering` will display and search by episode scene numbers.
- * 95615ac - 2018-11-25: Fixed episode search string fallback. Added touch file helper function.
- * 6f17262 - 2018-11-24: Shows now flagged with `scene numbering` will display and search by episode scene numbers.
- * c5327f5 - 2018-11-24: Added ability to add new shows using quicksearch. Bugfixed Torrent9 provider.
- * dff28fe - 2018-11-20: Release v9.4.41
- * 461d0cc - 2018-11-20: Fixed residual issue causing shows not to update from changes made to network timezone updater in previous update.
......
......@@ -1858,3 +1858,7 @@ def episode_num(season=None, episode=None, **kwargs):
elif numbering == 'absolute':
if not (season and episode) and (season or episode):
return '{0:0>3}'.format(season or episode)
def touch_file(file):
io.open(file, 'a').close()
......@@ -482,7 +482,8 @@ def already_postprocessed(dirName, videofile, force, result):
if h['season'] == e['season'] and h['episode'] == e['episode']
and e['status'] in Quality.DOWNLOADED):
# If we find a showid, a season number, and one or more episode numbers then we need to use those in the query
# If we find a showid, a season number, and one or more episode numbers then we need to use those in the
# query
if parse_result and (parse_result.indexerid and
parse_result.episode_numbers and
parse_result.season_number):
......@@ -493,6 +494,10 @@ def already_postprocessed(dirName, videofile, force, result):
else:
return True
# Checks for processed file marker
if os.path.isfile(os.path.join(dirName, videofile + '.sr_processed')):
return True
return False
......
......@@ -33,7 +33,7 @@ from sickrage.core.exceptions import EpisodeNotFoundException, EpisodePostProces
from sickrage.core.helpers import findCertainShow, show_names, replaceExtension, makeDir, \
chmod_as_parent, move_file, copy_file, hardlink_file, move_and_symlink_file, remove_non_release_groups, \
remove_extension, \
isFileLocked, verify_freespace, delete_empty_folders, make_dirs, symlink, is_rar_file, glob_escape
isFileLocked, verify_freespace, delete_empty_folders, make_dirs, symlink, is_rar_file, glob_escape, touch_file
from sickrage.core.nameparser import InvalidNameException, InvalidShowException, \
NameParser
from sickrage.core.tv.show.history import FailedHistory, History # memory intensive
......@@ -51,7 +51,7 @@ class PostProcessor(object):
EXISTS_SMALLER = 3
DOESNT_EXIST = 4
IGNORED_FILESTRINGS = [".AppleDouble", ".DS_Store"]
IGNORED_FILESTRINGS = [".AppleDouble", ".DS_Store", ".sr_processed"]
PROCESS_METHOD_COPY = "copy"
PROCESS_METHOD_MOVE = "move"
......@@ -930,6 +930,9 @@ class PostProcessor(object):
return False
def _add_processed_marker_file(self, file_path):
touch_file(file_path + '.sr_processed')
@property
def process(self):
"""
......@@ -1135,6 +1138,7 @@ class PostProcessor(object):
raise EpisodePostProcessingFailedException("File is locked for reading")
self._copy(self.file_path, dest_path, new_base_name, sickrage.app.config.move_associated_files,
sickrage.app.config.use_subtitles and ep_obj.show.subtitles)
self._add_processed_marker_file(self.file_path)
elif self.process_method == self.PROCESS_METHOD_MOVE:
if isFileLocked(self.file_path, True):
raise EpisodePostProcessingFailedException("File is locked for reading/writing")
......@@ -1143,15 +1147,18 @@ class PostProcessor(object):
elif self.process_method == self.PROCESS_METHOD_HARDLINK:
self._hardlink(self.file_path, dest_path, new_base_name, sickrage.app.config.move_associated_files,
sickrage.app.config.use_subtitles and ep_obj.show.subtitles)
self._add_processed_marker_file(self.file_path)
elif self.process_method == self.PROCESS_METHOD_SYMLINK:
if isFileLocked(self.file_path, True):
raise EpisodePostProcessingFailedException("File is locked for reading/writing")
self._moveAndSymlink(self.file_path, dest_path, new_base_name,
sickrage.app.config.move_associated_files,
sickrage.app.config.use_subtitles and ep_obj.show.subtitles)
self._add_processed_marker_file(self.file_path)
elif self.process_method == self.PROCESS_METHOD_SYMLINK_REVERSED:
self._symlink(self.file_path, dest_path, new_base_name, sickrage.app.config.move_associated_files,
sickrage.app.config.use_subtitles and ep_obj.show.subtitles)
self._add_processed_marker_file(self.file_path)
else:
sickrage.app.log.error("Unknown process method: " + str(self.process_method))
raise EpisodePostProcessingFailedException("Unable to move the files to their new home")
......
......@@ -1398,7 +1398,7 @@ class Home(WebHandler):
else:
do_update = True
if scene == showObj.scene and anime == showObj.anime:
if scene == showObj.scene or anime == showObj.anime:
do_update_scene_numbering = False
else:
do_update_scene_numbering = True
......@@ -1515,7 +1515,7 @@ class Home(WebHandler):
if do_update_scene_numbering:
try:
xem_refresh(showObj.indexerid, showObj.indexer)
xem_refresh(showObj.indexerid, showObj.indexer, True)
time.sleep(cpu_presets[sickrage.app.config.cpu_preset])
except CantUpdateShowException as e:
warnings.append(_("Unable to force an update on scene numbering of the show."))
......
......@@ -177,7 +177,7 @@ class GenericProvider(object):
for show_name in allPossibleShowNames(episode.show, episode.scene_season):
episode_string = show_name + self.search_separator
episode_string_fallbacks = []
episode_string_fallback = None
if episode.show.air_by_date:
episode_string += str(episode.airdate).replace('-', ' ')
......@@ -193,8 +193,8 @@ class GenericProvider(object):
ep = episode.scene_episode
else:
ep = episode.scene_absolute_number
episode_string_fallbacks += [episode_string + '{episode:0>3}'.format(episode=ep)]
episode_string += '{episode:0>2}'.format(episode=ep)
episode_string_fallback = episode_string + '{episode:0>3}'.format(episode=ep)
else:
episode_string += sickrage.app.naming_ep_type[2] % {
'seasonnumber': episode.scene_season,
......@@ -203,12 +203,10 @@ class GenericProvider(object):
if add_string:
episode_string += self.search_separator + add_string
for i, episode_string_fallback in enumerate(episode_string_fallbacks):
episode_string_fallback += self.search_separator + add_string
episode_string_fallbacks[i] = episode_string_fallback
episode_string_fallback += self.search_separator + add_string
search_string['Episode'].append(episode_string.strip())
for episode_string_fallback in episode_string_fallbacks:
if episode_string_fallback:
search_string['Episode'].append(episode_string_fallback.strip())
return [search_string]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment