[SOLVED][LINUX] Parse/run rename.sh inside archive ?
[SOLVED][LINUX] Parse/run rename.sh inside archive ?
Hey guys,
atm i get much content (mostly tv series) that contains a file named "sffdgdfdhhj45657rtghdg" without extension like *.mkv.
But there is also a rename.sh file inside, can anybody help to to post processing that ?
When i run that rename.sh file everything runs fine and the file gets renamed correctly, but i would prefer the auto mode
One way could be to simply rename the biggest file as same as the nzb name is, but as i said already there is no extension given to that file.
There is a *nzbget* offical script available that can handle exactly this, it doesnt run that rename.sh file, it reads and uses the name inside that rename.sh file.
I dont know if its allowed to link here ?
Sorry for my english
Thanks !
atm i get much content (mostly tv series) that contains a file named "sffdgdfdhhj45657rtghdg" without extension like *.mkv.
But there is also a rename.sh file inside, can anybody help to to post processing that ?
When i run that rename.sh file everything runs fine and the file gets renamed correctly, but i would prefer the auto mode
One way could be to simply rename the biggest file as same as the nzb name is, but as i said already there is no extension given to that file.
There is a *nzbget* offical script available that can handle exactly this, it doesnt run that rename.sh file, it reads and uses the name inside that rename.sh file.
I dont know if its allowed to link here ?
Sorry for my english
Thanks !
Last edited by synci on February 12th, 2015, 6:35 am, edited 1 time in total.
Re: [LINUX] Run rename.sh inside archive ?
Can you post a link to such a .NZB?
Can you post a link to that nzbget script?
Can you post a link to that nzbget script?
Re: [LINUX] Run rename.sh inside archive ?
Hey sander,
thanks for reply.
Here is the script:
https://github.com/clinton-hall/GetScri ... eRename.py
Here the topic for it:
http://nzbget.net/forum/viewtopic.php?f=8&t=1624
NZB maybe by pm ?
thanks for reply.
Here is the script:
https://github.com/clinton-hall/GetScri ... eRename.py
Here the topic for it:
http://nzbget.net/forum/viewtopic.php?f=8&t=1624
NZB maybe by pm ?
Re: [LINUX] Run rename.sh inside archive ?
Yes, NZB via PM.
Can you post the line from such rename.sh containing the "mv" command? Preferrably a small download.
I had a look at the github code, and this is the core part:
So: find the line with "mv" (linux/OSX) or "Move" (windows). In there, get orig and dest filename (some magic handling on dest name), and do the rename.
Can you post the line from such rename.sh containing the "mv" command? Preferrably a small download.
I had a look at the github code, and this is the core part:
Code: Select all
if rename_file:
rename_lines = [line.strip() for line in open(rename_file)]
for line in rename_lines:
cmd = filter(None, re.split('(?:mv|Move)\s+(\S+)\s+(\S+)',line))
if len(cmd) == 2 and os.path.isfile(os.path.join(dirname, cmd[0])):
orig = os.path.join(dirname, cmd[0])
dest = os.path.join(dirname, cmd[1].split('\\')[-1].split('/')[-1])
if os.path.isfile(dest):
continue
print "[INFO] Renaming file %s to %s" % (orig, dest)
try:
os.rename(orig, dest)
except Exception,e:
print "[ERROR] Unable to rename file due to: %s" % (str(e))
sys.exit(NZBGET_POSTPROCESS_ERROR)
Re: [LINUX] Run rename.sh inside archive ?
NZB (1,4GB dl) sent via PM.
Thanks !!!
Here the rename.sh:
Thanks !!!
Here the rename.sh:
Code: Select all
#!/bin/bash
mkdir Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON
mv 27.06.2014.1 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/breaking.bad.s05e09.german.dl.720p.bluray.x264-intention.nfo
mv 27.06.2014.2 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/breaking.bad.s05e09.german.dl.720p.bluray.x264-intention.mkv
mv 27.06.2014.3 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs
mv Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/27.06.2014.4 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/breaking.bad.s05e09.german.dl.1080p.bluray.x264-intention.idx
mv Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/27.06.2014.5 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/breaking.bad.s05e09.german.dl.1080p.bluray.x264-intention.subs.sfv
mv Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/27.06.2014.6 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/breaking.bad.s05e09.german.dl.1080p.bluray.x264-intention.sub
mv Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/27.06.2014.7 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/breaking.bad.s05e09.german.dl.1080p.bluray.x264-intention-eng.idx
mv Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/27.06.2014.8 Breaking.Bad.S05E09.German.DL.720p.BluRay.READ.NFO.x264-iNTENTiON/Subs/breaking.bad.s05e09.german.dl.1080p.bluray.x264-intention-eng.sub
Re: [LINUX] Run rename.sh inside archive ?
Does one rename.sh file contain just one, or more mv commands?
Re: [LINUX] Run rename.sh inside archive ?
I forgot to give that information at the beginning.
Yes, its not only the main video file with that crypted name without extension, all files like .nfo, .sub ... have names like that.
And yes, the rename.sh contains all needed mv commands, for each file, like i posted before.
Yes, its not only the main video file with that crypted name without extension, all files like .nfo, .sub ... have names like that.
And yes, the rename.sh contains all needed mv commands, for each file, like i posted before.
Re: [LINUX] Run rename.sh inside archive ?
OK, so a rename.sh contains a complete list of mv-commands. That's clear.
The NZB you PMed is not downloadable for me, so I'll wait for you to send me a downloadable one.
PS: I wonder why this renaming is done. One thing comes to mind: circumventing early rar scanning ... which is what SABnzbd's feature Unwanted Extensions does ... hmmmm
The NZB you PMed is not downloadable for me, so I'll wait for you to send me a downloadable one.
PS: I wonder why this renaming is done. One thing comes to mind: circumventing early rar scanning ... which is what SABnzbd's feature Unwanted Extensions does ... hmmmm
Re: [LINUX] Run rename.sh inside archive ?
I found more of those downloads: http://nzbindex.com/search/?poster=usen ... %3E&more=1
The MUST_READ.txt says:
... if you dare that, you could write a post-processing script that just finds the *.sh resp *.bat and executes it ....
I really understand why the nzbget script filters the mv commands from the script and executes it own.
TBC ...
The MUST_READ.txt says:
Wow ... running an executable that you just downloaded ...Auf win_click2rename.bat klicken und die Filename werden richtig zurückbennant.
lINUX ...
Linux_2Rename.sh doppelklicken und dann ... im Terminal ausführen wählen
Falls das nicht klappt muss Linux_2Rename.sh vorher nochmal ausführbar gemacht werden.
Dazu mit rechts die Eigenschaften aufrufen und im Reiter Zugriffsrechte das Häckchen bei
Als Programm ausführen anklicken.
Dann wie oben ... Doppelklich und .. im Termial ausführen
Viel Spass
... if you dare that, you could write a post-processing script that just finds the *.sh resp *.bat and executes it ....
I really understand why the nzbget script filters the mv commands from the script and executes it own.
TBC ...
Re: [LINUX] Run rename.sh inside archive ?
Okay, so as i understand you are just before completing the script ?
Im not able to script something like that, donation is okay ?
You dont need any nzb now ?
Im not able to script something like that, donation is okay ?
You dont need any nzb now ?
Re: [LINUX] Run rename.sh inside archive ?
I have it working. Solved two bugs in the original script.
Here it is:
https://raw.githubusercontent.com/sande ... eRename.py
Here it is:
https://raw.githubusercontent.com/sande ... eRename.py
Re: [LINUX] Run rename.sh inside archive ?
Wow thank you so much !!! (Will send you a PM too regarding don)
Just one question, your scripts works great but only when i run it via SSH (/usr/bin/env python SafeRename.py Release)
Its a problem on my OMV machine for sure, but i think its a simple problem you can solve within seconds.
SAB says "Exit(127) /usr/bin/env: python : No such file or directory"
I already tried to edit the python part in your scripts line 1, but as i said it works via SSH.
So "/usr/bin/env python" is possible and works.
Any ideas ?
Thanks !!!
Just one question, your scripts works great but only when i run it via SSH (/usr/bin/env python SafeRename.py Release)
Its a problem on my OMV machine for sure, but i think its a simple problem you can solve within seconds.
SAB says "Exit(127) /usr/bin/env: python : No such file or directory"
I already tried to edit the python part in your scripts line 1, but as i said it works via SSH.
So "/usr/bin/env python" is possible and works.
Any ideas ?
Thanks !!!
Re: [LINUX] Run rename.sh inside archive ?
What is the output of the following commands on your Linux system:
Code: Select all
which python
which env
/usr/bin/env python --version
Re: [LINUX] Run rename.sh inside archive ?
Code: Select all
root@omv:~# which python
/usr/bin/python
root@omv:~# which env
/usr/bin/env
root@omv:~# /usr/bin/env python --version
Python 2.7.3
Re: [LINUX] Run rename.sh inside archive ?
Strange.
Post the output of
Example:
Check first line:
What if you replace the first line with
Post the output of
Code: Select all
ls -al <rename-script>
Code: Select all
$ ls -al SAB-SafeRename.py
-rwxrwxr-x 1 sander sander 1858 feb 11 14:37 SAB-SafeRename.py
Code: Select all
$ head -1 SAB-SafeRename.py
#!/usr/bin/env python
What if you replace the first line with
Code: Select all
#!/usr/bin/python