Snarl

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Snarl

Post by Pako » Mon Jun 30, 2014 11:13 am

blackwind wrote:... This allows Snarl stock icons to be specified (such as "!system-warning").
Thanks for the improvements.
The modified code is available in the repository.

Pako

EpicCyndaquil
Posts: 7
Joined: Tue Jul 15, 2014 12:53 am

Re: Snarl

Post by EpicCyndaquil » Wed Aug 20, 2014 9:13 am

I hate to be a bother (and I know I just asked you something on another site - sorry!) but could you share your configuration for the mediamonkey OSD you have in your first post, or any basic configuration involving payloads? I'm very new to this and just trying to figure it out.

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

Re: Snarl

Post by Pako » Thu Aug 21, 2014 10:26 am

EpicCyndaquil wrote:could you share your configuration for the mediamonkey OSD you have in your first post, or any basic configuration involving payloads?
I ended up with the use MediaMonkey a long time ago.
And actually I do not use Snarl now.
So it is difficult for me to help.
With what part of the configuration you do not know what to do ?

Pako

EpicCyndaquil
Posts: 7
Joined: Tue Jul 15, 2014 12:53 am

Re: Snarl

Post by EpicCyndaquil » Fri Aug 22, 2014 12:52 am

Pako wrote:
EpicCyndaquil wrote:could you share your configuration for the mediamonkey OSD you have in your first post, or any basic configuration involving payloads?
I ended up with the use MediaMonkey a long time ago.
With what part of the configuration you do not know what to do ?
As an example, I'd like to include the artist and title of the currently playing track in a notification whenever a new track starts playing. (I'm using Musicbee with the EventGhost plugin for it, but I'd imagine the process is similar across all music players.) In this post, you mention support for payloads in variables. I assume I would have to do something like that so it knows where to fetch the artist and title from?

Thanks.

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

Re: Snarl

Post by Pako » Fri Aug 22, 2014 7:29 am

EpicCyndaquil wrote:I'm using Musicbee
Great, I'm also using MusicBee.
However, if you want to display MusicBee notification using Snarl, then I suggest another solution.
There is a (brilliant but relatively unknown) Snarl plugin for MusicBee.
It will do a better job (and easier) than indirectly through EventGhost.
EpicCyndaquil wrote:I assume I would have to do something like that so it knows where to fetch the artist and title from?
For this purpose, the said function is not necessary.
This is necessary for example when you want to dynamically change the content of user menu depending on a variable.

Pako

EpicCyndaquil
Posts: 7
Joined: Tue Jul 15, 2014 12:53 am

Re: Snarl

Post by EpicCyndaquil » Sat Aug 23, 2014 5:37 am

Pako wrote: However, if you want to display MusicBee notification using Snarl, then I suggest another solution.
There is a (brilliant but relatively unknown) Snarl plugin for MusicBee.
It will do a better job (and easier) than indirectly through EventGhost.
I actually believe I have seen that plugin before. However, I mostly wanted to do this with Musicbee as a learning example! Additionally, I may want to display an OSD only when I'm using my speakers and not my headphones, something that EventGhost could easily accomplish.
Pako wrote:
EpicCyndaquil wrote:I assume I would have to do something like that so it knows where to fetch the artist and title from?
For this purpose, the said function is not necessary.
This is necessary for example when you want to dynamically change the content of user menu depending on a variable.
That makes sense. But how would I set the content dynamically in a Snarl notification, based on the track? Or, another example to perhaps make this easier - let's say I want to display a notification each time a "Keyboard" event is logged in EventGhost. I want the Snarl notification to display the key(s) pressed (which EventGhost represents as "Keyboard.<key>", like "Keyboard.A". How could I do this?

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

Re: Snarl

Post by Pako » Sat Aug 23, 2014 7:53 am

The problem is that I probably still do not understand what you want.
EpicCyndaquil wrote:As an example, I'd like to include the artist and title of the currently playing track in a notification whenever a new track starts playing.
EpicCyndaquil wrote:Or, another example to perhaps make this easier - let's say I want to display a notification each time a "Keyboard" event is logged in EventGhost. I want the Snarl notification to display the key(s) pressed (which EventGhost represents as "Keyboard.<key>", like "Keyboard.A". How could I do this?
On the attached pictures you can see how it can be solved.
Here is the entire macro:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1669">
    <Folder Name="Snarl demo" Expanded="True">
        <Macro Name="MusicBee -TrackChanged" Expanded="True">
            <Event Name="MusicBee.TrackChanged" />
            <Action>
                Snarl.Notify(u'MusicBeeTrack', u'{eg.event.payload[1].split("\\n")[0]}', u'{("\\n").join(eg.event.payload[1].split("\\n")[1:])}', u'{eg.plugins.MusicBee.NowPlayingCommand(82, 128, None, None)}', 1, -1, -1, 0, [], u'', [(u'', u''), (u'', u''), (u'', u'')], -1, 0, True, 0)
            </Action>
        </Macro>
        <Macro Name="Keyboard - key pressed" Expanded="True">
            <Event Name="Keyboard.*" />
            <Action>
                Snarl.Notify(u'Keyboard', u'Key pressed', u'{eg.event.suffix}', u'{eg.imagesDir+"\\\\cstatic.png"}', 1, 5, -1, 1, [], u'', [(u'', u''), (u'', u''), (u'', u'')], -1, 1, True, 0)
            </Action>
        </Macro>
    </Folder>
</EventGhost>

Note:
In the main dialog Snarl plugin you must create two profiles (Keyboard and MusicBeeTrack).

Pako
Attachments
Snarl_demo_1.png
Snarl_demo_2.png
Snarl_demo_3.png

EpicCyndaquil
Posts: 7
Joined: Tue Jul 15, 2014 12:53 am

Re: Snarl

Post by EpicCyndaquil » Sun Aug 31, 2014 5:20 am

Awesome, that's exactly what I needed!

However, you made a minor mistake that I'd like to point out in case anyone else refers to this in the future:
Pako wrote:

Code: Select all

                Snarl.Notify(u'MusicBeeTrack', u'{eg.event.payload[1].split("\\n")[0]}', u'{("\\n").join(eg.event.payload[1].split("\\n")[1:])}', u'{eg.plugins.MusicBee.NowPlayingCommand(82, 128, None, None)}', 1, -1, -1, 0, [], u'', [(u'', u''), (u'', u''), (u'', u'')], -1, 0, True, 0)
Instead of "\\n", you want to use "\n". Otherwise, split finds no "\\n" and just assumes you want the entire line.

Thanks for the assistance.

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

Re: Snarl

Post by Pako » Sun Aug 31, 2014 9:01 am

EpicCyndaquil wrote:Instead of "\\n", you want to use "\n". Otherwise, split finds no "\\n" and just assumes you want the entire line.
I think you're doing just confusion.
If you copy the macro that I published (as an example) in this post, into your configuration tree
(be careful - directly in EventGhost configuration panel), then everything is correct.
You've probably used some non-standard procedure.

Pako

manuellopez8a
Posts: 1
Joined: Wed Sep 17, 2014 6:03 am

Re: Snarl

Post by manuellopez8a » Wed Sep 17, 2014 6:11 am

Hello, I've been using Eventghost for almost a week (yes, I'm a noob) to work with tasker on my android phone, but everytime I try to create the Snarl plugin, Eventghost crashes (not responding program, so no logs) :c My goal is to get that whatsapp/tasker/eventghost/snarl smart notifications work in order to answer messages via my laptop without pulling my phone out of the pocket.
I've tried with older versions of both programs, snarl and eventghost, and nothing seems to patch the problem. Im using windows 8.1
What can I do??
Thanks in advance :D

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Sun Jan 04, 2015 10:27 pm

Every time I install a new version of EventGhost, it registers a fresh instance of itself in Snarl, thereby discarding my custom settings. Can we get a fix, Pako?
/bw

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

Re: Snarl

Post by Pako » Wed Jan 07, 2015 4:00 pm

blackwind wrote:Every time I install a new version of EventGhost, it registers a fresh instance of itself in Snarl, thereby discarding my custom settings. Can we get a fix, Pako?
I see no way I could affect it.
Have you tried the new version 4.0 beta 2?
It is happening there too?

Pako

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

Re: Snarl

Post by Pako » Thu Jan 08, 2015 5:14 pm

I'm sorry, I finally figured out that it is probably possible (and even very easily).
When you look into the plugin code, you will see there this:

Code: Select all

        self.snarl = pySnarl.SnarlApp(
            "EventGhost.%s" % eg.Version.string, # signature
            "EventGhost",                        # title
            join(eg.imagesDir, "logo.png"),      # icon
            "",                                  # configTool
            "",                                  # hint
            True,                                # IsDaemon
            self.SubEventHandler,                # event handler
            clss)                                # classes
You can try to remove the part where EventGhost version is located.
This should help.
Let me know if it works. Then I make this change as an official.

Pako

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Sun Jan 11, 2015 10:00 pm

Sorry, I didn't see this until after I updated to r1688, but I'd bet my life that you've found the solution. Will confirm after the next update.
/bw

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Wed Jan 21, 2015 10:01 pm

Confirmed fixed.
/bw

Post Reply