Author Topic: Play hits by the current playing artist  (Read 3079 times)

0 Members and 1 Guest are viewing this topic.

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Play hits by the current playing artist
« on: April 23, 2014, 07:09:27 PM »
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

Code: [Select]
<?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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Play hits by the current playing artist
« Reply #1 on: April 23, 2014, 07:41:20 PM »
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
« Last Edit: April 23, 2014, 07:44:36 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Play hits by the current playing artist
« Reply #2 on: April 24, 2014, 12:29:58 PM »
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:

Code: [Select]
<?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>
« Last Edit: October 20, 2016, 08:39:29 AM by nime5ter »

Bleazle

  • $upporter
  • Contributor
  • *****
  • Posts: 60
  • Karma: 1
    • View Profile
Re: Play hits by the current playing artist
« Reply #3 on: April 25, 2014, 07:12:33 AM »
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!