Page 2 of 2

Re: sab docker in unraid - bash script not running

Posted: June 6th, 2016, 3:34 pm
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!!

Re: sab docker in unraid - bash script not running

Posted: June 6th, 2016, 3:43 pm
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....

Re: sab docker in unraid - bash script not running

Posted: June 6th, 2016, 4:57 pm
by live4soccer7
It worked with just the print, so now I'll try the full implementation of it. :)

Re: sab docker in unraid - bash script not running

Posted: June 6th, 2016, 6:04 pm
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.

bash script not running - python is the solution

Posted: June 7th, 2016, 12:10 am
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.

Re: sab docker in unraid - bash script not running

Posted: June 7th, 2016, 12:54 pm
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.

Re: sab docker in unraid - bash script not running

Posted: June 7th, 2016, 12:56 pm
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.

Re: sab docker in unraid - bash script not running

Posted: June 7th, 2016, 1:16 pm
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.