Page 2 of 2
Re: Copy the new comics?
Posted: Wed Feb 05, 2020 3:52 pm
by fredodido
It is running on raspbian.
The second directory would only contain the new entries in Mylar, it is that simple. I have an application that do the synchronization between this directory and my tablet, then delete the files from the directory when they have been transfered.
Re: Copy the new comics?
Posted: Wed Feb 05, 2020 4:23 pm
by evilhero
Mylar Configuration / Quality & Post-Processing /Run script AFTER Post-Processing/ (put the full path to your script in the field)
5 variables are passed from Mylar that can be used:
arg[1] <-- original name of the downloaded file
arg[2] <---original folder location
arg[3] <--- new filename (regardless if renamed or not)
arg[4] <--- folder location after post-processing
arg[5] <---- {'seriesmeta': {'name', 'comicyear', 'comicid', 'issueid', 'issueyear', 'issuenum', 'publisher'}}
Basic python script (tested successfully on python2.7.12 a few minutes ago) to accomplish a copy/move to a specified location after an item has successfully post-processed:
Code: Select all
#!/usr/bin/env python
import sys
import os
import shutil
#---user variables (start)---
file_mode = 'copy' ## select 'copy' or 'move'
destination_folder = 'your destination path here within quotations'
#---user variables (end)---
src = os.path.join(sys.argv[4]) #complete path to post-processed filename (includes series_directory)
dst = os.path.join(destination_folder, sys.argv[3]) #destination_directory + new_filename
if file_mode == 'copy':
file_operation = shutil.copy
else:
file_operation = shutil.move
try:
file_operation(src, dst)
except IOError:
print 'unable to copy file to dst : ' + dst
else:
print 'Successfully copied to dst : ' + dst
Re: Copy the new comics?
Posted: Wed Feb 05, 2020 8:57 pm
by fredodido
THANK YOU !!!
Re: Copy the new comics?
Posted: Wed Feb 05, 2020 9:38 pm
by fredodido
It works perfectly well, thanks evilhero