Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

help with a script for email

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
jesterod
Posts: 44
Joined: Mon Sep 13, 2010 11:09 am

help with a script for email

Post 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
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: help with a script for email

Post 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
jesterod
Posts: 44
Joined: Mon Sep 13, 2010 11:09 am

Re: help with a script for email

Post 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
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: help with a script for email

Post by cfull1 »

To replace the dots with spaces you can do:

Code: Select all

name_with_spaces = name.replace(".", " ")
jesterod
Posts: 44
Joined: Mon Sep 13, 2010 11:09 am

Re: help with a script for email

Post 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
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: help with a script for email

Post 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
jesterod
Posts: 44
Joined: Mon Sep 13, 2010 11:09 am

Re: help with a script for email

Post 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
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: help with a script for email

Post by cfull1 »

Ah. Have you written code before?

Also you should check out SickBeard and CouchPotato.
jesterod
Posts: 44
Joined: Mon Sep 13, 2010 11:09 am

Re: help with a script for email

Post 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
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: help with a script for email

Post by cfull1 »

They do torrents as well.
jesterod
Posts: 44
Joined: Mon Sep 13, 2010 11:09 am

Re: help with a script for email

Post by jesterod »

yes but only from a few sites from what ive read
Post Reply