Author Topic: broadcast message  (Read 8877 times)

0 Members and 1 Guest are viewing this topic.

painy

  • $upporter
  • Sr. Member
  • *****
  • Posts: 103
  • Karma: 1
    • View Profile
broadcast message
« on: August 21, 2010, 10:18:20 PM »
Hi,

I would like to start off by saying thank you for creating a program with such great potential. Keep up the good work!!

I have a question though,
first off all, i'm a pretty big noob when it comes to both voxcommando and eventghost and i have encountered the following problem.
When I say simple commands such as 'play' and 'pause' to control mediamonkey via eventghost, the following appears in the eventlog ghost: Broadcast.message '(1) button-play \r\n(2)play \r\n'
If i repeat the word 'play' sometimes the log gives me three words or four instead (see image for an example) of two so, i think its depends on how correctly i pronounce the word.
The problem is, when i create an event trigger in mediamonkey, i can only get it to respond to broadcast.message, the event trigger Broadcast.message '(1) button-play \r\n(2)play \r\n' or other variations to this don't activate the mediamonkey play action. The problem with using just broadcast.message as an event trigger is that i'm forced to use broadcast.message as well for stop, next, prev, etc and eventghost doesn't know which is which.
Other command's like mute, where i have basically the same issue with (1) and (2) or more, it mutes my system fine, so i'm not sure where the problem is exactly


only the 'broadcast message' event triggers the play action, the rest does not


Now that i'm here posting, I have another problem.
When working with the tree in voxcommando, in the tutorial you say: double click on the even icon (the lightning thingy) to open the command builder. This does not work for me, it opens nothing :S. I'm working with the latest verion of voxcommando (0.79) and use windows 7.

Kind regards

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #1 on: August 21, 2010, 11:21:16 PM »
yes, I can see why you are confused.  Sorry about that.  the broadcast.message is actually not intended to be used to trigger events in the normal sense.  Let me explain a bit.

If you say a command, sometimes vox will realize that there are other alternate things that you might have said.  so it will execute the most likely one.  the message command sends a list of the alternates that can be displayed using eventghost's onscreen display.  that's why the \r\n is in there.  that's the code for a new line of text.  After the alternate commands are display you can select them by saying option1, option 2 etc.  The new version of VoxCommando can also display the alternates itself.  It always sends that message to eventGhost, but you don't need to do anything with it.

The reason you are not seeing the other command, the "play" command.  Is that those commands button-play etc. are actually being sent to (or trying to send to) windows media center, not eventGhost.

All of this confusion is probably actually coming from the fact that you are not able to edit the command by double clicking.  If you could, you would see that those commands are actually WMC commands.

I don't know why you are having this problem with the double click.   Luckily there are other ways to open the command builder.

-right click the command (lightning icon) and choose "build" form the context menu
or
-select the command (lighting icon) and press enter (or Alt-B)

If that doesn't work grab the latest, latest version from here. (you should do that anyway)

If none of that works, please zip up your entire VC directory and send it to me.  You can try to send it to james@voxcommando.com, but I'm not sure if it will accept a zip with an .exe in it.  To be safe you can probably just rename the .zip to .jpg but if you do that please remind me when you send it.

Welcome to the community and thanks for your patience.  Hopefully once you get over this stumbling block you'll start having some fun!

btw, the newest version has 3 tabs on the main interface and one of them is called groups.  You can't edit anything there, you still have to open the command tree by pressing the "Edit" button.

James

painy

  • $upporter
  • Sr. Member
  • *****
  • Posts: 103
  • Karma: 1
    • View Profile
Re: broadcast message
« Reply #2 on: August 22, 2010, 08:42:11 AM »
Thanks for your reply!
It seems i was running 0.733 after all, rather then 0.79 like i said in my post. I've updated to 0.794 and i'm now able to open the command builder without any problems.
Thanks to your reply, i seem to be getting the hang out of working with eventghost and i can now control mediamonkey.
I have a new problem though with the new version, see my reply here http://voxcommando.com/forum/index.php?topic=55.0

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #3 on: August 22, 2010, 09:28:56 AM »

painy

  • $upporter
  • Sr. Member
  • *****
  • Posts: 103
  • Karma: 1
    • View Profile
Re: broadcast message
« Reply #4 on: August 22, 2010, 06:15:37 PM »
I've got most things working now, but I have a couple of other questions.

1) I tried configuring the command for playing genres in mediamonkey (e.g. play me some jazz), when I say this command out loud it sends the command Broadcast.genre 'jazz' to eventghost.
When i try configuring the action in eventghost: Load Playlist by Filter: Jazz to be triggered by the event: Broadcast.Genre 'jazz' it does not execute the action. When i change Broadcast.Genre 'jazz' to just Broadcast.Genre however, it does execute my voice command. I know i could add a new phrase for every genre in my music library in voxcommando, and create the eventghost commmando for example 'Genrejazz' but I'm guessing that this isn't how you had the payload thingy in mind. How did you solve this in the demonstration movies?

2) I cannot get any of the 'information retrieval' actions from the mediamonkey plugin in eventghost to work, the actions in EG are executed (e.g. in the log: Mediamonkey: Get volume) but nothing happens. I should have the latest version of the mediamonkey plugin (0.2.12). Any ideas? or should i just contact the creator of that plugin instead on the evenghost fora

3) I can get the 'ex box artist' voice command to work in XBMC, but i can't get Voxcommando to send a 'Play some (artist)' command to eventghost. I have enabled all the options in the eventghost options tab but it doesn't seem to be sending any commands to the eventghost log. And if i would be able to get it to work, how do i use the mediamonkey plugin to create a filter/playlist for that artist (preferably loading from an XML file containing my artist)?

4) When using the command 'google search' it almost immediately opens up a new tab in my firefox but unfortunately, when the page is loaded (after 0.5) seconds, the list of other options disappears without me being able to read any of the other possible commands i might have said, and so i cannot change my search query when the computer didn't understand me correctly. But i guess not much can be done about that

5) What is the sendkeys command for keyboard buttons like windows key and printscreen?

Thanks in advance! I don't need an immediate reply so take your time :)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #5 on: August 22, 2010, 08:05:04 PM »
You are making good progress!

I think I can help with most of this stuff, but I must go feed myself. :P  I am away all day tomorrow. :'(  I'll try to get you going with the genres later tonight since that should be pretty easy.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #6 on: August 22, 2010, 10:13:05 PM »
ok.  Here's the magical code for eventghost to call music from media monkey by artist, album, song, or genre.  You should be able to copy and paste this into your eventGhost config tree.
Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1462">
    <Macro Name="Q Artist, Album, SongTitle, Genre" Expanded="True">
        <Event Name="Broadcast.Artist" />
        <Event Name="Broadcast.Album" />
        <Event Name="Broadcast.SongTitle" />
        <Event Name="Broadcast.Genre" />
        <Action>
            EventGhost.PythonScript(u'maxresults=\'30\'\ndata = eg.event.payload\nprint len(data)\nif ( isinstance(data, str)):\n    searchfor = \'"%\'+data+\'%"\'\nelse:\n    searchfor = \'"\'+data[0]+\'"\'\nif (len(data)&gt;1):\n    if (data[1]=="unrated"):\n        #print "unrated!"\n        searchfor = searchfor+ \' and Rating="-1"\'\n\nsearchterm= eg.event.suffix\n\n\nsearchstring = searchterm+\' like \'+searchfor+\' order by random() limit \'+maxresults\nprint searchstring\neg.plugins.MediaMonkey.LoadPlaylistBySql(u\'\', searchstring, 0, 0, 0, True)\n#eg.plugins.MediaMonkey.LoadPlaylistBySql(u\'\', u\'Artist like "%beat%" order by RANDOM()\', 0, 0, 0, True)\n     ')
        </Action>
    </Macro>
</EventGhost>

getting the music data from mediamonkey intot VoxCommando is a different story.  I don't currently have a direct connection from VC to MediaMonkey like I have with WMC and XBMC.  I modified a MediaMonkey script to create an xml file.  see attached.

You have to put this vbs script into your mediamonkey\scripts folder.  e.g.: C:\Program Files (x86)\MediaMonkey\Scripts
then you need to edit Scripts.ini (which is in the same folder) and paste the following into it.
Quote
[VoxGenXML]
FileName=VoxGenXML.vbs
ProcName=VoxGenXML
Order=2
DisplayName=&VoxGenXML
Description=Save in same folder as Vox and name file artists.xml
Language=VBScript
ScriptType=1

- restart MediaMonkey
- Select all the music you want to use (could be all your music, or just the good stuff / it should be well tagged for this to work properly)
- Look under the menu  File >> Create Reports  and you should see VoxGenXml
- run it and you'll be asked where to save the xml.  Tell it to create a file in your main VoxCommando folder and call it artists.xml
- then you just need to go into the VC options choose the EventGhost tab and put checkmarks and phrases in where appropriate.

This is a long process but after you do it the first time, all you need to do is run the MediaMonkey script and point it to the artists.xml file.  You could also create a smart playlist in MediaMonkey with all the music you want to include.

for the genres I just enter them by hand into the VC command tree.  the genre generation is not automated, because I have a lot of music with meaningless genre tags... and this was originally just for me!

Whew.  If this works for you I'll have to cut and paste this into a wiki article with some pictures so I don't have to answer this one again!

do your best, but don't worry if you run into stumbling blocks.  I'm happy to help.

* If you are not actually using XBMC for music I recommend you go to options and turn it off - If you are going to create artist and album voice commands for both xbmc and mediamonkey it's going to use a lot more memory especially if you have a large music collection.  You'll also have to make sure you use different phrases for each so VC knows which one to execute.  Do you follow?  It must be a lot to absorb.


edit: I've updated the attached script to account for an error that escapeartist found.  It was not filtering out songs with blank names.  This should fix it.
« Last Edit: September 02, 2010, 11:13:37 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #7 on: August 22, 2010, 10:20:14 PM »
If you want to understand my EventGhost Scripts a little better and the relationship between events and payloads in EventGhost this might help:

http://www.eventghost.org/docs/scripting.html

of particular interest in EventGhost is eg.result which lets you do things like display info about the currently playing music.

Here's some more stuff you can paste into the EG tree:
Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1462">
    <Folder Name="Information retrieval" Expanded="True">
        <Macro Name="Get basic song info">
            <Event Name="PS3.Button.Green" />
            <Event Name="Basic Info" />
            <Event Name="Main.MM_playing" Enabled="False" />
            <Action>
                MediaMonkey.DiscretePause()
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.PythonScript(u'eg.globals.songinfo = eg.result\n')
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.PythonScript(u'if eg.result == \'-1\':eg.globals.moreinfo= \'not rated\'\nelse:eg.globals.moreinfo=eg.result+" percent"\neg.globals.songinfo = eg.globals.songinfo+", "+eg.globals.moreinfo\neg.plugins.Speech.TextToSpeech(u\'Microsoft Anna - English (United States)\', -2, eg.globals.songinfo, 0, 80)')
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, True, True, False, True, True, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{eg.result}', u'0;-35;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (124, 209, 120), (0, 0, 0), 0, (0, 0), 0, 5.0, False)
            </Action>
            <Action>
                EventGhost.Wait(2.0)
            </Action>
            <Action>
                MediaMonkey.Play()
            </Action>
            <Action>
                EventGhost.JumpIfLongPress(2.0, XmlIdLink(896))
            </Action>
        </Macro>
        <Macro Name="Get more song info" id="896">
            <Event Name="Main.MM_playing" Enabled="False" />
            <Action>
                MediaMonkey.DiscretePause()
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False], u'')
            </Action>
            <Action>
                EventGhost.PythonScript(u'eg.globals.songinfo = eg.result\n')
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False], u'')
            </Action>
            <Action>
                EventGhost.PythonScript()
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, True, True, False, True, True, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{eg.result}', u'0;-35;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (124, 209, 120), (0, 0, 0), 0, (0, 0), 0, 5.0, False)
            </Action>
            <Action>
                EventGhost.Wait(2.0)
            </Action>
            <Action>
                MediaMonkey.Play()
            </Action>
        </Macro>
        <Macro Name="Whatartist">
            <Event Name="Broadcast.WhatArtist" />
            <Action>
                MediaMonkey.DiscretePause()
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.PythonScript(u"\neg.globals.songinfo = eg.result\neg.plugins.Speech.TextToSpeech(u'Microsoft Anna - English (United States)', -2, eg.globals.songinfo, 0, 100)")
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{eg.globals.songinfo}', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (124, 209, 120), (0, 0, 0), 4, (0, 0), 0, 5.0, True)
            </Action>
            <Action>
                EventGhost.Wait(1.5)
            </Action>
            <Action>
                MediaMonkey.Play()
            </Action>
        </Macro>
        <Macro Name="WhatSong">
            <Event Name="Broadcast.WhatSong" />
            <Action>
                MediaMonkey.DiscretePause()
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.PythonScript(u"\neg.globals.songinfo = eg.result\neg.plugins.Speech.TextToSpeech(u'Microsoft Anna - English (United States)', -2, eg.globals.songinfo, 0, 100)")
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{eg.globals.songinfo}', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (124, 209, 120), (0, 0, 0), 4, (0, 0), 0, 5.0, True)
            </Action>
            <Action>
                EventGhost.Wait(1.5)
            </Action>
            <Action>
                MediaMonkey.Play()
            </Action>
        </Macro>
        <Macro Name="WhatAlbum">
            <Event Name="Broadcast.WhatAlbum" />
            <Action>
                MediaMonkey.DiscretePause()
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.PythonScript(u"\neg.globals.songinfo = eg.result\neg.plugins.Speech.TextToSpeech(u'Microsoft Anna - English (United States)', -2, eg.globals.songinfo, 0, 100)")
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{eg.globals.songinfo}', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (124, 209, 120), (0, 0, 0), 4, (0, 0), 0, 5.0, True)
            </Action>
            <Action>
                EventGhost.Wait(1.5)
            </Action>
            <Action>
                MediaMonkey.Play()
            </Action>
        </Macro>
        <Macro Name="WhatRating">
            <Event Name="Broadcast.WhatRating" />
            <Action>
                MediaMonkey.DiscretePause()
            </Action>
            <Action>
                MediaMonkey.GetBasicSongInfo([False, False, False, False, False, True, False, False, False, False, False, False, False, False, False, False, False])
            </Action>
            <Action>
                EventGhost.PythonScript(u'if eg.result == \'-1\':eg.globals.songinfo= \'not rated\'\nelse:eg.globals.songinfo=eg.result+" percent"\n#eg.globals.songinfo = eg.result\neg.plugins.Speech.TextToSpeech(u\'Acapela Telecom HQ TTS English (US) (Heather 22 kHz)\', -2, eg.globals.songinfo, 0, 100)')
            </Action>
            <Action>
                EventGhost.ShowOSD(u'{eg.globals.songinfo}', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (124, 209, 120), (0, 0, 0), 4, (0, 0), 0, 5.0, True)
            </Action>
            <Action>
                EventGhost.Wait(1.5)
            </Action>
            <Action>
                MediaMonkey.Play()
            </Action>
        </Macro>
        <Macro Name="Display info">
            <Event Name="Display" />
            <Action>
                EventGhost.PythonScript(u'myinfo=eg.plugins.MediaMonkey.GetBasicSongInfo([True, False, True, True, False, True, True, False, False, False, False, False, False, False, False, False, False], u\'!@!\')\nmycommandlineargs = \'\\"\'+myinfo+\'\\"\'\n#print mycommandlineargs\neg.plugins.System.Execute(u\'C:\\\\VoxCommando\\\\WpfSongInfo.exe\', mycommandlineargs, 0, False, 2, u\'\')')
            </Action>
            <Action>
                Window.FindWindow(u'WpfSongInfo.exe', None, None, None, None, None, False, 1.0, 0)
            </Action>
            <Action>
                Window.BringToFront()
            </Action>
        </Macro>
    </Folder>
</EventGhost>
« Last Edit: August 22, 2010, 11:16:00 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #8 on: August 22, 2010, 10:30:52 PM »
Quote
4) When using the command 'google search' it almost immediately opens up a new tab in my firefox but unfortunately, when the page is loaded (after 0.5) seconds, the list of other options disappears without me being able to read any of the other possible commands i might have said, and so i cannot change my search query when the computer didn't understand me correctly. But i guess not much can be done about that

5) What is the sendkeys command for keyboard buttons like windows key and printscreen?

4:  I think you just want the alternates to stay on screen for longer?  Ideally there would be an option to set the period of time that alternates were displayed.  I will hopefully get to it eventually.  You could use the message event with EventGhost's OSD command and then you would have more control over how the alternates were displayed and for how long.
Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1462">
    <Macro Name="Display VoxCommando Message" Expanded="True">
        <Event Name="Message" />
        <Event Name="Broadcast.Chat" />
        <Event Name="HTTP.Message" />
        <Action>
            EventGhost.PythonScript(u'fileencoding = "iso-8859-1"\neg.globals.message = eg.event.payload.decode(fileencoding)\n#print u"before:",eg.globals.message\n')
        </Action>
        <Action>
            EventGhost.ShowOSD(u'{eg.globals.message}', u'0;-37;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 6, (0, 60), 0, 6.0, True)
        </Action>
    </Macro>
</EventGhost>

5: google it.  I don't think there is one for the windows key but you can try ^{ESC}
according to http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx print screen is: {PRTSC}
« Last Edit: August 22, 2010, 10:33:17 PM by jitterjames »

painy

  • $upporter
  • Sr. Member
  • *****
  • Posts: 103
  • Karma: 1
    • View Profile
Re: broadcast message
« Reply #9 on: August 27, 2010, 09:10:09 PM »
Sorry for the late reply, been very busy last few days.
I followed your steps and everything work like a charm up until using the .XML file in Voxcommando. When i add the artists.xml payload it gives the following error when i try to restart vc: Unhandled exception has occured in you application. If you click continue, the application will ignore this error and attempt to continue bla bla.
Clicking continue doesn't work either. I have to remove the artists.xml payload from the commands for it to work again.

Thanks for all your efforts in helping me out btw!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #10 on: August 27, 2010, 10:08:12 PM »
no problem.  This is the xml file generated by mediamonkey that is causing the problems?  Can you post it, or email it to me?  james@voxcommando.com

I think the problem might be that you are trying to use the xml as a payloadXML in a command, but in fact you just need to go to options and select the eventGhost tab, and then enable the artist, album, song options there.  If the file is in the right place it should load everything from that one file.  This was the first method that I developed (a year ago - wow time flies), so it's a bit non-standard.  Hopefully one day everthing will be a bit more consistent.

Let me know if that works, and if not send me the xml file so I can test it.

painy

  • $upporter
  • Sr. Member
  • *****
  • Posts: 103
  • Karma: 1
    • View Profile
Re: broadcast message
« Reply #11 on: August 28, 2010, 09:22:53 AM »
Allrighty, it's just like you said!
I now have nearly everything up and running!
One error though,

The TTS command in EG for things like artist info doesn't seem to be working properly , i recieve the following error:

          Traceback (most recent call last):
           Python script "5", line 3, in <module>
             eg.plugins.Speech.TextToSpeech(u'Microsoft Anna - English (United States)', -2, eg.globals.songinfo, 0, 100)
         AttributeError: 'Bunch' object has no attribute 'Speech'

(i checked and i have microsoft anna - english (US) installed as default tts). The TTS in VC does work).

I don't mind all that much, as the OSD works and that's enough for me, but since you're making this into a wiki entry.

Also, i found that your maxresults for artists was set on 30. Any reason that this is set so low by default? I have set it to 200

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #12 on: August 28, 2010, 09:33:43 AM »
maybe you need to add the speech plugin to EG?

the max results is a personal choice.  I believe the older MediaMonkey plugin was much slower to return results.  That's probably why I had it set so low, to keep my demo snappy.

painy

  • $upporter
  • Sr. Member
  • *****
  • Posts: 103
  • Karma: 1
    • View Profile
Re: broadcast message
« Reply #13 on: August 30, 2010, 05:11:20 PM »
haha, yeah of course, cant believe i didn't think of that.

Here's my last of questions (i think):


I added the following to your EG script: The event "Broadcast.PlaylistByName"
 
Code: [Select]
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1462">
    <Macro Name="Q Artist, Album, SongTitle, Genre" Expanded="True">
        <Event Name="Broadcast.Artist" />
        <Event Name="Broadcast.Album" />
        <Event Name="Broadcast.SongTitle" />
        <Event Name="Broadcast.Genre" />
        <Action>
            EventGhost.PythonScript(u'maxresults=\'30\'\ndata = eg.event.payload\nprint len(data)\nif ( isinstance(data, str)):\n    searchfor = \'"%\'+data+\'%"\'\nelse:\n    searchfor = \'"\'+data[0]+\'"\'\nif (len(data)&gt;1):\n    if (data[1]=="unrated"):\n        #print "unrated!"\n        searchfor = searchfor+ \' and Rating="-1"\'\n\nsearchterm= eg.event.suffix\n\n\nsearchstring = searchterm+\' like \'+searchfor+\' order by random() limit \'+maxresults\nprint searchstring\neg.plugins.MediaMonkey.LoadPlaylistBySql(u\'\', searchstring, 0, 0, 0, True)\n#eg.plugins.MediaMonkey.LoadPlaylistBySql(u\'\', u\'Artist like "%beat%" order by RANDOM()\', 0, 0, 0, True)\n     ')
        </Action>
    </Macro>
</EventGhost>



But the following error appears in mediamonkey when i try to say 'playlist ... ':
There was a problem querying the database: Error executing SQL "Select count(*) FROM songs Where Playlistbyname like "%Top Rated%" order by random() limit 300" : no such column: PlaylistByName (1, 1)

I tried understanding the python script you wrote so i could figure it out myself, but i can't write python (or any other language for that matter :p) so i don't know what's causing it.

Also, which lines would i need to add to the python script so the results with a rating lower then a set value, say three stars, wouldn't be added to the results?

Last question: I was trying to get the 'set volume ...' to work properly but when i use the event broadcast.set volume (xx) to trigger the action to change the master volume or the MM volume nothing happens. I can only get broadcast.set volume to set the volume to a predefined value (like 50%) no matter what value i give. How can i get it to use the broadcast plug in parameters?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: broadcast message
« Reply #14 on: August 30, 2010, 06:35:36 PM »
I hope it is not your last question!

I think for the playlist the simplest is to use a different command.  The mediamonkey plugin has one for playlists.  Try something like this:

Quote
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1462">
    <Action>
        MediaMonkey.LoadPlaylist(u'{eg.event.payload}', 2, 2, 2, True)
    </Action>
</EventGhost>