It is currently March 29th, 2024, 11:02 am

SpotifyPlugin

Share and get help with Plugins and Addons
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

SpotifyPlugin

Post by .raptor »

Currently working on a Spotify plugin including:

Spotify running bool
Playing bool
Shuffle bool
Repeat bool
Progress double (the reason i started this)
Track Length
Volume double
Private mode bool
Offline mode bool
TrackName
TrackURI
TrackURL
ArtistName
ArtistURI
ArtistURL
AlbumName
AlbumURI
AlbumURL

Bangs ready to be implemented, once i understand how bangs work:
Play
Pause
Resume
Stop
Prev
Shuffle
Repeat

Would appreciate all the ideas and help i can get! ;-)
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: SpotifyPlugin

Post by poiru »

How are you obtaining the info? I'd love to add better Spotify support to NowPlaying.

If you're doing this in C/C++, perhaps you might want to consider creating a patch for NowPlaying.
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: SpotifyPlugin

Post by .raptor »

poiru wrote:How are you obtaining the info? I'd love to add better Spotify support to NowPlaying.

If you're doing this in C/C++, perhaps you might want to consider creating a patch for NowPlaying.
To be honest, the only reason i started this project is because the NowPlaying plugin was missing spotify progress. Currently i'm only familiar with C#, but i can give you the source i'm working with if you want to translate (guess i could translate aswell, but id need a few days to read up on C++).

The plugin currently gets its info from spotilocal.com, so it does not work in private mode. (It does work in offline mode tho). I originally had a Newtonsoft.Json deserializer, but that didnt work with rainmeter. (i guess this has something to do with dll to dll calls or something, but im not too experienced with dlls at all). So now i currently just have my own deserializing on the Json object from spotilocal that contains all said info above.

The Json object looks like this

Code: Select all

{
"version": 9, 
"client_version": "0.8.8.454.gfb120cda", 
"playing": true, 
"shuffle": true, 
"repeat": false, 
"play_enabled": true, 
"prev_enabled": true, 
"next_enabled": true, 
"track": {
  "track_resource": {
    "name": "Hunting Pirates", 
    "uri": "spotify:track:0wuhX1OqTf2J9QHoHWkimr", 
    "location": {
      "og": "http://open.spotify.com/track/0wuhX1OqTf2J9QHoHWkimr"
    }
  }, 
  "artist_resource": {
    "name": "Turisas", 
    "uri": "spotify:artist:0ykT1si9XRFPmEvWOnf4YI", 
    "location": {
      "og": "http://open.spotify.com/artist/0ykT1si9XRFPmEvWOnf4YI"
    }
  }, 
  "album_resource": {
    "name": "Stand Up And Fight", 
    "uri": "spotify:album:2kEa4ZBbadkft6JBflHuIw", 
    "location": {
      "og": "http://open.spotify.com/album/2kEa4ZBbadkft6JBflHuIw"
    }
  }, 
  "length": 224, 
  "track_type": "normal"
}, 
"playing_position": 45.33, 
"server_time": 1365171742, 
"volume": 0.49997711, 
"online": true, 
"open_graph_state": {
  "private_session": false, 
  "posting_disabled": true
}, 
"running": true
}
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: SpotifyPlugin

Post by poiru »

.raptor wrote:Currently i'm only familiar with C#, but i can give you the source i'm working with if you want to translate (guess i could translate aswell, but id need a few days to read up on C++).
Sure, I'd be more than delighted to take a look.
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: SpotifyPlugin

Post by .raptor »

poiru wrote: Sure, I'd be more than delighted to take a look.
https://github.com/RobertFrydenlund/SpotifyInterface

If you plan on implementing this, keep in mind that i still have to fix the deserializing (since the json object doesnt have the same structure every time). Working on it as we speak.
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: SpotifyPlugin

Post by poiru »

Thanks. I knew about spotilocal, but have avoided using it as it seems fairly "unstable" (what if they decide to change the JavaScript from where the token is obtained?). That said, it seems to have worked for quite a long time, so I will consider adding support for it when I get some time.