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.

Search found 20 matches

by Flook
Sun Dec 11, 2011 4:32 am
Forum: Plugin Support
Topic: DirectoryWatcher2 and python
Replies: 3
Views: 2069

Re: DirectoryWatcher2 and python

Got it working again. No idea why but I had to redo the credentials to access the network path. Then, after restarting eventghost, it worked again. All is well.
by Flook
Sun Dec 11, 2011 4:03 am
Forum: Plugin Support
Topic: DirectoryWatcher2 and python
Replies: 3
Views: 2069

Re: DirectoryWatcher2 and python

Been using directory watcher for years on some network folders and now after updating eventghost it does not work for the network paths. It works fine for a local folder just not a network path. Directory watcher says version 1.0. Is there a 2.0 and is so where can I find it? I've ran searches ...
by Flook
Mon Sep 20, 2010 7:39 pm
Forum: General Support
Topic: python to parse eg.event.payload path
Replies: 5
Views: 6061

Re: python to parse eg.event.payload path

Awesome!! Thanks for the reply. Mine has been working great but this is much more simple and exactly what I was looking for.

I have to say it feels great watching my automated system work. Just the idea that I'm able to specifically unrar newly downloaded content to another directory, rename ...
by Flook
Mon Aug 09, 2010 8:59 pm
Forum: General Support
Topic: python to parse eg.event.payload path
Replies: 5
Views: 6061

Re: python to parse eg.event.payload path

I now have it working! Probably not the cleanest as I'm sire this could have been done in one python script. I played with python stuff for a while and ended up with just the end I was missing but could not combine the beginning and end so I created two scripts, one for the proper beginning, and one ...
by Flook
Mon Aug 09, 2010 8:36 pm
Forum: General Support
Topic: python to parse eg.event.payload path
Replies: 5
Views: 6061

Re: python to parse eg.event.payload path

Thought it was working but for weird names it cleans it up too much.

(u'\\\\HTPC\\Torrent-Finished\\Misc\\example.DVDRip.XviD-name',)

comes out to
\\HTPC\Torrent-Finished\Misc\example.DVDRip

It's missing the end ".XviD-name"

Any ideas?
by Flook
Mon Aug 09, 2010 8:00 pm
Forum: General Support
Topic: python to parse eg.event.payload path
Replies: 5
Views: 6061

Re: python to parse eg.event.payload path

I just got it after about a 100 variations. I needed to change

name, ext = path.splitext(tail) to
name, ext = path.splitext(fp)

Final code:
from os import path
fp = eg.event.payload[0]
name, ext = path.splitext(fp)
eg.result = name
eg.globals.miscPath = eg.result

example of my use of the eg ...
by Flook
Mon Aug 09, 2010 7:46 pm
Forum: General Support
Topic: python to parse eg.event.payload path
Replies: 5
Views: 6061

python to parse eg.event.payload path

I've previously gotten help to create an awesome python script that parses eg.event.payload to give me only the filename at the end so that I can email it to me. The thread is here http://www.eventghost.org/forum/viewtopic.php?f=2&t=2462 and this is the final code:
from os import path
fp = eg ...
by Flook
Tue Apr 13, 2010 7:30 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

Maybe I need set a global variable in the python script based on the result and then access that variable in the expression. I'll try that out and see what happens.

edit: Hell yea! It worked.


from os import path
fp = eg.event.payload[0]
head, tail = path.split(fp)
name, ext = path.splitext(tail ...
by Flook
Tue Apr 13, 2010 6:43 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

Spent forever now trying to get this in my email subject line of my email.

Is there a way to get this code in one python line or a way to refer to the result of this script or can I save this as a .py file and load it in a python expression that I run in the subject line?

from os import path
fp ...
by Flook
Tue Apr 13, 2010 5:24 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

Oh yea! Looks good with the [0]

DirectoryWatcher3.Updated (u'\\\\HTPC\\Torrent-Finished\\TV\\exampleFileName_2.avi',)
Python Script
payload = (u'\\\\HTPC\\Torrent-Finished\\TV\\exampleFileName_2.avi',)
fp = \\HTPC\Torrent-Finished\TV\exampleFileName_2.avi
tail = exampleFileName_2.avi
name ...
by Flook
Tue Apr 13, 2010 4:59 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

Got this from the python forums.

change: head, tail = path.split(fp)
to:head, tail = path.split(fp[0])

Tried it but then get another error:
Python Script
Traceback (most recent call last):
Python script "77", line 4, in <module>
head, tail = path.split(fp[0])
IndexError: tuple index out of range ...
by Flook
Tue Apr 13, 2010 4:17 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

That was the print command I was looking for. Here is the result.
Python Script
payload = (u'\\\\HTPC\\Torrent-Finished\\TV\\New File',)
Traceback (most recent call last):
Python script "75", line 5, in <module>
head, tail = path.split(fp)
File "ntpath.pyc", line 181, in split
TypeError ...
by Flook
Tue Apr 13, 2010 4:06 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

from os import path
fp = eg.event.payload[: -1]
print
#fp = u'\\\\HTPC\\Torrent-Finished\\TV\\exampleFileName.avi'
head, tail = path.split(fp)
#print tail
name, ext = path.splitext(tail)
#print name
entireSentence = "New Episode of %s" % name

Gives me this in eg log:

DirectoryWatcher3.Updated (u ...
by Flook
Tue Apr 13, 2010 3:27 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

Getting this error still

DirectoryWatcher3.Updated (u'\\\\HTPC\\Torrent-Finished\\TV\\New File_3',)
Python Script
Traceback (most recent call last):
Python script "42", line 4, in <module>
head, tail = path.split(fp)
File "ntpath.pyc", line 181, in split
TypeError: cannot concatenate 'str' and ...
by Flook
Tue Apr 13, 2010 12:29 pm
Forum: General Support
Topic: How to parse event.payload to get filename without the path?
Replies: 14
Views: 5167

Re: How to parse event.payload to get filename without the path?

Looks good. This is exactly what I ended up with except the last line. In my other post I said when I put fp = eg.event.payload then there is an error on the next line. Here is the error I get from my eventghost log:

DirectoryWatcher3.Created (u'\\\\HTPC\\Torrent-Finished\\TV\\New File',)
Python ...