#!/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('Making empty folder at: {}'.format(photos_dst))
print()

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

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

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

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