46 lines
989 B
Python
46 lines
989 B
Python
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
import logging
|
|
import sys
|
|
|
|
from src.metadata_writer import MetadataWriter
|
|
|
|
|
|
def main():
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="[%(levelname)s] %(message)s"
|
|
)
|
|
|
|
parser = argparse.ArgumentParser(
|
|
description="Write metadata from JSON to video files"
|
|
)
|
|
parser.add_argument(
|
|
"json_file",
|
|
help="Path to input JSON metadata file"
|
|
)
|
|
parser.add_argument(
|
|
"-o", "--output",
|
|
help="Path of the output directory"
|
|
)
|
|
parser.add_argument(
|
|
"-s", "--source",
|
|
help="Source directory (overrides automatic detection)"
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
json_file = args.json_file
|
|
output_dir = args.output
|
|
source_dir = args.source
|
|
|
|
writer: MetadataWriter = MetadataWriter()
|
|
|
|
success: bool = writer.process_metadata(json_file, source_dir, output_dir)
|
|
|
|
if not success:
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|