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) and Pushbullet (plugin)?

Questions and comments specific to a particular plugin should go here.
Post Reply
juanpg
Posts: 3
Joined: Tue Aug 05, 2014 7:43 pm

iTunes (plugin) and Pushbullet (plugin)?

Post by juanpg »

Yesterday I found and installed the wonderful plugin by Pako for Pushbullet. It's just great! Now, I wanted to see if it's possible to combine two different plugins in one macro.

I have some macros that are called through the webserver to control iTunes (Pause, Play, Next Song, Previous Song), and what I wanted to do was use the information that the iTunes plugin generates (When a new track is playing, a "TrackChanged" event is fired with information about the Album, Artist, Duration and Name of the song) and send that through Pushbullet.

I tried reading the iTunes code, and that, from what I understood, puts in the Payload object the previous four properties. But I don't know how to read them in the Pushbullet action.

Any help?
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: iTunes (plugin) and Pushbullet (plugin)?

Post by Pako »

iTunes - it's not my favorite program (I think MusicBee is much better).
And therefore I have no experience with iTunes plugin. It follows that my solution may be wrong.
However - you can try:
PB-iTunes_1.png
PB-iTunes_1.png (3.41 KiB) Viewed 2810 times
PB-iTunes_2.png
Here is the entire code of macros - you can use copy / paste directly into your configuration:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1669">
    <Macro Name="PushBullet: Push" Expanded="True">
        <Event Name="iTunes.TrackChanged" />
        <Action>
            PushBullet.Push(0, [[u'Dick', u'[email protected]', 'user', True]], [u'iTunes: {eg.event.payload["name"]}', u'{eg.event.payload["artist"]}\n{eg.event.payload["album"]}'], u'')
        </Action>
    </Macro>
</EventGhost>
It is obvious that you have to change the recipient.

Pako
juanpg
Posts: 3
Joined: Tue Aug 05, 2014 7:43 pm

Re: iTunes (plugin) and Pushbullet (plugin)?

Post by juanpg »

Thanks Pako for your help. I know that iTunes isn't the best, but I have enough stuff running on my PC already :)

I tried your suggestion but didn't work. I get the following errors.

I found the relevant portion of the iTunes code where the TrackChanged event is fired. I noticed the "Payload" variable there is with an uppercase P, and tried that as well, but didn't work either.

Code: Select all

class iTunesEvents():
    def OnPlayerPlayEvent(self, iTrack):
        track = self.comInstance.CurrentTrack
        Payload = {}
        Payload["name"] = track.Name
        Payload["artist"] = track.Artist
        Payload["album"] = track.Album
        Payload["duration"] = track.Duration
        self.plugin.TriggerEvent("TrackChanged",Payload)
Here's what my macro looks like right now:

Code: Select all

    <Macro Name="iTunes: Next track" Expanded="True">
        <Event Name="HTTP.iTunesNext" />
        <Action>
            iTunes.Skip()
        </Action>
        <Action>
            PushBullet.Push(0, [[u'Guille', u'xxxxxxxxxxxxx', 'pc', True]],  [u'iTunes: {eg.event.payload["name"]}', u'{eg.event.payload["artist"]}\n{eg.event.payload["album"]}'], u'')
        </Action>
    </Macro>
Again, thanks for the assistance and for your great work with the Pushbullet plugin.
Attachments
EG Error
EG Error
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: iTunes (plugin) and Pushbullet (plugin)?

Post by Pako »

You can not run a macro using the event iTunes.Next, because there is no payload.
You must use the event iTunes.TrackChanged.
Strictly speaking - you have to have two macros.
One macro for the action iTunes: Next track and second macro for the action PushBullet: Push.

Pako
juanpg
Posts: 3
Joined: Tue Aug 05, 2014 7:43 pm

Re: iTunes (plugin) and Pushbullet (plugin)?

Post by juanpg »

I see. I got it to work now. With that understanding I created two more macros, triggered by the System.Idle and System.UnIdle, in order to enable/disable the PushBullet action. That way I only get the notifications when I'm away from my PC.

Thanks a lot for your help!
Post Reply