sab docker in unraid - bash script not running

Come up with a useful post-processing script? Share it here!
live4soccer7
Newbie
Newbie
Posts: 17
Joined: June 6th, 2016, 1:09 am

Re: sab docker in unraid - bash script not running

Post by live4soccer7 »

It printed the path. Now it just bugs the heck out of me as to why bash doesn't print the variable or even work at all. I'm going to run a couple test on your script and get it implemented. I'm sure it'll work without a hitch. Thank you very much for your help!!
live4soccer7
Newbie
Newbie
Posts: 17
Joined: June 6th, 2016, 1:09 am

Re: sab docker in unraid - bash script not running

Post by live4soccer7 »

It looks like my array is too large:

IndexError: list index out of range

I'll cut it down and see if it works and then deal with that.

Edit: nvm, I was trying to run it with arg[1] in a local directory. duh....
live4soccer7
Newbie
Newbie
Posts: 17
Joined: June 6th, 2016, 1:09 am

Re: sab docker in unraid - bash script not running

Post by live4soccer7 »

It worked with just the print, so now I'll try the full implementation of it. :)
live4soccer7
Newbie
Newbie
Posts: 17
Joined: June 6th, 2016, 1:09 am

Re: sab docker in unraid - bash script not running

Post by live4soccer7 »

It worked like a charm :) Thanks again!!

Next up will be to tackle the obfuscated names. The folders seem to always get named appropriately, however the file doesn't always seem to get the naming.
User avatar
sander
Release Testers
Release Testers
Posts: 9070
Joined: January 22nd, 2008, 2:22 pm

bash script not running - python is the solution

Post by sander »

live4soccer7 wrote:It worked like a charm :) Thanks again!!
Cool. If you post the script here in a CODE block, others can use it.
live4soccer7
Newbie
Newbie
Posts: 17
Joined: June 6th, 2016, 1:09 am

Re: sab docker in unraid - bash script not running

Post by live4soccer7 »

Of course! Here it is. Make sure to make the file executable. I did chmod 777 on it. I think you can also use chmod +x. Also, give the filename an extension of .py

Code: Select all

#!/usr/bin/python

import os
import sys

listnotwanted = ['.nfo', '.sfv', '.nzb', '.srr', '.info', '.idx', '.txt', '.com', '.db', '.md5', '.par2', '.png', '.1', '.jpg', '.jpeg', '.url', '.lnk', '.html', '.ini', '.bat', '.com', '.exe', '.scr', '.sample', '.tbn', '.xml', '.dmg']   # in lower case

startdir = sys.argv[1]

for root, dirs, files in os.walk(startdir):
   path = root.split('/')
   for file in files:
      fullpath =  '/'.join(path) + '/' + file
      for notwant in listnotwanted:
         if fullpath.lower().endswith(notwant):
            print "go away:", fullpath
            os.remove(fullpath)
This will remove all file extensions in the listnotwanted variable. Add or remove as you please. It is good for movies and tv shows, but can be tailored for any download category easily.
live4soccer7
Newbie
Newbie
Posts: 17
Joined: June 6th, 2016, 1:09 am

Re: sab docker in unraid - bash script not running

Post by live4soccer7 »

Any input on dealing with obfuscated filenames? It seems like sab may get them sometimes and sometimes not. I did see the "Hunter" script, but that appears to be for Windows only folk.
User avatar
sander
Release Testers
Release Testers
Posts: 9070
Joined: January 22nd, 2008, 2:22 pm

Re: sab docker in unraid - bash script not running

Post by sander »

live4soccer7 wrote:Any input on dealing with obfuscated filenames? It seems like sab may get them sometimes and sometimes not. I did see the "Hunter" script, but that appears to be for Windows only folk.
check-out:
https://forums.sabnzbd.org/viewtopic.ph ... me#p106159
https://forums.sabnzbd.org/viewtopic.ph ... 52#p105830
Post your question there, or in a separate thread.
Post Reply