add helper for starting the process

pull/33/head 1.3
Raphaël Vinot 2015-04-04 19:21:57 +02:00
parent 78b17b013b
commit f464b81e4f
3 changed files with 14 additions and 9 deletions

View File

@ -7,7 +7,7 @@ import shlex
import subprocess import subprocess
import time import time
from helpers import FileBase, KittenGroomerBase from helpers import FileBase, KittenGroomerBase, main
LIBREOFFICE = '/usr/bin/unoconv' LIBREOFFICE = '/usr/bin/unoconv'
GS = '/usr/bin/gs' GS = '/usr/bin/gs'
@ -318,6 +318,4 @@ class KittenGroomer(KittenGroomerBase):
self._print_log() self._print_log()
if __name__ == '__main__': if __name__ == '__main__':
kg = KittenGroomer('/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm', main(KittenGroomer)
'/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm_out')
kg.processdir()

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
from helpers import FileBase, KittenGroomerBase from helpers import FileBase, KittenGroomerBase, main
printers = ['.STL', '.obj'] printers = ['.STL', '.obj']
@ -65,6 +65,4 @@ class KittenGroomerPier9(KittenGroomerBase):
if __name__ == '__main__': if __name__ == '__main__':
kg = KittenGroomerPier9('/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm', main(KittenGroomerPier9)
'/home/raphael/gits/KittenGroomer/tests/content_img_vfat_norm_out')
kg.processdir()

View File

@ -3,7 +3,7 @@
import os import os
import shutil import shutil
from twiggy import quickSetup, log from twiggy import quickSetup, log
import argparse
class KittenGroomerError(Exception): class KittenGroomerError(Exception):
def __init__(self, message): def __init__(self, message):
@ -138,3 +138,12 @@ class KittenGroomerBase(object):
Main function doing the work, you have to implement it yourself. Main function doing the work, you have to implement it yourself.
''' '''
raise ImplementationRequired('You have to implement the result processdir.') raise ImplementationRequired('You have to implement the result processdir.')
def main(kg_implementation):
parser = argparse.ArgumentParser(prog='KittenGroomer', description='Call the KittenGroomer implementation to do things on files present in the source directory to the destination directory')
parser.add_argument('-s', '--source', type=str, help='Source directory')
parser.add_argument('-d', '--destination', type=str, help='Destination directory')
args = parser.parse_args()
kg = kg_implementation(args.source, args.destination)
kg.processdir()