News:

VoxCommando works with Amazon Echo, Domoticz, EventGhost, Google Assistant, IFTTT, iTunes, J.River Media Center, Kodi, MediaMonkey, Nest, Philips Hue, Vera, Wemo, and the list keeps growing!

Main Menu

Play hits by the current playing artist

Started by Bleazle, April 23, 2014, 07:09:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bleazle

You know the scenario, you've got some random music playing (e.g. a playlist, a genre or an AutoDJ list etc) and you hear a song and think "I'd like to hear the songs by that Artist" - or does that just happen to me?  ::) ;D

This command will load all songs (well up to 200 in this case..) rated at >60 in your music database for the currently playing artist  ;D

<?xml version="1.0" encoding="utf-8"?>
    <commandGroup open="True" name="Play more songs by this artist" enabled="True" prefix="" priority="0" requiredProcess="" description="">
        <command id="171" name="Play more songs by this artist" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
            <action>
                <cmdType>MM.SoftMute</cmdType>
                <cmdString>20</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>MM.currentsongdata</cmdType>
                <cmdString>Artist</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>OSD.ShowText</cmdType>
                <cmdString>{lastresult}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <if ifBlockDisabled="False" ifNot="False">
                <ifType>LastActionSuccess</ifType>
                <ifParams>&amp;&amp;</ifParams>
                <then>
                    <action>
                        <cmdType>TTS.SpeakSync</cmdType>
                        <cmdString>Please wait while I select hits by {lastresult}</cmdString>
                        <cmdRepeat>1</cmdRepeat>
                    </action>
                </then>
                <else>
                    <action>
                        <cmdType>TTS.SpeakSync</cmdType>
                        <cmdString>I'm sorry I don't know who sings this song</cmdString>
                        <cmdRepeat>1</cmdRepeat>
                    </action>
                </else>
            </if>
            <action>
                <cmdType>MM.LoadBySQL</cmdType>
                <cmdString>Artist = '{lastresult}' and rating&gt;60 order by random() limit 200</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>MM.Play</cmdType>
                <cmdString />
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>MM.SoftUnmute</cmdType>
                <cmdString />
                <cmdRepeat>1</cmdRepeat>
            </action>
            <phrase>Play more songs by this artist</phrase>
        </command>
    </commandGroup>


I'm happy with the command but the one issue I have is that it stops (and clears) the currently playing song. I don't mind that it clears the "now playing" list but the main reason I (generally) want to play more songs by the currently playing artist is because I like the song I'm listening to  ::) If anyone has got another way to do this I'd love to see it  :)

jitterjames

#1
Nice post Bleazle.  I like this type of stuff!  :clap

Be careful about your If >> LastActionSuccess.  It should follow immediately after the MM call to get the artist name, not after the OSD action which will always succeed.

The simplest solution for your problem is not a full solution, but you can add the Special parameter to the MM.LoadBySQL action with a value of "Mix".  This would keep playing the current song, also keep the existing playlist, but shuffle the new tracks (songs rated>60 by the current artist) into the remaining playlist.  I have a similar command where I say "Mix in songs by artist {1}"

I thought I had also created another special parameter value for MM.LoadBySQL other than "Mix", but it seems undocumented so I will need to check.  If possible it would be good to have a playNext option or something similar.

Finally, it is probably possible to find a clever work around, where you set a variable with the artist name that you want, and then create a command that is triggered by MM.TrackEnd
This command would (at the end of every song) check to see if there was a value stored for the artist, and if so, create the new mix, and then clear the variable.  Not ideal but it would work.  ;D

jitterjames

#2
If you are using VC version 2 you can try this updated MM plugin (attached)

I have added a new special option for MM.LoadBySQL called "PlayNext"

With the new plugin you can try this updated version of your command:

<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.2.2-->
<command id="171" name="Play more songs by this artist" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>MM.SoftMute</cmdType>
    <params>
      <param>20</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>MM.currentsongdata</cmdType>
    <params>
      <param>Artist</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>LastActionSuccess</ifType>
    <ifParams>&amp;&amp;</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>Please wait while I select hits by {lastresult}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>I'm sorry I don't know who sings this song</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>{lastresult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>MM.LoadBySQL</cmdType>
    <params>
      <param>Artist = '{lastresult}' and rating&gt;60 order by random() limit 25</param>
      <param>Playnext</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>MM.SoftUnmute</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Play more songs by this artist</phrase>
</command>

Bleazle

Hi James

Great stuff, that's what I was after, thanks!  ::bow .... now I need to work out some more ways to use this.... "play more songs from this era/genre/album" maybe?  ;D

Cheers!