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.

iTunes Plugin

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
longinus
Posts: 1
Joined: Sun Oct 02, 2011 11:39 pm

Re: iTunes Plugin

Post by longinus »

cfull1 wrote:I'm having trouble getting the plugin working.
The open action will work and the first trackchanged triggered, but the get info from that macro and every other action just gives the itunes not running error.
I'm running iTunes 10.4.0, EventGhost 0.4.1.r1540
jitterjames wrote:I have no idea why it is not working for you.
I noticed the same problem, and figured out why it's happening...
The problem is that iTunes 10.4.1 (and probably before that) has a window title of Music, instead of iTunes.
So WindowMatcher function doesn't actually find it I think.

So I changed it to be like this:

Code: Select all

self.windowMatch = eg.WindowMatcher(u"iTunes.exe",u'Music', None, None, None, 1, False, 0.0, 0)
I'm very new to EventGhost, so I'm not sure if that's all that's needed, but it does work fine now, at least for the control functions.. couldn't get any info back from iTunes.
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: iTunes Plugin

Post by cfull1 »

Like a boss! Good call longinus!

I changed it too this

Code: Select all

self.windowMatch = eg.WindowMatcher(u"iTunes.exe", None, None, None, None, 1, False, 0.0, 0)
It all works now just like before.
Last edited by cfull1 on Tue Oct 04, 2011 12:12 am, edited 1 time in total.
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: iTunes Plugin

Post by jitterjames »

I think if we change

u'Music'

to

None

it should probably work for everyone... Do you want to test that on your systems?
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: iTunes Plugin

Post by cfull1 »

Ah! my bad. I copied the code from the previous message but forgot to change it.
Yes I changed it to None and its all works
doopf
Posts: 1
Joined: Tue Jul 19, 2011 7:13 am

Re: iTunes Plugin

Post by doopf »

Hello,
first I wanna thank you for your great work.
But I also got a little Problem:
When minimizing iTunes to tray i get the "iTunes is not running" error.
Do you know any solution?
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: iTunes Plugin

Post by jitterjames »

sure. don't minimize it to the system tray. :lol:

but seriously try changing the False to True in the .py file

eg.WindowMatcher(u'iTunes.exe', None, u'iTunes', None, None, None, True, 0.0, 0)

only problem with this is that it may return more than one window. then you may need to change the None before True to a number, 1, or 2 or 3 etc. to get the right window... 1 will probably work. I don't know if it will change at some point.

example:

eg.WindowMatcher(u'iTunes.exe', None, u'iTunes', None, None, 1, True, 0.0, 0)
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: iTunes Plugin

Post by jitterjames »

try this one
Attachments
iTunes.zip
(24.83 KiB) Downloaded 406 times
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: iTunes Plugin

Post by cfull1 »

Hey jitterjames,
I added some more actions to your plugin that I was looking for.
I tried to keep with the rest of the plugin format with my new stuff.

I added:
  • Toggle Repeat
  • Repeat Off
  • Repeat One
  • Repeat All
Also more Information Retrieval actions:
  • Get the shuffle value
  • Get the repeat value
  • Get the list of playlists in library
  • Get the currently playing playlist name
  • Get a specified playlist's tracks
Feel free to use and change these methods or ignore this haha.
Attachments
__init__.py
(35.31 KiB) Downloaded 379 times
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: iTunes Plugin

Post by jitterjames »

cfull1 wrote:Hey jitterjames,
I added some more actions to your plugin that I was looking for.
I tried to keep with the rest of the plugin format with my new stuff....

Feel free to use and change these methods or ignore this haha.
That's great. Thanks for adding to it. If other users can confirm that this works well for them maybe we can get Pako to put the updated version in the standard install for EventGhost.

FYI I don't use this plugin at all personally. If I were to use iTunes (which I don't) I would probably control it with a combination of this plugin and VoxCommando. You all should feel free to do whatever you like with it. Pako will probably be more picky though when it comes time to add it to the install.

It should also be noted that I was not the sole creator of this plugin, and much of the stuff that stottle put in there I don't even really understand. :lol: I only dabble in python.
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: iTunes Plugin

Post by cfull1 »

Oh I forgot to mention, I found a method in the sdk

Code: Select all

def OnAboutToPromptUserToQuitEvent(self):
It gets called when the user trying to close iTunes.
Right now it prompts you to quit because eventghost is connected to it.
If you could tell iTunes to quit, it will do it automatically and not prompt.
It's just a small thing but I thought I would try.
Right now I'm using this to close:

Code: Select all

self.plugin.workerThread.StdCall('Quit')
Sometimes it works sometimes it doesn't. I have a hard time understanding the action calls because of way its all laid out at the bottom.
If you have any ideas let me know.

Is stottle not around?
User avatar
jitterjames
Experienced User
Posts: 677
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada
Contact:

Re: iTunes Plugin

Post by jitterjames »

I don't know, but you could probably pm him if you need his help with something. I don't think he uses iTunes either though, so he is probably not subscribed to this thread.
cfull1
Experienced User
Posts: 124
Joined: Thu Aug 19, 2010 4:52 am

Re: iTunes Plugin

Post by cfull1 »

I've made some more updates!
  • Cleaned up some of my previous actions
  • Replaced some errors that were displayed when nothing was playing with just a notification
  • Replaced the errors when SearchnPlay is triggered with a blank search field
  • Add Action "PlaySongInPlaylist" - Pretty self explanatory I think
  • I also incremented the version number
Let me know if you guys find any errors or have any feature requests.
I'll talk to Pako about including this release in the install file.
Attachments
__init__.py
iTunes 0.1.11
(37.04 KiB) Downloaded 558 times
nating
Posts: 5
Joined: Thu Oct 20, 2011 3:28 pm

Re: iTunes Plugin

Post by nating »

I just got one of the newer versions of the plugin and it really works just fine. It is working even after a pseudo update to iTunes I made just the other day.

It is nice that an even would tick off every time the track changes making it a lot more dynamic. Polling would be my next concern and I am looking to get past that and have my server updating automatically.
scottbakertemp
Posts: 17
Joined: Sun Nov 28, 2010 7:21 pm

Re: iTunes Plugin

Post by scottbakertemp »

I started using this plugin and it works great. Can someone here recommend software I could use to to reverse engineer the apple remote app? I would like to come up with a way to toggle airplay devices. It looks like everything else I would need is already covered in this plugin.

thanks for all the hard work,
-Scott
Calliope99
Posts: 3
Joined: Wed Jan 04, 2012 1:54 pm

Re: iTunes Plugin

Post by Calliope99 »

MediaPortal Version: 1.2.1
MediaPortal Skin: StreamedMP 1.7.2
Windows Version: Seven Home Edition with SP1
CPU Type: Atom
HDD: 250Gb + 1 Tb
Memory: 2 Gb
1. TV Card: Terratec H7
1. TV Card Type: USB
TV: Panasonic 42"
TV - HTPC Connection: HDMI

Hello,
while MediaPortal is excellent in all other areas I don't like its music section and, moreover, I already have all my music well organized with iTunes so I woud like to launch iTunes from within MP to play my music or (much better, but I understand also much more difficult to implement) to use MP as an iTunes remote.
That's why I have tried more than once to configure and use the iTunes plugin, but to no avail.
I have added my iTunes Music folder to the MP music library, enabled the iTunes plugin using the MP configuration utility and set the mp3, m4a, m4p, aac extensions in its options panel ... and now what?
First of all it's not clear to me what this plugin should do: should I browse my music library with MP and then iTunes would be launched when I click "play" on a music track or should iTunes be launched when I enter the music section from the MP home screen?
Secondly it looks like the plugin is not working at all because, despite my efforts outlined above, nothing of what I have described (or anything else different-than-the-usual) happens when I click play on a music track: MP just starts playing the song as usual while iTunes stays quiet.
Any help would be much appreciated.
Post Reply