From 4a93dbfd2ee8766f2d7d50b03830eb3c051539d3 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 19 Mar 2019 23:23:43 +0100 Subject: [PATCH] Dry and daemon cli parameters added for only displaying, not moving; and daemon to let program know not to ask for user input by cmdline, instead exit. --- src/cli.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/cli.py b/src/cli.py index 9ab67be..b664d57 100755 --- a/src/cli.py +++ b/src/cli.py @@ -2,7 +2,7 @@ import click from guessit import guessit -from core import scan_folder, moveHome +from core import scan_folder from video import Video from exceptions import InsufficientNameError @@ -20,15 +20,29 @@ def prompt(name): return manual_name +def _moveHome(file): + print('- - -\nMatch: \t\t {}. \nDestination:\t {}'.format(file, file.wantedFilePath())) + @click.command() @click.argument('path') -@click.option('--daemon', '-d') -def main(path, daemon): +@click.option('--daemon', '-d', is_flag=True) +@click.option('--dry', is_flag=True) +def main(path, daemon, dry): + if dry: + def moveHome(file): _moveHome(file) + else: + from core import moveHome + + videos, insufficient_name = scan_folder(path) for video in videos: moveHome(video) + if daemon: + print('Exiting! Daemon flag set. Insufficient name for: ', insufficient_name) + exit(0) + while len(insufficient_name) >= 1: for i, file in enumerate(insufficient_name): try: