This API provides some access to the local running Spotify-Client (Windows only).
+You can fetch details for the current track, play/pause, skip/previous track and
+get notified on various events.
+
NOTE: This API is unofficial, things may brake in the future and there is no
+guarantee everything works out of the box.
+
+
First steps
+
Imports
+So after you added the API to your project, you may want to add following imports to your files:
+
using SpotifyAPI.Local; //Base Namespace
+using SpotifyAPI.Local.Enums; //Enums
+using SpotifyAPI.Local.Models; //Models for the JSON-responses
+using SpotifyAPI.Local; //Base Namespace
+
+
+
Basic-Usage
+Now you can actually start fetching infos from your spotify client, just create a new Instance of SpotifyLocalAPI:
+
private static SpotifyLocalAPI _spotify;
+
+public static void Main(String[] args)
+{
+ _spotify = new SpotifyLocalAPI();
+ if (!SpotifyLocalAPI.IsSpotifyRunning())
+ return; //Make sure the spotify client is running
+ if (!SpotifyLocalAPI.IsSpotifyWebHelperRunning())
+ return; //Make sure the WebHelper is running
+
+ if(!_spotify.Connect())
+ return; //We need to call Connect before fetching infos, this will handle Auth stuff
+
+ StatusResponse status = _spotify.GetStatus(); //status contains infos
+}
+
+
+
Anti-Virus Blocking Response
+
Some Anti-Virus Software blocks the response from spotify due wrong headers.
+Currently, it's confirmed for AVG's LinkScanner and Bitdefender.
+Adding http://SpotifyAPI.spotilocal.com:4380 to the URL-Exceptions seems to fix it for most users.
+More infos can be found here
+
Client Status
+
Calling _spotify.GetStatus() after connecting returns the following StatusResponse:
To receive events, make sure you listen for them _spotify.ListenForEvents = true;
+You can set a SynchronizingObject, then the events will be called on the specific context
+
Following events can be overriden:
+
+
OnPlayStateChange - triggers when the player changes from play to pause and vice versa
+
OnTrackChange - triggers when a new track will be played
+
OnTrackTimeChange - triggers when a track is playing and track-time changes
+
OnVolumeChange - triggeres when the internal volume of spotify changes
+
+
Methods
+
Furthermore, following methods are available:
+
+
void Mute() - will mute the Spotify client via WindowsAPI
+
void UnMute() - will unmute the Spotify client via WindowsAPI
+
bool IsSpotifyMuted() - will return wether the Spotify client is muted
+
void SetSpotifyVolume(float volume = 100) - sets the windows volume of spotify (0 - 100)
+
float GetSpotifyVolume() - returns the windows volume of spotify (0 - 100)
+
void Pause() - will pause spotify's playback
+
void Play() - will resume spotify's playback
+
void PlayURL(string uri, string context = "") - will play a spotify URI (track/album/playlist) in the specifc context (can be a album/playlist URI)
+
void Skip() - will skip the track via an emulated media key
+
void Previous() - will play the previous track via an emulated media key
+
bool IsSpotifyRunning() - returns true if a spotify client instance is running, false if not
+
bool IsSpotifyWebHelperRunning() - returns true if a spotify web-helper instance is running, false if not
+
void RunSpotify() - will attempt to start a Spotify instance
+
void RunSpotifyWebHelper() - will attempt to start a Spotify web-helper instance
diff --git a/mkdocs/search_index.json b/mkdocs/search_index.json
index d9c4ad49..c6571f63 100644
--- a/mkdocs/search_index.json
+++ b/mkdocs/search_index.json
@@ -437,13 +437,43 @@
},
{
"location": "/SpotifyLocalAPI/",
- "text": "WIP",
+ "text": "Getting started\n\n\nThis API provides some access to the local running Spotify-Client (Windows only).\n\nYou can fetch details for the current track, play/pause, skip/previous track and\nget notified on various events.\n\n\nNOTE:\n This API is unofficial, things may brake in the future and there is no\nguarantee everything works out of the box.\n\n\n\n\nFirst steps\n\n\nImports\n\nSo after you added the API to your project, you may want to add following imports to your files:\n\n\nusing SpotifyAPI.Local; //Base Namespace\nusing SpotifyAPI.Local.Enums; //Enums\nusing SpotifyAPI.Local.Models; //Models for the JSON-responses\nusing SpotifyAPI.Local; //Base Namespace\n\n\n\n\nBasic-Usage\n\nNow you can actually start fetching infos from your spotify client, just create a new Instance of SpotifyLocalAPI:\n\n\nprivate static SpotifyLocalAPI _spotify;\n\npublic static void Main(String[] args)\n{\n _spotify = new SpotifyLocalAPI();\n if (!SpotifyLocalAPI.IsSpotifyRunning())\n return; //Make sure the spotify client is running\n if (!SpotifyLocalAPI.IsSpotifyWebHelperRunning())\n return; //Make sure the WebHelper is running\n\n if(!_spotify.Connect())\n return; //We need to call Connect before fetching infos, this will handle Auth stuff\n\n StatusResponse status = _spotify.GetStatus(); //status contains infos\n}\n\n\n\n\nAnti-Virus Blocking Response\n\n\nSome Anti-Virus Software blocks the response from spotify due wrong headers.\nCurrently, it's confirmed for AVG's LinkScanner and Bitdefender.\nAdding \nhttp://SpotifyAPI.spotilocal.com:4380\n to the URL-Exceptions seems to fix it for most users.\nMore infos can be found \nhere\n\n\nClient Status\n\n\nCalling \n_spotify.GetStatus()\n after connecting returns the following \nStatusResponse\n:\n\n\npublic int Version { get; set; }\n\npublic string ClientVersion { get; set; }\n\npublic bool Playing { get; set; }\n\npublic bool Shuffle { get; set; }\n\npublic bool Repeat { get; set; }\n\npublic bool PlayEnabled { get; set; }\n\npublic bool PrevEnabled { get; set; }\n\npublic bool NextEnabled { get; set; }\n\npublic Track Track { get; set; }\n\npublic double PlayingPosition { get; set; }\n\npublic int ServerTime { get; set; }\n\npublic double Volume { get; set; }\n\npublic bool Online { get; set; }\n\npublic bool Running { get; set; }\n\n\n\n\nMost of the properties are self-explanatory, some notes:\n\n\n\n\nShuffle\n and \nRepeat\n currently always return \nfalse\n\n\n\n\nCurrent Track\n\n\nThe current Track can be fetched via \n_spotify.GetStatus().Track\n and contains following properties/methods:\n\n\n\n\nTrackResource\n - \nSpotifyResource\n which contains Track \nName\n and \nUri\n\n\nAlbumResource\n - \nSpotifyResource\n which contains Album \nName\n and \nUri\n\n\nArtistResource\n - \nSpotifyResource\n which contains Artist \nName\n and \nUri\n (Only the main artist will be listed)\n\n\nIsAd()\n will check whether the current track is an AD\n\n\nVarious methods for getting the album art:\n\n\nstring GetAlbumArtUrl(AlbumArtSize size)\n\n\nTask\nBitmap\n GetAlbumArtAsync(AlbumArtSize size)\n\n\nBitmap GetAlbumArt(AlbumArtSize size)\n\n\nTask\nbyte[]\n GetAlbumArtAsByteArrayAsync(AlbumArtSize size)\n\n\nbyte[] GetAlbumArtAsByteArray(AlbumArtSize size)\n\n\n\n\nEvents\n\n\nTo receive events, make sure you listen for them \n_spotify.ListenForEvents = true;\n\nYou can set a \nSynchronizingObject\n, then the events will be called on the specific context\n\n\nFollowing events can be overriden:\n\n\n\n\nOnPlayStateChange\n - triggers when the player changes from \nplay\n to \npause\n and vice versa\n\n\nOnTrackChange\n - triggers when a new track will be played\n\n\nOnTrackTimeChange\n - triggers when a track is playing and track-time changes\n\n\nOnVolumeChange\n - triggeres when the internal volume of spotify changes\n\n\n\n\nMethods\n\n\nFurthermore, following methods are available:\n\n\n\n\nvoid Mute()\n - will mute the Spotify client via WindowsAPI\n\n\nvoid UnMute()\n - will unmute the Spotify client via WindowsAPI\n\n\nbool IsSpotifyMuted()\n - will return wether the Spotify client is muted\n\n\nvoid SetSpotifyVolume(float volume = 100)\n - sets the windows volume of spotify (0 - 100)\n\n\nfloat GetSpotifyVolume()\n - returns the windows volume of spotify (0 - 100)\n\n\nvoid Pause()\n - will pause spotify's playback\n\n\nvoid Play()\n - will resume spotify's playback\n\n\nvoid PlayURL(string uri, string context = \"\")\n - will play a spotify URI (track/album/playlist) in the specifc context (can be a album/playlist URI)\n\n\nvoid Skip()\n - will skip the track via an emulated media key\n\n\nvoid Previous()\n - will play the previous track via an emulated media key\n\n\nbool IsSpotifyRunning()\n - returns true if a spotify client instance is running, false if not\n\n\nbool IsSpotifyWebHelperRunning()\n - returns true if a spotify web-helper instance is running, false if not\n\n\nvoid RunSpotify()\n - will attempt to start a Spotify instance\n\n\nvoid RunSpotifyWebHelper()\n - will attempt to start a Spotify web-helper instance",
+ "title": "SpotifyLocalAPI"
+ },
+ {
+ "location": "/SpotifyLocalAPI/#getting-started",
+ "text": "This API provides some access to the local running Spotify-Client (Windows only). \nYou can fetch details for the current track, play/pause, skip/previous track and\nget notified on various events. NOTE: This API is unofficial, things may brake in the future and there is no\nguarantee everything works out of the box.",
"title": "Getting started"
},
{
- "location": "/SpotifyLocalAPI/#wip",
- "text": "",
- "title": "WIP"
+ "location": "/SpotifyLocalAPI/#first-steps",
+ "text": "Imports \nSo after you added the API to your project, you may want to add following imports to your files: using SpotifyAPI.Local; //Base Namespace\nusing SpotifyAPI.Local.Enums; //Enums\nusing SpotifyAPI.Local.Models; //Models for the JSON-responses\nusing SpotifyAPI.Local; //Base Namespace Basic-Usage \nNow you can actually start fetching infos from your spotify client, just create a new Instance of SpotifyLocalAPI: private static SpotifyLocalAPI _spotify;\n\npublic static void Main(String[] args)\n{\n _spotify = new SpotifyLocalAPI();\n if (!SpotifyLocalAPI.IsSpotifyRunning())\n return; //Make sure the spotify client is running\n if (!SpotifyLocalAPI.IsSpotifyWebHelperRunning())\n return; //Make sure the WebHelper is running\n\n if(!_spotify.Connect())\n return; //We need to call Connect before fetching infos, this will handle Auth stuff\n\n StatusResponse status = _spotify.GetStatus(); //status contains infos\n}",
+ "title": "First steps"
+ },
+ {
+ "location": "/SpotifyLocalAPI/#anti-virus-blocking-response",
+ "text": "Some Anti-Virus Software blocks the response from spotify due wrong headers.\nCurrently, it's confirmed for AVG's LinkScanner and Bitdefender.\nAdding http://SpotifyAPI.spotilocal.com:4380 to the URL-Exceptions seems to fix it for most users.\nMore infos can be found here",
+ "title": "Anti-Virus Blocking Response"
+ },
+ {
+ "location": "/SpotifyLocalAPI/#client-status",
+ "text": "Calling _spotify.GetStatus() after connecting returns the following StatusResponse : public int Version { get; set; }\n\npublic string ClientVersion { get; set; }\n\npublic bool Playing { get; set; }\n\npublic bool Shuffle { get; set; }\n\npublic bool Repeat { get; set; }\n\npublic bool PlayEnabled { get; set; }\n\npublic bool PrevEnabled { get; set; }\n\npublic bool NextEnabled { get; set; }\n\npublic Track Track { get; set; }\n\npublic double PlayingPosition { get; set; }\n\npublic int ServerTime { get; set; }\n\npublic double Volume { get; set; }\n\npublic bool Online { get; set; }\n\npublic bool Running { get; set; } Most of the properties are self-explanatory, some notes: Shuffle and Repeat currently always return false",
+ "title": "Client Status"
+ },
+ {
+ "location": "/SpotifyLocalAPI/#current-track",
+ "text": "The current Track can be fetched via _spotify.GetStatus().Track and contains following properties/methods: TrackResource - SpotifyResource which contains Track Name and Uri AlbumResource - SpotifyResource which contains Album Name and Uri ArtistResource - SpotifyResource which contains Artist Name and Uri (Only the main artist will be listed) IsAd() will check whether the current track is an AD Various methods for getting the album art: string GetAlbumArtUrl(AlbumArtSize size) Task Bitmap GetAlbumArtAsync(AlbumArtSize size) Bitmap GetAlbumArt(AlbumArtSize size) Task byte[] GetAlbumArtAsByteArrayAsync(AlbumArtSize size) byte[] GetAlbumArtAsByteArray(AlbumArtSize size)",
+ "title": "Current Track"
+ },
+ {
+ "location": "/SpotifyLocalAPI/#events",
+ "text": "To receive events, make sure you listen for them _spotify.ListenForEvents = true; \nYou can set a SynchronizingObject , then the events will be called on the specific context Following events can be overriden: OnPlayStateChange - triggers when the player changes from play to pause and vice versa OnTrackChange - triggers when a new track will be played OnTrackTimeChange - triggers when a track is playing and track-time changes OnVolumeChange - triggeres when the internal volume of spotify changes",
+ "title": "Events"
+ },
+ {
+ "location": "/SpotifyLocalAPI/#methods",
+ "text": "Furthermore, following methods are available: void Mute() - will mute the Spotify client via WindowsAPI void UnMute() - will unmute the Spotify client via WindowsAPI bool IsSpotifyMuted() - will return wether the Spotify client is muted void SetSpotifyVolume(float volume = 100) - sets the windows volume of spotify (0 - 100) float GetSpotifyVolume() - returns the windows volume of spotify (0 - 100) void Pause() - will pause spotify's playback void Play() - will resume spotify's playback void PlayURL(string uri, string context = \"\") - will play a spotify URI (track/album/playlist) in the specifc context (can be a album/playlist URI) void Skip() - will skip the track via an emulated media key void Previous() - will play the previous track via an emulated media key bool IsSpotifyRunning() - returns true if a spotify client instance is running, false if not bool IsSpotifyWebHelperRunning() - returns true if a spotify web-helper instance is running, false if not void RunSpotify() - will attempt to start a Spotify instance void RunSpotifyWebHelper() - will attempt to start a Spotify web-helper instance",
+ "title": "Methods"
}
]
}
\ No newline at end of file
diff --git a/sitemap.xml b/sitemap.xml
index 29b32be5..2e650d8f 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -4,7 +4,7 @@
None/
- 2016-08-25
+ 2016-08-27daily
@@ -13,92 +13,90 @@
None/SpotifyWebAPI/gettingstarted/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/examples/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/auth/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/albums/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/artists/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/browse/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/follow/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/library/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/playlists/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/profiles/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/search/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/tracks/
- 2016-08-25
+ 2016-08-27dailyNone/SpotifyWebAPI/util/
- 2016-08-25
+ 2016-08-27daily
-
None/SpotifyLocalAPI/
- 2016-08-25
+ 2016-08-27daily
-
\ No newline at end of file