pep8 style

This commit is contained in:
j 2017-02-18 13:02:21 +01:00
parent 6475bb8120
commit c35154ad3a

View file

@ -29,7 +29,7 @@ def format_path(data, directory_key='director'):
director = data['directorSort'] or ['Unknown Director'] director = data['directorSort'] or ['Unknown Director']
title = data['seriesTitle' if data['isEpisode'] else 'title'] or 'Untitled' title = data['seriesTitle' if data['isEpisode'] else 'title'] or 'Untitled'
year = data['seriesYear' if data['isEpisode'] else 'year'] or None year = data['seriesYear' if data['isEpisode'] else 'year'] or None
parts = list(map(format_underscores, filter(lambda x: x != None, [ parts = list(map(format_underscores, filter(lambda x: x is not None, [
u'; '.join(director[:10]), u'; '.join(director[:10]),
u'%s%s' % (title, u' (%s)' % year if year else ''), u'%s%s' % (title, u' (%s)' % year if year else ''),
u'%s%s%s%s%s%s' % ( u'%s%s%s%s%s%s' % (
@ -60,7 +60,7 @@ def parse_item_files(files):
def get_version_key(file, extension=True): def get_version_key(file, extension=True):
return '%s/%s-part/%s' % ( return '%s/%s-part/%s' % (
file['version'] or '', file['version'] or '',
'single' if file['part'] == None else 'multi', 'single' if file['part'] is None else 'multi',
file['extension'] if extension else '' file['extension'] if extension else ''
) )
# filter out duplicate files (keep shortest path, sorted alphabetically) # filter out duplicate files (keep shortest path, sorted alphabetically)
@ -272,12 +272,12 @@ def parse_path(path, directory_key='director'):
# isEpisode, seriesTitle, seriesYear # isEpisode, seriesTitle, seriesYear
data['isEpisode'] = False data['isEpisode'] = False
data['seriesTitle'] = data['seriesYear'] = None data['seriesTitle'] = data['seriesYear'] = None
if data['season'] != None or data['episode'] != None or data['episodes']: if data['season'] is not None or data['episode'] is not None or data['episodes']:
data['isEpisode'] = True data['isEpisode'] = True
data['seriesTitle'] = data['title'] data['seriesTitle'] = data['title']
season = 'S%02d' % data['season'] if data['season'] != None else '' season = 'S%02d' % data['season'] if data['season'] is not None else ''
episode = '' episode = ''
if data['episode'] != None: if data['episode'] is not None:
episode = 'E%02d' % data['episode'] episode = 'E%02d' % data['episode']
elif data['episodes']: elif data['episodes']:
episode = 'E%02d%s%02d' % ( episode = 'E%02d%s%02d' % (
@ -379,9 +379,9 @@ def parse_movie_path(path):
season = match.group(3) season = match.group(3)
episode = match.group(5) episode = match.group(5)
episodeTitle = (match.group(6) or '').strip() episodeTitle = (match.group(6) or '').strip()
if episode != None: if episode is not None:
episode = int(episode) episode = int(episode)
if season != None: if season is not None:
season = int(season) season = int(season)
if episode and not season: if episode and not season:
season = 1 season = 1
@ -399,7 +399,7 @@ def parse_movie_path(path):
else: else:
episode = None episode = None
if episode and 'Episode %d'%episode in fileparts: if episode and 'Episode %d' % episode in fileparts:
episodeTitle = fileparts.index('Episode %d' % episode) + 1 episodeTitle = fileparts.index('Episode %d' % episode) + 1
episodeTitle = fileparts[episodeTitle] episodeTitle = fileparts[episodeTitle]
if episodeTitle == extension or episodeTitle.startswith('Part'): if episodeTitle == extension or episodeTitle.startswith('Part'):