iTunes Plugin

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

Re: iTunes Plugin

Postby longinus » Mon Oct 03, 2011 12:02 am

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.
longinus
 
Posts: 1
Joined: Sun Oct 02, 2011 11:39 pm

Re: iTunes Plugin

Postby cfull1 » Mon Oct 03, 2011 9:04 pm

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

Re: iTunes Plugin

Postby jitterjames » Mon Oct 03, 2011 9:08 pm

I think if we change

u'Music'

to

None

it should probably work for everyone... Do you want to test that on your systems?
User avatar
jitterjames
Experienced User
 
Posts: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: iTunes Plugin

Postby cfull1 » Tue Oct 04, 2011 12:13 am

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

Re: iTunes Plugin

Postby doopf » Fri Oct 07, 2011 4:59 pm

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?
doopf
 
Posts: 1
Joined: Tue Jul 19, 2011 7:13 am

Re: iTunes Plugin

Postby jitterjames » Fri Oct 07, 2011 8:03 pm

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: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: iTunes Plugin

Postby jitterjames » Fri Oct 07, 2011 8:07 pm

try this one
Attachments
iTunes.zip
(24.83 KiB) Downloaded 126 times
User avatar
jitterjames
Experienced User
 
Posts: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: iTunes Plugin

Postby cfull1 » Tue Oct 11, 2011 12:58 am

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

Re: iTunes Plugin

Postby jitterjames » Tue Oct 11, 2011 1:57 am

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.
User avatar
jitterjames
Experienced User
 
Posts: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: iTunes Plugin

Postby cfull1 » Tue Oct 11, 2011 6:30 pm

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

Re: iTunes Plugin

Postby jitterjames » Tue Oct 11, 2011 7:58 pm

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.
User avatar
jitterjames
Experienced User
 
Posts: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: iTunes Plugin

Postby cfull1 » Sat Oct 15, 2011 11:37 pm

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

Re: iTunes Plugin

Postby nating » Sat Oct 22, 2011 8:18 pm

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.
nating
 
Posts: 5
Joined: Thu Oct 20, 2011 3:28 pm

Re: iTunes Plugin

Postby scottbakertemp » Tue Nov 15, 2011 9:04 pm

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
scottbakertemp
 
Posts: 14
Joined: Sun Nov 28, 2010 7:21 pm

Re: iTunes Plugin

Postby Calliope99 » Thu Jan 05, 2012 4:43 am

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.
Calliope99
 
Posts: 3
Joined: Wed Jan 04, 2012 1:54 pm

PreviousNext

Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 0 guests