mirror of
https://github.com/Xevion/phototag.git
synced 2025-12-09 16:07:58 -06:00
added and completed cli functionality for use
This commit is contained in:
@@ -9,9 +9,8 @@ logging.basicConfig(level=logging.INFO)
|
||||
log = logging.getLogger('init')
|
||||
log.info('Progressbar/Logging ready.')
|
||||
|
||||
|
||||
# Path Constants
|
||||
ROOT = os.path.dirname(os.path.realpath(__file__))
|
||||
ROOT = os.getcwd()
|
||||
INPUT_PATH = ROOT
|
||||
TEMP_PATH = os.path.join(ROOT, 'temp')
|
||||
OUTPUT_PATH = os.path.join(ROOT, 'output')
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
|
||||
from .app import main
|
||||
from . import INPUT_PATH, OUTPUT_PATH
|
||||
|
||||
# Ensure that 'input' and 'output' directories are created
|
||||
if not os.path.exists(INPUT_PATH):
|
||||
logging.fatal('Input directory did not exist, creating and quitting.')
|
||||
os.makedirs(INPUT_PATH)
|
||||
# if not os.path.exists(INPUT_PATH):
|
||||
# logging.fatal('Input directory did not exist, creating and quitting.')
|
||||
# os.makedirs(INPUT_PATH)
|
||||
|
||||
if not os.path.exists(OUTPUT_PATH):
|
||||
logging.info('Output directory did not exist. Creating...')
|
||||
os.makedirs(OUTPUT_PATH)
|
||||
# if not os.path.exists(OUTPUT_PATH):
|
||||
# logging.info('Output directory did not exist. Creating...')
|
||||
# os.makedirs(OUTPUT_PATH)
|
||||
|
||||
log = logging.getLogger('main')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
12
package/cli.py
Normal file
12
package/cli.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import logging
|
||||
import click
|
||||
import os
|
||||
from .app import run
|
||||
from . import ROOT, INPUT_PATH, OUTPUT_PATH, TEMP_PATH
|
||||
|
||||
@click.command()
|
||||
def cli():
|
||||
print('\n'.join([os.getcwd(), ROOT, INPUT_PATH, OUTPUT_PATH, TEMP_PATH]))
|
||||
print('Executing phototag service')
|
||||
run()
|
||||
print('Phototag service executed')
|
||||
20
phototag.py
20
phototag.py
@@ -1,20 +0,0 @@
|
||||
import sys
|
||||
import os
|
||||
import logging
|
||||
import click
|
||||
from package import app
|
||||
|
||||
log = logging.getLogger('main')
|
||||
|
||||
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.path.join(
|
||||
sys.path[0], 'package', 'key', 'photo_tagging_service.json')
|
||||
|
||||
|
||||
@click.command()
|
||||
def cli():
|
||||
log.info('Executing package...')
|
||||
sys.exit(app.run())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
16
setup.py
16
setup.py
@@ -3,7 +3,17 @@ import os
|
||||
import io
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
DEPENDENCIES = ['Click']
|
||||
DEPENDENCIES = [
|
||||
'Click',
|
||||
'rawpy',
|
||||
'imageio',
|
||||
'progressbar2',
|
||||
'iptcinfo3',
|
||||
'google-api-python-client',
|
||||
'google-cloud',
|
||||
'google-cloud-vision',
|
||||
'Pillow'
|
||||
]
|
||||
EXCLUDE_FROM_PACKAGES = []
|
||||
CURDIR = sys.path[0]
|
||||
|
||||
@@ -25,7 +35,7 @@ setup(
|
||||
scripts=[],
|
||||
entry_points='''
|
||||
[console_scripts]
|
||||
phototag=phototag.phototag:cli
|
||||
phototag=package.cli:cli
|
||||
''',
|
||||
zip_safe=False,
|
||||
install_requires=DEPENDENCIES,
|
||||
@@ -37,4 +47,4 @@ setup(
|
||||
"Programming Language :: Python :: 3",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user