Imported logger and stricter logic when exiting because of insuffient_name and daemon flag set.

This commit is contained in:
2019-03-20 00:28:07 +01:00
parent 4a93dbfd2e
commit 92b0dbafca

View File

@@ -1,11 +1,14 @@
#!usr/bin/env python3.6
import click
from guessit import guessit
import logging
from core import scan_folder
from video import Video
from exceptions import InsufficientNameError
logger = logging.getLogger('seasonedParser')
def tweet(video):
pass
@@ -22,6 +25,7 @@ def prompt(name):
def _moveHome(file):
print('- - -\nMatch: \t\t {}. \nDestination:\t {}'.format(file, file.wantedFilePath()))
logger.info('- - -\nMatch: \t\t {}. \nDestination:\t {}'.format(file, file.wantedFilePath()))
@click.command()
@click.argument('path')
@@ -39,8 +43,8 @@ def main(path, daemon, dry):
for video in videos:
moveHome(video)
if daemon:
print('Exiting! Daemon flag set. Insufficient name for: ', insufficient_name)
if len(insufficient_name) and daemon:
logger.warning('Daemon flag set. Insufficient name for: %r', insufficient_name)
exit(0)
while len(insufficient_name) >= 1: