Copy the new comics?

Information and Tutorials on features in Mylar and how to use it
fredodido
Posts: 13
Joined: Tue Jan 28, 2020 9:21 am

Re: Copy the new comics?

Post 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.
User avatar
evilhero
Site Admin
Posts: 2883
Joined: Sat Apr 20, 2013 3:43 pm
Contact:

Re: Copy the new comics?

Post 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
fredodido
Posts: 13
Joined: Tue Jan 28, 2020 9:21 am

Re: Copy the new comics?

Post by fredodido »

THANK YOU !!! :mrgreen:
fredodido
Posts: 13
Joined: Tue Jan 28, 2020 9:21 am

Re: Copy the new comics?

Post by fredodido »

It works perfectly well, thanks evilhero
Post Reply