Recatored the cli program.
This commit is contained in:
@@ -4,3 +4,4 @@ hashids==1.2.0
|
|||||||
enzyme>=0.4.1
|
enzyme>=0.4.1
|
||||||
click>=6.7
|
click>=6.7
|
||||||
langdetect>=1.0.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
|
#!usr/bin/env python3.6
|
||||||
import click
|
|
||||||
import os
|
|
||||||
import logging
|
|
||||||
|
|
||||||
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)
|
videos, insufficient_info = scan_folder('Spider.Man')
|
||||||
logger = logging.getLogger('seasonedParser')
|
print('Sweet lemonade: {} {}'.format(videos, insufficient_info))
|
||||||
fh = logging.FileHandler(env.logfile)
|
|
||||||
fh.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
for video in videos:
|
||||||
fh.setFormatter(formatter)
|
moveHome(video)
|
||||||
|
|
||||||
logger.addHandler(fh)
|
for file in insufficient_info:
|
||||||
|
supplementary_info = input("Insufficient info for match file: '{}'\nSupplementary info: ".format(file))
|
||||||
def listPath(path):
|
print(supplementary_info)
|
||||||
if (os.path.isdir(path)):
|
video = Video.fromguess(file, guessit(supplementary_info))
|
||||||
print('Contents of path:')
|
moveHome(video)
|
||||||
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()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user