Page 1 of 1
help with a script for email
Posted: Wed Apr 03, 2013 9:09 pm
by jesterod
i have a script that is suposted to make a torrent name into something that its better to look at but i cant get it to work right payload = (u'Forbidden', u'Planet', u'(1956)') gets
fp = Forbidden
tail = Forbidden
name Forbidden
the code is
Code: Select all
from os import path
print "payload =",eg.event.payload
fp = eg.event.payload[0]
print "fp =", fp
head, tail = path.split(fp)
print "tail =", tail
name, ext = path.splitext(tail)
print "name", name
eg.result = "The Torrent with the name of %s" % name
eg.globals.testVar = eg.result
so i need some help... thanks if any one helps
Re: help with a script for email
Posted: Wed Apr 03, 2013 9:26 pm
by cfull1
Are you just trying to make it into one string? If so, this should work:
Code: Select all
name = ' '.join(eg.event.payload)
eg.result = "The Torrent with the name of %s" % name
eg.globals.testVar = eg.result
Re: help with a script for email
Posted: Thu Apr 04, 2013 1:11 am
by jesterod
thank you that worked great for torrents with spaces is there a way to clean up show torrents like this is what i get emailed i have the raw in there also still because before it wouldn't show all of the ones with spaces
The Torrent with the name of CSI.S13E18.HDTV.x264-LOL has Finished
RAW torrent name: (u'CSI.S13E18.HDTV.x264-LOL',)
oh and by clean up i mean replace the "." with spaces
Re: help with a script for email
Posted: Thu Apr 04, 2013 1:22 am
by cfull1
To replace the dots with spaces you can do:
Code: Select all
name_with_spaces = name.replace(".", " ")
Re: help with a script for email
Posted: Thu Apr 04, 2013 1:31 am
by jesterod
how do i add that to the rest of the code tho ive only just started learning python from codecademy.com and im no where near this far
Re: help with a script for email
Posted: Thu Apr 04, 2013 1:45 am
by cfull1
We all started somewhere
Code: Select all
name = ' '.join(eg.event.payload)
name = name.replace(".", " ")
eg.result = "The Torrent with the name of %s" % name
eg.globals.testVar = eg.result
Re: help with a script for email
Posted: Thu Apr 04, 2013 1:49 am
by jesterod
thank you so much!!
yea im on boolean True False and,or,not atm its getting confusing sadly im guessing half the time
Re: help with a script for email
Posted: Thu Apr 04, 2013 2:53 am
by cfull1
Ah. Have you written code before?
Also you should check out SickBeard and CouchPotato.
Re: help with a script for email
Posted: Thu Apr 04, 2013 3:04 am
by jesterod
no not yet just done small edits very small lol i cant use sickbeard or couchpotato i dont use nzbs or usenet and the some of the shows i download dont show up on earss.it do i have like 5 rss sites in my utorrent just for shows and all the shows i want it to download in my rss downloader list
Re: help with a script for email
Posted: Thu Apr 04, 2013 3:07 am
by cfull1
They do torrents as well.
Re: help with a script for email
Posted: Thu Apr 04, 2013 3:12 am
by jesterod
yes but only from a few sites from what ive read