#!/bin/bash/python3

import os
import time
import shutil

os.system('clear')
time.sleep(1)

# copy the contents of the host's "Photos Library.photoslibrary" to to mirrormirror_data 
photos_src = os.path.join(os.path.expanduser('~'), 'Pictures', 'Photos Library.photoslibrary')
photos_dst = os.path.join(os.path.expanduser('~'), 'bestpix_data')

print()
print(f'Making empty folder at: {photos_dst}')
print()

if os.path.exists(photos_dst):
    shutil.rmtree(photos_dst)

print('Copying folder contents:')
print(f'    from: {photos_src}')
print(f'      to: {photos_dst}')
print()
shutil.copytree(photos_src, photos_dst)

command = f'docker run --rm -it -p 127.0.0.1:8442:8442 --volume {photos_dst}:/opt/bestpix_data bluehalswater/bestpix'

print(f'Running command: {command}')
print()
os.system(command)