Code: Select all
$ ls -al SafeRename.py
-rwxrwxrwx 1 sabnzbd users 1910 Feb 11 15:51 SafeRename.py
$ head -1 SafeRename.py
#!/usr/bin/env python
Cannot run script /home/sabnzbd/.sabnzbd/scripts/SafeRename.py
Code: Select all
$ ls -al SafeRename.py
-rwxrwxrwx 1 sabnzbd users 1910 Feb 11 15:51 SafeRename.py
$ head -1 SafeRename.py
#!/usr/bin/env python
Size 1910 bytes? On my system and github 1858 bytes. Not good on your system.synci wrote:Code: Select all
$ ls -al SafeRename.py -rwxrwxrwx 1 sabnzbd users 1910 Feb 11 15:51 SafeRename.py $ head -1 SafeRename.py #!/usr/bin/env python
Code: Select all
cd /home/sabnzbd/.sabnzbd/scripts/
wget https://raw.githubusercontent.com/sanderjo/SAB-SafeRename/master/SAB-SafeRename.py
chmod +x SAB-SafeRename.py
ls -al SAB-SafeRename.py
./SAB-SafeRename.py BlaBla
Code: Select all
unrar x -p923613061 What.rar
./What.sh
My ideas:synci wrote: Any ideas ?
Clinton Hall has integrated my three fixes back into his script, so that it is now both NZBget and SABnzbd compatible.synci wrote:Dont know why they are doing this ...
Already mailed Clinton Hall for this and added an issue on github, he will look over this.
OK, but do you realize that is part of the rat race? Having said that: what do you suggest as pseudo-code? My shot:synci wrote: I thought its simple to just execute the new sh file if it contains a unpacking command.
Then do the same like before, parse the rename.sh file and rename the files
Code: Select all
find .sh -script, and parse it:
mark this script as handled
if line is a rename, find the parameters and do a safe python rename with those parameters
if line is an unrar command, find the parameters, do a safe pyhton called unrar
if a new .sh-script is there, and parse it
Code: Select all
$ file 19.02.2015.2
19.02.2015.2: Matroska data
Code: Select all
$ file 20.02.2015.50
20.02.2015.50: JPEG image data, JFIF standard 1.02
Code: Select all
$ sudo pip install python-magic
$ python
>>> import magic
>>> magic.from_file("19.02.2015.2")
'Matroska data'
>>> magic.from_file("19.02.2015.2", mime=True)
'video/x-matroska'
>>> import mimetypes
>>> mimetypes.guess_extension('video/x-matroska', strict=True)
'.mpv'
>>> mimetypes.guess_all_extensions('video/x-matroska', strict=True)
['.mpv', '.mkv']