[REQUEST] RCLONE and cleanup script

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
Post Reply
choebear
Posts: 4
Joined: 31 Oct 2016, 03:37

[REQUEST] RCLONE and cleanup script

Post by choebear » 31 Oct 2016, 03:42

Hi, If you wouldn't mind, could you tell me please what I'm doing wrong here?

This is what I'm trying to do

Code: Select all

#!/usr/bin/env python
#
##############################################################################
### NZBGET POST-PROCESSING SCRIPT                                          ###


import os
import sys
import time
import subprocess

# NZBGet Exit Codes
NZBGET_POSTPROCESS_PARCHECK = 92
NZBGET_POSTPROCESS_SUCCESS = 93
NZBGET_POSTPROCESS_ERROR = 94
NZBGET_POSTPROCESS_NONE = 95

rclonepath = "/usr/bin/rclone"
srcpath = "~/localskynet"
dstpath = "ACD:Plex/skynet"
dirs = ['Movies','Comics','TV','Other','Audio']

for curdir in dirs:
   dirsrc = "%s/Complete/%s/" % (srcpath,curdir)
   dirdst = "%s/%s/" % (dstpath,curdir)
   subprocess.call([rclonepath, "move", dirsrc, dirdst])

time.sleep(210)

for curdir in dirs:
   if curdir == 'Audio':
      remdir = "%s/%s/books/*"
   else:
      remdir = "%s/%s/*"
   os.removedirs(remdir)
   
sys.exit(NZBGET_POSTPROCESS_SUCCESS)

and this is the error I'm noticing
rclone: /usr/bin/env: ‘python\r’: No such file or directory
What am I doing wrong? Also, feel free to make adjustments if you see fit.
Thanks!

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [REQUEST] RCLONE and cleanup script

Post by hugbug » 31 Oct 2016, 06:12

Line endings are wrong. Save the file using a unix compatible text editor.

choebear
Posts: 4
Joined: 31 Oct 2016, 03:37

Re: [REQUEST] RCLONE and cleanup script

Post by choebear » 02 Nov 2016, 03:09

New help, the script isn't throwing an error but it is failing. Any thoughts to help?
INFO Mon Oct 31 2016 16:38:10 rclone: 2016/10/31 20:38:10 Attempt 3/3 failed with 0 errors and: directory not found
INFO Mon Oct 31 2016 16:38:10 rclone: 2016/10/31 20:38:10 amazon drive root 'Plex/skynet/Movies': Waiting for transfers to finish
INFO Mon Oct 31 2016 16:38:10 rclone: 2016/10/31 20:38:10 amazon drive root 'Plex/skynet/Movies': Waiting for checks to finish
INFO Mon Oct 31 2016 16:38:03 rclone: Elapsed time: 1m0.4s
INFO Mon Oct 31 2016 16:38:03 rclone: Transferred: 0
INFO Mon Oct 31 2016 16:38:03 rclone: Checks: 0
INFO Mon Oct 31 2016 16:38:03 rclone: Errors: 0
INFO Mon Oct 31 2016 16:38:03 rclone: Transferred: 0 Bytes (0 Bytes/s)
INFO Mon Oct 31 2016 16:38:03 rclone: 2016/10/31 20:38:03
INFO Mon Oct 31 2016 16:37:48 rclone: 2016/10/31 20:37:48 Attempt 2/3 failed with 0 errors and: directory not found
INFO Mon Oct 31 2016 16:37:48 rclone: 2016/10/31 20:37:48 amazon drive root 'Plex/skynet/Movies': Waiting for transfers to finish
INFO Mon Oct 31 2016 16:37:48 rclone: 2016/10/31 20:37:48 amazon drive root 'Plex/skynet/Movies': Waiting for checks to finish
INFO Mon Oct 31 2016 16:37:26 rclone: 2016/10/31 20:37:26 Attempt 1/3 failed with 0 errors and: directory not found
INFO Mon Oct 31 2016 16:37:26 rclone: 2016/10/31 20:37:26 amazon drive root 'Plex/skynet/Movies': Waiting for transfers to finish
INFO Mon Oct 31 2016 16:37:26 rclone: 2016/10/31 20:37:26 amazon drive root 'Plex/skynet/Movies': Waiting for checks to finish
INFO Mon Oct 31 2016 16:37:03 Executing post-process-script rclone.py for REDACTED

Code: Select all

#!/usr/bin/env python
#
##############################################################################
### NZBGET POST-PROCESSING SCRIPT                                          ###
### NZBGET POST-PROCESSING SCRIPT                                          ###
##############################################################################

import os
import sys
import time
import subprocess

# NZBGet Exit Codes
NZBGET_POSTPROCESS_SUCCESS = 93
NZBGET_POSTPROCESS_ERROR = 94
NZBGET_POSTPROCESS_NONE = 95

rclonepath = "/usr/sbin/rclone"
srcpath = "~/localskynet/Complete"
dstpath = "ACD:Plex/skynet"
dirs = ['Movies','Comics','TV','Other','Audio']

for curdir in dirs:
   dirsrc = "%s/%s/*" % (srcpath,curdir)
   dirdst = "%s/%s/" % (dstpath,curdir)
   subprocess.call([rclonepath, "move", dirsrc, dirdst])

time.sleep(210)   
sys.exit(NZBGET_POSTPROCESS_SUCCESS)

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [REQUEST] RCLONE and cleanup script

Post by hugbug » 02 Nov 2016, 05:34

Does the script work when started from terminal?

choebear
Posts: 4
Joined: 31 Oct 2016, 03:37

Re: [REQUEST] RCLONE and cleanup script

Post by choebear » 03 Nov 2016, 01:01

I'm not sure what the syntax of the arguments are supposed to be when calling outside of nzbget. If I run rclone by itself it works.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [REQUEST] RCLONE and cleanup script

Post by hugbug » 03 Nov 2016, 05:31

Your script has no nzbget specifics. Try without arguments.

choebear
Posts: 4
Joined: 31 Oct 2016, 03:37

Re: [REQUEST] RCLONE and cleanup script

Post by choebear » 04 Nov 2016, 16:41

Updated works, be sure that the user that is running nzbget also has rights to rclone. Also, I was using ~/ instead of /home/plex and was trying Parentdir/* instead of Parentdir.

Code: Select all

#!/usr/bin/env python
#
##############################################################################
### NZBGET POST-PROCESSING SCRIPT                                          ###
### NZBGET POST-PROCESSING SCRIPT                                          ###
##############################################################################

import os
import sys
import time
import subprocess

# NZBGet Exit Codes
NZBGET_POSTPROCESS_SUCCESS = 93
NZBGET_POSTPROCESS_ERROR = 94
NZBGET_POSTPROCESS_NONE = 95

rclonepath = "/usr/sbin/rclone"
srcpath = "/home/plex/localskynet"
dstpath = "ACD:Plex/skynet"
dirs = ['Movies','Comics','TV','Other','Audio']

for curdir in dirs:
   dirsrc = "%s/Complete/%s/" % (srcpath,curdir)
   dirdst = "%s/%s/" % (dstpath,curdir)
   subprocess.call([rclonepath, "move", dirsrc, dirdst])

sys.exit(NZBGET_POSTPROCESS_SUCCESS)

seannymurrs
Posts: 7
Joined: 19 Dec 2018, 11:10

[REQUEST] Script to use rclone to move files to GDrive after downloading?

Post by seannymurrs » 19 Dec 2018, 11:14

I'm looking for what I'm hoping is a relatively simple post-processing script. I'm running NZBGet on a seedbox (Seedboxes.cc) and have used rclone to create a remote to my GDrive. I can't use rclone mount, but I should be able to use rclone move (or copy). What I'd like to do is find a script that will automatically move or copy files to my GDrive after they are successfully downloaded via NZBGet. Is this something someone could help me out with? Thanks in advance to any assistance.

hugbug
Developer & Admin
Posts: 7645
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [REQUEST] Script to use rclone to move files to GDrive after downloading?

Post by hugbug » 19 Dec 2018, 11:46

Someone posted such script on this forum. Try searching the forum for "rclone".

seannymurrs
Posts: 7
Joined: 19 Dec 2018, 11:10

Re: [REQUEST] Script to use rclone to move files to GDrive after downloading?

Post by seannymurrs » 19 Dec 2018, 12:48

I found the post linked below, but I’m having a bit of trouble interpreting what all the commands do and tweaking it to fit my needs.

https://forum.nzbget.net/viewtopic.php? ... 10&p=17466

Where I specifically get lost is when it starts dealing with directories. Right now I’m just looking to get a script that successfully moves any file downloaded. Is there a way to remove that part of the script?

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests