Skip to content

Commit

Permalink
fix pattern matching for tvshow metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-klein committed Apr 19, 2018
1 parent 37eceb3 commit f406705
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions resources/lib/contentitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class EpisodeItem(ContentItem):
keeps track of a tvshow episode item from a plugin,
and manages its content in managed/staged files and folders
'''
#TODO: use season folders in metadata/managed dir

def __init__(self, path, title, mediatype, show_title):
self.show_title = show_title
Expand Down Expand Up @@ -183,7 +184,7 @@ def add_to_library(self):
# link tvshow.nfo and artwork now, if metadata_dir exists
files = os.listdir(metadata_dir)
for fname in files:
if not (re.match('.*[0-9]x[0-9].*|.*[Ss][0-9].*[Ee][0-9].*', safe_title)
if not (re.match('.*[0-9]x[0-9].*|.*[Ss][0-9].*[Ee][0-9].*', fname)
or '.strm' in fname):
fs.softlink_file(
os.path.join(metadata_dir, fname),
Expand Down Expand Up @@ -243,9 +244,9 @@ def remove_and_block(self):

@log_decorator
def create_metadata_item(self):
#TODO?: automatically call this when staging
#TODO: actually create basic nfo file with name and episode number, and thumb if possible
#TODO?: could probably just rename based on existing strm file instead of nfo file
#IDEA: automatically call this when staging
#IDEA: actually create basic nfo file with name and episode number, and thumb if possible
#IDEA: could probably just rename based on existing strm file instead of nfo file
# create show_dir in Metadata/TV if it doesn't already exist
safe_showtitle = clean_name(self.show_title)
show_dir = os.path.join(MANAGED_FOLDER, 'Metadata', 'TV', safe_showtitle)
Expand Down

0 comments on commit f406705

Please sign in to comment.