If any error return false when picking for girlscouts

This commit is contained in:
2018-09-20 23:24:17 +02:00
parent 1fc62479be
commit 916ce45fec

View File

@@ -133,7 +133,6 @@ def scan_videos(path):
# scan for videos # scan for videos
for filename in filenames: for filename in filenames:
# filter on videos and archives
if not (filename.endswith(VIDEO_EXTENSIONS)): if not (filename.endswith(VIDEO_EXTENSIONS)):
logging.debug('Skipping non-video file %s', filename) logging.debug('Skipping non-video file %s', filename)
continue continue
@@ -146,7 +145,6 @@ def scan_videos(path):
# reconstruct the file path # reconstruct the file path
filepath = os.path.join(dirpath, filename) filepath = os.path.join(dirpath, filename)
# skip links
if os.path.islink(filepath): if os.path.islink(filepath):
logging.debug('Skipping link %r in %r', filename, dirpath) logging.debug('Skipping link %r in %r', filename, dirpath)
continue continue
@@ -270,20 +268,27 @@ def scan_folder(path):
return videos return videos
def movingToCollege(video, home_path): def movingToCollege(video, home_path):
video.home = home_path video.home = path.join(home_path)
def pickforgirlscouts(video): def pickforgirlscouts(video):
if isinstance(video, Movie): if isinstance(video, Movie):
if video.title != None and video.year != None: if video.title != None and video.year != None:
home_path = '{} ({})'.format(video.title, video.year) home_path = '{} ({})'.format(video.title, video.year)
try:
movingToCollege(video, home_path) movingToCollege(video, home_path)
return True return True
except:
return False
elif isinstance(video, Episode): elif isinstance(video, Episode):
if video.series != None and video.season != None and video.episode != None and type(video.episode) != list: if video.series != None and video.season != None and video.episode != None and type(video.episode) != list:
home_path = '{} S{:02d}E{:02d}'.format(video.series, video.season, video.episode) # Handle the list problems
home_path = '{} S{:02d}E{:02d}'.format(str(video.series), str(video.season), str(video.episode))
try:
movingToCollege(video, home_path) movingToCollege(video, home_path)
return True return True
except:
return False
return False return False
@@ -295,8 +300,7 @@ def main():
scout = [] scout = []
civilian = [] civilian = []
for video in videos: for video in videos:
sortingHat = pickforgirlscouts(video) if pickforgirlscouts(video):
if sortingHat:
scout.append(video) scout.append(video)
else: else:
civilian.append(video) civilian.append(video)