2013-09-10, 21:33
(2013-09-10, 13:07)McMuzz4 Wrote: Hi pkscuot,
Your statement is very untrue - your information was actually very, very helpful and drove me find motivation to explore to discover a solution and create a patch!!
tl;dr: For some reason Spotimc doesn't like the many repeated JSON requests to the API (though i'm not sure why it only stutters beginning from playback of the second song) - I've posted my solution below.
long version:
After studying the debug log I determined that the pausing occurs exactly when the info is logged "CSoftAEStream::GetFrame - Underrun". Each time this occurred was shortly after a JSON query from artist slideshow that you mentioned. After a bit of googling i discovered that audio stutting + JSON queries could be related to a possible bug with Linux and AudioEngine: http://forum.xbmc.org/showthread.php?tid=147822 where large amounts of JSON queries cause stuttering. I'm still at a loss why the stuttering occurs only after the first song finishes - but anyway..
So I perform some testing:
My first test was I edited the Artist Slideshow python script to allow the first song play through then sleep the artist slideshow script when the second song starts for 10 to 40 seconds, just before the JSON request. This didn't result in anything positive it began stuttering/skipping when AS script finished sleeping.
My second test was to detect if a Spotify stream is playing and pause every second before the JSON query. This resulted in a little less stuttering, so i continued to adjusting until i found a sweet spot at 10 seconds to stop the songs stuttering/skipping. But this was frustrating because while it solved the problem it prevented AS from functioning nice and quickly and took a very long time for artist information to populate, sometimes not until a few songs of playback.
My third test which I have put below is my solution - it will detect if a new song is playing that is a Spotify stream, and if so it will perform the JSON call once and store the response value in a variable. It will then use the stored JSON response to query artist information and not won't call the JSON API again until a different song starts playing
My patch consists of the following, I made changes to two functions:
(btw I'm sure it could be done better I've never used python before - also sorry but I've never contributed to code before so apologies if I should be doing this differently)
Hi!
I'm very interested in this, but I couldn't get your patch to work when I tried to add it manually. I might have done something wrong. Any chance you could upload the file with the modification?