Author Topic: Control Spotify  (Read 57340 times)

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Control Spotify
« on: November 13, 2016, 03:06:29 PM »
I created a plugin to control the Spotify desktop application. Download link here

In the zip file there is a Spotify profile too with all the commands.
« Last Edit: November 03, 2018, 07:06:14 PM by OmiCron »

Malic

  • Full Member
  • ***
  • Posts: 105
Re: Control Spotify desktop application
« Reply #1 on: April 27, 2017, 12:32:55 AM »
Had a few people on my streams complain about this behavior too, but once VA and Spotify are started, you have to have Spotify sit there for 1 to 10 mins with no commands given before it "hooks".

Can see the volume slider move when the command is given but it seems to be random in how it takes to hook into the program to make it actually work.

I have had it work immediately to 30 mins before it randomly connects to control volume.  Part of my checklist now is to make sure both are on the night before so I can make sure it is connected for my morning streams. 

Am playing in VR so it makes it really nice to use voice commands.

SpecialTater

  • Guest
Re: Control Spotify desktop application
« Reply #2 on: April 28, 2017, 08:34:14 AM »
I cannot seem to get a single command to work - spoken commands like "song name" are detected correctly by the recognition engine, but never recognised as commands. The only commands that work are "Music status" and "Close the music player"

Or am I doing it wrong?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Control Spotify desktop application
« Reply #3 on: April 28, 2017, 01:46:22 PM »
The commands that aren't working are suffixes; They require a "Music" prefix, E.G. "Music song name" or "Music play".

SpecialTater

  • Guest
Re: Control Spotify desktop application
« Reply #4 on: April 29, 2017, 12:30:14 AM »
Thanks, got some of the commands being recognised. My next issue may be related what Malic referred to:

16:12:44 - Recognized : 'music song name' (derived command) (Confidence 97)

Gives the response "The current song is not set" even though Spotify is playing a track.

Volume also gives me grief:
16:23:35 - Recognized : 'music volume' (derived command) (Confidence 97) (response is always "The current volume is 100", even though it's not 100)
16:24:03 - Unrecognized : 'music volume to 50'






Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Control Spotify desktop application
« Reply #5 on: April 29, 2017, 01:24:55 PM »
16:12:44 - Recognized : 'music song name' (derived command) (Confidence 97)

Gives the response "The current song is not set" even though Spotify is playing a track.

Volume also gives me grief:
16:23:35 - Recognized : 'music volume' (derived command) (Confidence 97) (response is always "The current volume is 100", even though it's not 100)
If the Spotify API has changed since the last time the plugin was updated(newest file is dated 2016-11-13), it may not be fully functional; You'll have to contact the plugin author about that.


16:24:03 - Unrecognized : 'music volume to 50'
The command would be "music set the volume to 50", clunky as that is(you can modify the command phrase to rectify that).

Malic

  • Full Member
  • ***
  • Posts: 105
Re: Control Spotify desktop application
« Reply #6 on: May 04, 2017, 05:30:14 AM »
I have redone several of the commands to be standalone, as in instead of  "Music, Volume 40", or "Music, Previous Track"  It is just "Volume 40", or "Previous Track".

Just changed it from command suffix to full command and deleted the Music prefix.  If it is triggering on other words, maybe bump up the minimum confidence level.

My reply above was more for the fact that the plugin is a hit or miss when it "hooks"

I can use the commands and change volume, and can see the volume slider move in the volume mixer in windows, but it can take 1 to 10 minutes for it to actually effect spotify.  Once it hooks it is fine, but until then it is just giving volume commands until you hear a change.

savan12986

  • Guest
Re: Control Spotify desktop application
« Reply #7 on: June 04, 2017, 03:09:41 PM »
Tried the plugin, but was unable to get it to function.

For those interested, I've found a way to get VA to control volume increase and decrease without needing an external plugin/application. All other basic media controls work as a generic key press through VA.

You need to break the command into 2:

Increase Volume:
Press Media Play / Pause key and hold for 0.025 seconds and release
Execute command, 'Increase Volume2' (and wait until it completes)
Press Media Play / Pause key and hold for 0.025 seconds and release

Note: (You have to pause the music first or the process is not listed as spotify, it's listed as the name of the song currently playing, so you can't control it if a different song is playing from when you set the command up)(when paused it always shows up as spotify)

Increase Volume2:
Press Left Ctrl+Up keys and hold for 0.025 seconds and release
Press Left Ctrl+Up keys and hold for 0.025 seconds and release
Press Left Ctrl+Up keys and hold for 0.025 seconds and release

Note:  In Increase Volume2 you have to click the check box "send this command to" then under the drop box select spotify (Just like in the note for Increase Volume, Spotify must be running but not playing to be able to select the process from the list) (I've tried combining these into 1 action but you cant send the pause command to spotify while a song is playing since the process name is different)

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify desktop application
« Reply #8 on: July 30, 2017, 10:15:54 PM »
Sorry all to never replied to this thread, I didn't receive any notification there were replies in my thread...

I updated the plugin (v1.1.0.0) with some fixes for the "not set" and the initial connection to Spotify. Feel free to say if there are any other bugs, in this thread or at the email on my website.

And yeah, please note that my included profile has "music" as prefix for all my commands but "close the music player".

Malic

  • Full Member
  • ***
  • Posts: 105
Re: Control Spotify desktop application
« Reply #9 on: September 13, 2017, 08:21:45 AM »
Had a few people asking about this since I stream with this plugin, but it does not seem the newest version has the .VAP file with the commands included anymore?

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify desktop application
« Reply #10 on: September 13, 2017, 08:51:07 AM »
Had a few people asking about this since I stream with this plugin, but it does not seem the newest version has the .VAP file with the commands included anymore?

You are right, I forgot to repackage it with the latest version. I will get a new package version uploaded with the sample profile tonight.

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify desktop application
« Reply #11 on: September 13, 2017, 06:51:04 PM »
Re-uploaded with the VAP profile -> http://www.litpixi.com/va-spotify/

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify desktop application
« Reply #12 on: November 03, 2018, 07:04:46 PM »
I'm ready to announce the resurrection of the VoiceAttack Spotify plugin! After Spotify shut down the local API to control the application, I made a complete rewrite of the plugin using their Web API. Don't worry, the old commands are still there, but a bunch of new ones appeared! The good thing about the Web API is that it opens a lot of possibilities.

So, you can download it here. I included an updated demo VoiceAttack profile into the zip file, so check it out. Please note that my demo profile has the prefix "music" for almost all the commands.

If you have any questions, suggestions or if you find any bugs, just drop me an email and I will look into it. Spread the word, the plugin is back and better than ever!

theadmiralcrunch

  • Guest
Re: Control Spotify
« Reply #13 on: November 08, 2018, 12:25:17 AM »
Just tried it, and it seems to be crashing my Voice Attack. It's a fresh install of VA 1.7.2, and the crash only happens when I've got plugins enabled with the plugin installed. It successfully opens the "succesfully connected" webpage, but voice attack crashes right after.

This is what I get from the VoiceAttackFault.txt


Quote
11/7/2018 11:19:37 PM***************************************************************************************
System.MissingMethodException: Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object, System.Object)'.
   at Microsoft.ApplicationInsights.TelemetryClient.Initialize(ITelemetry telemetry)
   at Microsoft.ApplicationInsights.TelemetryClient.Track(ITelemetry telemetry)
   at Microsoft.ApplicationInsights.TelemetryClient.TrackEvent(EventTelemetry telemetry)
   at Microsoft.ApplicationInsights.TelemetryClient.TrackEvent(String eventName, IDictionary`2 properties, IDictionary`2 metrics)
   at Spotify.SpotifyPlugin.<>c.<VA_Init1>b__17_0(Object sender, AuthSuccessEventArgs e) in S:\Projects\VoiceAttack\Spotify\Spotify\SpotifyPlugin.cs:line 97
   at SpotifyAPI.Web.Auth.SecureWebAPIFactory.<>c__DisplayClass57_0.<<GetWebApiAsync>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__5(Object state)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Control Spotify
« Reply #14 on: November 08, 2018, 12:44:35 AM »
It appears this plugin includes "telemetry", in other words it sends information to someone when you use it, aside from that required for it to function.

I don't see that mentioned anywhere, nor does there appear to be an opt-out.

I'd want to know about this sort of thing were I using this plugin, even if it's all anonymized.

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify
« Reply #15 on: November 08, 2018, 08:56:14 AM »
It appears this plugin includes "telemetry", in other words it sends information to someone when you use it, aside from that required for it to function.

I don't see that mentioned anywhere, nor does there appear to be an opt-out.

I'd want to know about this sort of thing were I using this plugin, even if it's all anonymized.

You are right, I'm using telemetry to track bugs. If it can be a concern for some people, I will add a mention and a way to opt out.

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify
« Reply #16 on: November 08, 2018, 09:34:49 AM »
Just tried it, and it seems to be crashing my Voice Attack. It's a fresh install of VA 1.7.2, and the crash only happens when I've got plugins enabled with the plugin installed. It successfully opens the "succesfully connected" webpage, but voice attack crashes right after.

This is what I get from the VoiceAttackFault.txt


Quote
11/7/2018 11:19:37 PM***************************************************************************************
System.MissingMethodException: Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object, System.Object)'.
   at Microsoft.ApplicationInsights.TelemetryClient.Initialize(ITelemetry telemetry)
   at Microsoft.ApplicationInsights.TelemetryClient.Track(ITelemetry telemetry)
   at Microsoft.ApplicationInsights.TelemetryClient.TrackEvent(EventTelemetry telemetry)
   at Microsoft.ApplicationInsights.TelemetryClient.TrackEvent(String eventName, IDictionary`2 properties, IDictionary`2 metrics)
   at Spotify.SpotifyPlugin.<>c.<VA_Init1>b__17_0(Object sender, AuthSuccessEventArgs e) in S:\Projects\VoiceAttack\Spotify\Spotify\SpotifyPlugin.cs:line 97
   at SpotifyAPI.Web.Auth.SecureWebAPIFactory.<>c__DisplayClass57_0.<<GetWebApiAsync>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__5(Object state)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

For your problem, I suspect you don't have .Net Framework 4.6.1 installed. I will try to target .Net 4.5 instead because this is the version that VoiceAttack using. I will check it out after work to release a new version.

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify
« Reply #17 on: November 08, 2018, 08:46:47 PM »
New version 2.1.0.0:

Quote
  • Added to the documentation the data collection via telemetry.
  • Added a way to opt out from telemetry.
  • Fixed a null reference exception.
  • Downgraded the .Net Framework from 4.6.1 to 4.6 to ensure a minimum requirements.


The minimum .Net Framework I can go is 4.6, so ensure to have this version installed. Note that you can have multiple version of .Net Framework installed side by side. The latest version does not include the prior ones.

theadmiralcrunch

  • Guest
Re: Control Spotify
« Reply #18 on: November 09, 2018, 05:03:07 AM »
Working great for me, now! I didn't even have framework 4.6. Installed it, and everything's great.

Frici

  • Newbie
  • *
  • Posts: 15
Re: Control Spotify
« Reply #19 on: November 14, 2018, 10:38:55 AM »
New version 2.1.0.0:

Quote
  • Added to the documentation the data collection via telemetry.
  • Added a way to opt out from telemetry.
  • Fixed a null reference exception.
  • Downgraded the .Net Framework from 4.6.1 to 4.6 to ensure a minimum requirements.


The minimum .Net Framework I can go is 4.6, so ensure to have this version installed. Note that you can have multiple version of .Net Framework installed side by side. The latest version does not include the prior ones.

This might be being silly or blind but where is the documentation? I don't see it either on the website or the .zip itself. :o

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify
« Reply #20 on: November 24, 2018, 08:22:07 AM »
New version 2.1.0.0:

Quote
  • Added to the documentation the data collection via telemetry.
  • Added a way to opt out from telemetry.
  • Fixed a null reference exception.
  • Downgraded the .Net Framework from 4.6.1 to 4.6 to ensure a minimum requirements.


The minimum .Net Framework I can go is 4.6, so ensure to have this version installed. Note that you can have multiple version of .Net Framework installed side by side. The latest version does not include the prior ones.

This might be being silly or blind but where is the documentation? I don't see it either on the website or the .zip itself. :o

Sorry for the delay, but I don't always receive notification from this thread, I don't know why... The documentation is when you start VoiceAttack with the plugin, a Web page opens to activate the plugin with Spotify Web services. There are two collapsed panels with the documentation and changelogs.

Eomerr

  • Guest
Re: Control Spotify
« Reply #21 on: July 25, 2019, 10:09:42 AM »
I am not seeing the documentation in the zip file for this plugin. Is there someplace i can see the current commands to use this?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Control Spotify
« Reply #22 on: July 25, 2019, 10:13:33 AM »
Did you import the included profile ("Spotify-Profile.vap")? It contains example commands.


Also, in the post above yours the plugin author states:
The documentation is when you start VoiceAttack with the plugin, a Web page opens to activate the plugin with Spotify Web services. There are two collapsed panels with the documentation and changelogs.

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify
« Reply #23 on: July 25, 2019, 10:17:57 AM »
I am not seeing the documentation in the zip file for this plugin. Is there someplace i can see the current commands to use this?

As Pfeil says, there is an included demo profile to test it out that you can import in VoiceAttack. For detailed documentation, when you install the plugin and launch VoiceAttack, a web page opens and you have to sign-in in Spotify and authorize the plugin and after that, you will have a page with all the documentation. This page will open each time you launch VoiceAttack because this is the authentification process with Spotify.

Haha, ninja Pfeil!

Eomerr

  • Guest
Re: Control Spotify
« Reply #24 on: July 25, 2019, 02:47:19 PM »
The only command I have working is to launch spotify. I notice in the directions it says premium do I have to buy a premium version to play spotify?

 Play (Premium only) // For free subscriptions, use VoiceAttack Key Press command "Play/Pause".
Pause (Premium only) // For free subscriptions, use VoiceAttack Key Press command "Play/Pause".

Can someone give me a couple command examples to play a song or playlist? 
I have tried Playlist Country, Play Song Name etc  nothing happens.


Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify
« Reply #25 on: July 25, 2019, 02:59:19 PM »
The only command I have working is to launch spotify. I notice in the directions it says premium do I have to buy a premium version to play spotify?

 Play (Premium only) // For free subscriptions, use VoiceAttack Key Press command "Play/Pause".
Pause (Premium only) // For free subscriptions, use VoiceAttack Key Press command "Play/Pause".

Can someone give me a couple command examples to play a song or playlist? 
I have tried Playlist Country, Play Song Name etc  nothing happens.

When is indicated "Premium", you need to have Spotify Premium subscription. The plugin is totally free. Please, note that my demo profile has "music" as a command prefix. So, almost every command should be said as "music play", "music next" and so on.

The plugin does not support yet free text commands to play songs or playlists. So, if you have a playlist named "Good Night" in Spotify, you need to create a corresponding VoiceAttack command like "music playlist good night" (or whatever you like your command) with the URL to that playlist. In other words, for every playlists or songs that you want in VoiceAttack, you need to create a corresponding command. I do think I have an example in the demo profile for that.

Eomerr

  • Guest
Re: Control Spotify
« Reply #26 on: July 25, 2019, 03:08:04 PM »
Thank you for replying so quickly, its working now,, I missed the Music prefex and thank you for the help on the play lists as well.

Patrick Lavoie

  • Newbie
  • *
  • Posts: 23
Re: Control Spotify
« Reply #27 on: July 25, 2019, 03:09:06 PM »
Thank you for replying so quickly, its working now,, I missed the Music prefex and thank you for the help on the play lists as well.

No problem! :D

blueknight

  • Newbie
  • *
  • Posts: 14
Re: Control Spotify
« Reply #28 on: October 13, 2019, 06:17:37 PM »
Thank you for the playlist working.
Question though, is there a way to active the playlist in Shuffle mode?
I got it working by copying the toggle shuffle command after the initial command, but is that the cleanest way of doing this?

Malic

  • Full Member
  • ***
  • Posts: 105
Re: Control Spotify
« Reply #29 on: November 10, 2019, 02:52:38 AM »
Is there a way to queue up a song, or remove the next song in the queue, or do something to change play lists, but also return to a song in a previous playlist?

Am trying to figure out a way to use the playlist change feature to change playlists for Elite: Dangerous, and be context specific, so exploration music or combat music, but also return to a previous song when something else ends.

A lot of people like to put the Mass Effect music in the galaxy map, but is just the returning to the previous playlist is the bit that I cannot figure out right now