Make package and cli
This commit is contained in:
parent
3313298fa2
commit
5611f134e3
6
open_workout_coach/__init__.py
Normal file
6
open_workout_coach/__init__.py
Normal file
@ -0,0 +1,6 @@
|
||||
from . import (
|
||||
load_exercises,
|
||||
map_yaml_to_database,
|
||||
create_open_workout_database,
|
||||
exercise_config
|
||||
)
|
27
open_workout_coach/__main__.py
Normal file
27
open_workout_coach/__main__.py
Normal file
@ -0,0 +1,27 @@
|
||||
import click
|
||||
|
||||
from open_workout_coach.load_exercises import load_file_and_media_links
|
||||
from open_workout_coach.map_yaml_to_database import process_config_into_workout_file
|
||||
|
||||
|
||||
@click.group("cli")
|
||||
def cli():
|
||||
pass
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument('input_path', type=click.Path(exists=True))
|
||||
@click.argument('output_path', type=click.Path(exists=False))
|
||||
def create_plan(input_path, output_path):
|
||||
"""
|
||||
Creates a openworkout plan from the input yaml file.
|
||||
"""
|
||||
config = load_file_and_media_links(file_path=input_path)
|
||||
process_config_into_workout_file(config=config, output_file=output_path)
|
||||
|
||||
|
||||
FILE = 'data/input/samples/exercises.yaml'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli()
|
0
open_workout_coach/cli.py
Normal file
0
open_workout_coach/cli.py
Normal file
@ -13,6 +13,7 @@ def get_video(url):
|
||||
return output_dir
|
||||
|
||||
|
||||
@lru_cache(5)
|
||||
def create_gif_from_video_and_timestamps(video_path, start, end):
|
||||
video = mpy.VideoFileClip(video_path)
|
||||
clip: mpy.VideoFileClip = video.subclip(start, end)
|
@ -3,8 +3,7 @@ import tempfile
|
||||
import zipfile
|
||||
import os
|
||||
|
||||
from load_exercises import load_file_and_media_links
|
||||
from create_open_workout_database import create_workout_session, create_item, create_workout_database
|
||||
from open_workout_coach.create_open_workout_database import create_workout_session, create_item, create_workout_database
|
||||
|
||||
|
||||
ITEM_KEY_MEDIA_TYPE_MAP = {
|
||||
@ -110,12 +109,3 @@ def process_config_into_workout_file(config, output_file = None):
|
||||
db_file=db,
|
||||
video_files=videos,
|
||||
)
|
||||
|
||||
|
||||
FILE = 'data/input/samples/exercises.yaml'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
config = load_file_and_media_links(FILE)
|
||||
process_config_into_workout_file(config)
|
||||
|
@ -2,3 +2,5 @@ pyyaml
|
||||
pytube
|
||||
moviepy
|
||||
imageio
|
||||
ffmpeg-python
|
||||
click
|
||||
|
Loading…
x
Reference in New Issue
Block a user