Recatored the cli program.
This commit is contained in:
@@ -4,3 +4,4 @@ hashids==1.2.0
|
||||
enzyme>=0.4.1
|
||||
click>=6.7
|
||||
langdetect>=1.0.7
|
||||
titlecase>=0.12.0
|
||||
|
||||
52
src/cli.py
52
src/cli.py
@@ -1,43 +1,17 @@
|
||||
#/usr/local/bin/python3
|
||||
import click
|
||||
import os
|
||||
import logging
|
||||
#!usr/bin/env python3.6
|
||||
|
||||
import env_variables as env
|
||||
from core import scan_folder, moveHome
|
||||
from video import Video
|
||||
from guessit import guessit
|
||||
|
||||
logging.basicConfig(filename=env.logfile, level=logging.INFO)
|
||||
logger = logging.getLogger('seasonedParser')
|
||||
fh = logging.FileHandler(env.logfile)
|
||||
fh.setLevel(logging.INFO)
|
||||
videos, insufficient_info = scan_folder('Spider.Man')
|
||||
print('Sweet lemonade: {} {}'.format(videos, insufficient_info))
|
||||
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
fh.setFormatter(formatter)
|
||||
for video in videos:
|
||||
moveHome(video)
|
||||
|
||||
logger.addHandler(fh)
|
||||
|
||||
def listPath(path):
|
||||
if (os.path.isdir(path)):
|
||||
print('Contents of path:')
|
||||
print(os.listdir(path))
|
||||
|
||||
elif os.path.isfile(path):
|
||||
print('File to parse:')
|
||||
print(path)
|
||||
|
||||
else:
|
||||
print('Path does not exists')
|
||||
|
||||
def guessFromInput(video):
|
||||
print('Insufficient info for {}'.format(video.name))
|
||||
video_name = input('Input
|
||||
|
||||
@click.command()
|
||||
@click.argument('path')
|
||||
@click.option('--greeting', '-g')
|
||||
def main(path, greeting):
|
||||
logger.info('Received cli variables: \n\t path: {}'.format(path))
|
||||
listPath(path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
for file in insufficient_info:
|
||||
supplementary_info = input("Insufficient info for match file: '{}'\nSupplementary info: ".format(file))
|
||||
print(supplementary_info)
|
||||
video = Video.fromguess(file, guessit(supplementary_info))
|
||||
moveHome(video)
|
||||
|
||||
Reference in New Issue
Block a user