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