mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Merge pull request #693 from JackDandy/feature/FixOrphanImages
Fix find associated meta files to prevent orphan episode images.
This commit is contained in:
commit
e31f6cdac6
2 changed files with 17 additions and 15 deletions
|
@ -63,6 +63,7 @@
|
|||
* Change add 'nocache' kwarg to helpers.getURL to facilitate non-cached requests
|
||||
* Change instantly use saved value from Search Settings/Episode Search/"Check propers every" instead of after a restart
|
||||
* Change include OSError system messages in file system failure logs during post process
|
||||
* Fix find associated meta files to prevent orphan episode images
|
||||
|
||||
|
||||
### 0.11.11 (2016-04-05 19:20:00 UTC)
|
||||
|
|
|
@ -170,32 +170,33 @@ class PostProcessor(object):
|
|||
|
||||
file_path_list = []
|
||||
|
||||
base_name = file_path.rpartition('.')[0]
|
||||
tmp_base = base_name = file_path.rpartition('.')[0]
|
||||
|
||||
if not base_name_only:
|
||||
base_name += '.'
|
||||
tmp_base += '.'
|
||||
|
||||
# don't strip it all and use cwd by accident
|
||||
if not base_name:
|
||||
if not tmp_base:
|
||||
return []
|
||||
|
||||
# don't confuse glob with chars we didn't mean to use
|
||||
base_name = re.sub(r'[\[\]\*\?]', r'[\g<0>]', base_name)
|
||||
|
||||
for associated_file_path in ek.ek(glob.glob, base_name + '*'):
|
||||
# only add associated to list
|
||||
if associated_file_path == file_path:
|
||||
continue
|
||||
# only list it if the only non-shared part is the extension or if it is a subtitle
|
||||
if subtitles_only and not associated_file_path[len(associated_file_path) - 3:] in common.subtitleExtensions:
|
||||
continue
|
||||
for meta_ext in ['', '-thumb', '.ext', '.ext.cover', '.metathumb']:
|
||||
for associated_file_path in ek.ek(glob.glob, '%s%s.*' % (base_name, meta_ext)):
|
||||
# only add associated to list
|
||||
if associated_file_path == file_path:
|
||||
continue
|
||||
# only list it if the only non-shared part is the extension or if it is a subtitle
|
||||
if subtitles_only and not associated_file_path[len(associated_file_path) - 3:] in common.subtitleExtensions:
|
||||
continue
|
||||
|
||||
# Exclude .rar files from associated list
|
||||
if re.search('(^.+\.(rar|r\d+)$)', associated_file_path):
|
||||
continue
|
||||
# Exclude .rar files from associated list
|
||||
if re.search('(^.+\.(rar|r\d+)$)', associated_file_path):
|
||||
continue
|
||||
|
||||
if ek.ek(os.path.isfile, associated_file_path):
|
||||
file_path_list.append(associated_file_path)
|
||||
if ek.ek(os.path.isfile, associated_file_path):
|
||||
file_path_list.append(associated_file_path)
|
||||
|
||||
return file_path_list
|
||||
|
||||
|
|
Loading…
Reference in a new issue