[Python] Corrie TV (Coronation Street)/Enders renamer script

Come up with a useful post-processing script? Share it here!
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

J03 8LACK wrote:Hey James
have you tryed just running sabtosickbeard.py and see what errors come up.

try it from the command line.

J03
Firstly, thank you for the help with this and the super quick responses. I tried as you suggested and the error is:


NAS> sh sabToSickBeard.py
sabToSickBeard.py: line 22: import: not found
sabToSickBeard.py: line 23: import: not found
sabToSickBeard.py: line 25: syntax error: unexpected word (expecting ")")
J03 8LACK
Full Member
Full Member
Posts: 120
Joined: April 2nd, 2009, 1:33 am

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by J03 8LACK »

Hey James,
looks like you dont have Python installed

try running a find command for python
find . -name "python"

how did you install Sabnzdb and sickbeard with a package or some other method.

J03
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

They are both installed via Synocommunity along with CouchPotatoServer and Python 2.7.3-2
I found another thread that said to use this code (#!/usr/local/python/bin/python -OO) below at the start of the line however I still get an error

Unknown option: -
usage: /usr/local/python/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

Trying again but without the -OO
J03 8LACK
Full Member
Full Member
Posts: 120
Joined: April 2nd, 2009, 1:33 am

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by J03 8LACK »

try with out the -OO

and try just typing ( python ) on the command line.

J03
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

Thanks. I tried both. Typing python says not found and without the -OO gives the error:

ionice: can't execute '/usr/local/sabnzbd/var/scripts/CorrieTVrename.py': No such file or directory

I think I will go back to manual processing of Corrie. At least we still get it. Thank you so much for your help though.

Cheers,
James
J03 8LACK
Full Member
Full Member
Posts: 120
Joined: April 2nd, 2009, 1:33 am

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by J03 8LACK »

Hi James,

LapinFou has alot of good info for running Pyton script on a Synology NAS - http://forums.sabnzbd.org/viewtopic.php?t=10595

A couple points you may want to check.
1. - Off course if you are using an another source other than SynoCommunity package, don't forget to update the first line: #!/usr/local/python/bin/python -OO

2. - Create into the specified script folder a YourScript.py file (don't forget to setup right access to 755)to make it exacutable chmod 755 filename.ext. /!\Warning/!\ this file must be Unix format ! So it is better to create it with vi under a SSH connection or take a look below.

NB: If you want to create the file from a Window platform, you may use the great editor Notepad++. Don't forget to save the file in Unix format (Edit -> EOL Conversion -> Unix). - this could cause many problems if not done.

PS: The script may also be executed as a command line through a Telnet session.
For example: /volume1/download/SABnzbdScripts/YourScript.py "folder path which must be fixed"
If you are executing the command from the folder where is stored the script, the command is
./YourScript.py "folder path which must be fixed"

PM if you need to.
J03
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

Good Morning

I installed SAB and sickbeard on my local Mac this morning and configured it all. When I run the script via cmd line I receive the the same kind of error as on the Synology:


./CorrieTVrename.py: line 1: import: command not found
./CorrieTVrename.py: line 2: import: command not found
./CorrieTVrename.py: line 3: import: command not found
./CorrieTVrename.py: line 4: import: command not found
./CorrieTVrename.py: line 5: import: command not found
./CorrieTVrename.py: line 6: import: command not found
./CorrieTVrename.py: line 7: import: command not found
: command not found: line 8:
: command not found: line 10:
./CorrieTVrename.py: line 11: yourPath: command not found
./CorrieTVrename.py: line 12: failedPath: command not found
: command not found: line 13:
: command not found: line 15:
./CorrieTVrename.py: line 20: goodcount: command not found
./CorrieTVrename.py: line 21: badcount: command not found
./CorrieTVrename.py: line 22: syntax error near unexpected token `('
./CorrieTVrename.py: line 22: `for filename in glob.glob(os.path.join(yourPath, '*coronation.street.*")):
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

I ran python CorrieTVrename.py and this was the output:


Jamess-iMac:Scripts James$ python CorrieTVrename.py
/Users/James/Desktop/SAB/Corrie/coronation.street.26.07.12.[ws.pdtv](1).avi
Orginal filename : coronation.street.26.07.12.[ws.pdtv](1).avi
avi
File is an avi OK to rename
New filename : coronation street - S53E149.avi
/Users/James/Desktop/SAB/Corrie/coronation.street.26.07.12.[ws.pdtv](2).avi
Orginal filename : coronation.street.26.07.12.[ws.pdtv](2).avi
avi
File is an avi OK to rename
New filename : coronation street - S53E149.avi
/Users/James/Desktop/SAB/Corrie/coronation.street.26.07.12.[ws.pdtv].avi
Orginal filename : coronation.street.26.07.12.[ws.pdtv].avi
avi
File is an avi OK to rename
New filename : coronation street - S53E149.avi
No folder supplied - is this being called from SABnzbd?
Jamess-iMac:Scripts James$ python CorrieTVrename.py
/Users/James/Desktop/SAB/Corrie/coronation.street.26.07.12.[ws.pdtv].avi
Orginal filename : coronation.street.26.07.12.[ws.pdtv].avi
avi
File is an avi OK to rename
New filename : coronation street - S53E149.avi
No folder supplied - is this being called from SABnzbd?
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

I then ran python sabToSickBeard.py and this was the error:

Jamess-iMac:Scripts James$ python sabToSickBeard.py
No folder supplied - is this being called from SABnzbd?
Jamess-iMac:Scripts James$
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

when the script gets called with Sab this is the error:

Cannot run script /Users/James/Desktop/SAB/Scripts/CorrieTVrename.py
J03 8LACK
Full Member
Full Member
Posts: 120
Joined: April 2nd, 2009, 1:33 am

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by J03 8LACK »

Hey James,

maybe its the formatting is set wrong.

have you try this, I did create it on a windows Platform.

If you want to create the file from a Window platform, you may use the great editor Notepad++. Don't forget to save the file in Unix format (Edit -> EOL Conversion -> Unix). - this could cause many problems if not done.

I have convert my file to the Unix version try it.

http://www.mediafire.com/?aec2cb252z87g6n


So you got it to run with Python Corrietv.py
but not from Sabnzbd this looks like the shebang it set wrong it needs to point to where your python is installed

try
#!/usr/bin/python or #!/opt/bin/python2.6

Hope it helps
J03
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

OK I'm back for more lol

I have setup everything on a Windows machine (could not find corrietvrename.pyw on .py)

When it downloads now I get this error:

'python' is not recognized as an internal or external command,
operable program or batch file.

I have set the PATHEXT to ;.PY;.PYW
jamesjfa
Jr. Member
Jr. Member
Posts: 50
Joined: June 15th, 2012, 9:37 pm

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by jamesjfa »

woohoo got it working. Added Python to the PATH.

Can I please try the Eastenders script now?

Thank you for everything.
J03 8LACK
Full Member
Full Member
Posts: 120
Joined: April 2nd, 2009, 1:33 am

Re: [Python] Corrie TV (Coronation Street) renamer script

Post by J03 8LACK »

jamesjfa wrote:woohoo got it working. Added Python to the PATH.

Can I please try the Eastenders script now?

Thank you for everything.

Hey James and any others looking for the EastEnder Script.

New EastEnders Renamer setup

Create a Ender_TV Category in Sabnzbd - (same as the corrie_tv but change the name to enders)
Now copy EndersTVrename.py to your Sabnzbd script folder - (same as the corrie_tv but change the name to enders)
Open EndersTVrename.py with your Text editor and change the setup Info. - (same as the corrie_tv but change the name to enders)

Setup your RSS feed like this -

Feed - http://rss.binsearch.net/rss.php?max=10 ... multimedia
Category - enders_tv or what you created in your category settings

your filters should be -

0 --- Requires ----- EastEnders -------- default default default default
1 --- Requires ----- WS/PDTV/XviD --- default default default default
2 --- Accept ------- .2012 --------------- default default default default
3 --- Accept ------- .2013 --------------- default default default default


Here is the new EastEnder Script - ( setup the same as corrie_tv )
http://www.mediafire.com/?g7fewqqymjc05wz

If problems? ask for help?
J03
Post Reply