It is currently October 4th, 2024, 6:54 am

Spotify Plugin Released! Now with less bugs!

Plugins and Addons popular with the Community
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Spotify Plugin Released!

Post by .raptor »

Entry_Plug wrote:Hi all..

First of all.. thank you so so so so much for this plugin. I dreamed for so long !

Can you tell me how to add this plugin for this awesome music player ? http://whimsy3sh.deviantart.com/art/Evolution-Music-Player-1-2-371577439

I tried but i failed :/
I will fix that for you after I'm done with the new version.

While I'm here:
What update rate do you guys use for your skins?
User avatar
LeVvE
Posts: 50
Joined: June 20th, 2014, 6:15 pm

Re: Spotify Plugin Released!

Post by LeVvE »

.raptor wrote: I will fix that for you after I'm done with the new version.

While I'm here:
What update rate do you guys use for your skins?
Update=1000

Pretty standard I think.
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Spotify Plugin Released!

Post by .raptor »

New version released!
In the first post

This should fix the lag issues people have been having.
The plugin updates about every 200ms, so an update rate beyond that wont fetch any new data. If anyone wants a version that updates more, i can provide that. Just note that higher update rate means higher leak aswell. Which brings us to the note...

Note: The Spotify memory leak is still not fixed. I will continue researching, but a fix is improbable. There might be some steps that can be taken to mend the problem and i will look into that, updates to come.

LeVvE
Yeah, i was considering a slower update rate to mend the memory leak, but i don't see it as that much of an issue atm. If anyone else then me have their pc online 24/7 and dont like restarting spotify, i can always get you a version with a slower update rate. (Not that I am even sure these two are connected, i just assume so.)
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: Spotify Plugin Released!

Post by exper1mental »

The lag issue is fixed but when loading a skin using your plugin it still causes Rainmeter to lock up for a second or so (mainly when Rainmeter loads the plugin for the first time during that session).


Two Suggestions (unrelated to the above):
- It would be awesome if the skin could retrieve the position of the track (i.e. 3:23)
- Working Shuffle and Repeat buttons would be very handy
Image
User avatar
LeVvE
Posts: 50
Joined: June 20th, 2014, 6:15 pm

Re: Spotify Plugin Released!

Post by LeVvE »

exper1mental wrote:The lag issue is fixed but when loading a skin using your plugin it still causes Rainmeter to lock up for a second or so (mainly when Rainmeter loads the plugin for the first time during that session).


Two Suggestions (unrelated to the above):
- It would be awesome if the skin could retrieve the position of the track (i.e. 3:23)
- Working Shuffle and Repeat buttons would be very handy
It already does the first thing on your list?

[mPosition]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=Position
Substitute="00:00":"--:--"

Thats what I use.
User avatar
VasTex
Posts: 407
Joined: September 20th, 2012, 3:17 pm
Location: USA - Montana

Re: Spotify Plugin Released!

Post by VasTex »

Ah well, it's nice to see that the lag has been fixed. This was probably the biggest issue I had with this, but I'll admit the Memory Leak is still an issue that concerns me.

I think if you research the general topic of memory leaks in either C# or C++ (Whichever you're using) you might be able to find some general guidelines as to how you could go about preventing the issue. I've done a little research on the subject and the main cause of a memory leak is pretty self-explanatory. Essentially it's due to information being grabbed or memory space being allocated and then not deleted or removed. For example, when you grab the progress of the song you would need to grab the info, send it to Rainmeter, then delete that info before grabbing it again. Otherwise the information will pile on in memory until the program in question is stopped and the accumulated memory released.

I've found a few snippets of documentation regarding the issue that you might find interesting. Perhaps you've already looked at them, but I don't feel like you should give up on the problem just because it's difficult. You have already made, what I feel, is the best plugin around for Spotify and I use Spotify so much more than any other music player. With a jailbroken iPod, I haven't touched iTunes in years (On purpose at least). Here are a few of the sites I've come across in the last few minutes regarding Memory Leaks in C++:

CPlusPlus.com "Fixing Pointer Memory Leaks"
ProgrammerInterview.com "What is a Memory Leak in C++?"
EHow.com "How to prevent Memory Leaks in C++"
StackOverflow.com "How to a fix Memory Leak"
CProgramming.com "How to Avoid, and Find(Fix) Memory Errors in your C++ Code"

*Some of these are Forum Posts, others are Tutorials and some are simple documentation, but after looking them over I think they could be useful. I do have experience using a variety of programming languages, but not with writing Plugins or making any DLL files so hopefully this is still useful to you.


As for LeVvE's comment regarding the 'Position' option in the Plugin...
-This needs to be documented on the first post. Nowhere on that post does it list this as an option and although it's somewhat mentioned in the previous comments it does not make it an obvious feature.

-I've been using this overly complicated set of equations that I wrote in order to grab the position based on the percentage and track length (Code Edited from original to avoid confusion):

Code: Select all

[mProgressPerc]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=Progress

[mLength]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=Length

[mLengthConv]
Measure=String
String=[mLength]
DynamicVariables=1
Substitute=":":""

[mLengthToSec]
Measure=Calc
Formula=(((([mLengthConv] - ([mLengthConv] % 100)) / 100) * 60) + ([mLengthConv] % 100))
DynamicVariables=1

[mProgressDispSec]
Measure=Calc
Formula=(((mLengthToSec * ([mProgressPerc] / 100)) % 60) - (((mLengthToSec * ([mProgressPerc] / 100)) % 60) % 1))
DynamicVariables=1

[mProgressDispMin]
Measure=Calc
Formula=((((mLengthToSec * ([mProgressPerc] / 100)) - ((mLengthToSec * ([mProgressPerc] / 100)) % 60)) / 60) % 60)
DynamicVariables=1

[mProgressDispHour]
Measure=Calc
Formula=(((((mLengthToSec * ([mProgressPerc] / 100)) - ((mLengthToSec * ([mProgressPerc] / 100)) % 60)) / 60) - ((((mLengthToSec * ([mProgressPerc] / 100)) - ((mLengthToSec * ([mProgressPerc] / 100)) % 60)) / 60) % 60)) / 60)
DynamicVariables=1
Had this 'Position' option been documented I wouldn't have shaved 3 or 4 years off of my life working out the numbers haha...

At any rate, I'm still very much enthused by the progress that this plugin is making. Please keep up the great work!
01010100 01100101 01100011 01101000 01101110 01101111 01101100 01101111 01100111 01101001
01100011 01100001 01101100 00100000 01000010 01100001 01100100 01100001 01110011 01110011
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Spotify Plugin Released!

Post by .raptor »

VasTex
Well, as i said that's the issue I'm trying to fix at the moment. The only thing that i find weird is that all i do is grab a JSON object from Spotify, and decode it. As the memory leak surfaces in Spotify and not in Rainmeter, I assume no other part of my plugin can really be causing this. It might be Spotify keeping connections open or something like that, but its quite hard to dig into, seeing as none of this is documented at all.

About the position issue, i haven't really been updating the documentation in forever. While you all wait tho, here are all the types of measures the plugin should support(I can in no way guarantee that these will do what their names imply, or not crash your rainmeter, but feel free to try).

Code: Select all

enum MeasureType
        {
            Running,
            Playing,
            Shuffle,
            Repeat,
            Volume,
            Online,
            Progress,
            Position,
            PositionSeconds,
            Length,
            LengthSeconds,
            TrackName,
            TrackURI,
            TrackURL,
            ArtistName,
            ArtistURI,
            ArtistURL,
            AlbumName,
            AlbumURI,
            AlbumURL,
            AlbumArt60,
            AlbumArt85,
            AlbumArt120,
            AlbumArt300,
            AlbumArt640
        }
Note that album art is not handled by type, but rather by Type=AlbumArt and Res=60 (or any of the above).
User avatar
VasTex
Posts: 407
Joined: September 20th, 2012, 3:17 pm
Location: USA - Montana

Re: Spotify Plugin Released!

Post by VasTex »

Yea I suppose it is a little odd that the leak is in Spotify and not Rainmeter since in reality the information in your plugin should be tied to the overall use of Rainmeter, not Spotify.

I really can't say why or how that happens. It really could be an issue with Spotify sending out that information, but the memory usage is normal without your plugin running. Could just be a combination of the two. At any rate I do hope it continues to develop as it has been.

Since I'm here though, I would like to point out that I've been having a noticeable amount of crashes in Rainmeter since updating your plugin with the lag fix. I'd say 1 in 10 refreshes causes Rainmeter to grind to a halt, stop responding and require an application restart. I can't say why this has started happening, but it's possible that your reduced plugin refresh rate might get hit with a request half way through it's update due to a refresh and hang it up.

Not sure really, but reverting to the old version of the plugin, despite lagging horribly, does not crash. It doesn't crash while running though, only during a load or refresh of the skin using the plugin.

Oh the joys of plugin development, right?
01010100 01100101 01100011 01101000 01101110 01101111 01101100 01101111 01100111 01101001
01100011 01100001 01101100 00100000 01000010 01100001 01100100 01100001 01110011 01110011
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Spotify Plugin Released!

Post by .raptor »

VasTex wrote: Oh the joys of plugin development, right?
Heh, you said it :lol:

Been noticing the crashes as well. Guess this is what you get for being exited about "fixing" something... Not really too keen on fixing it either, since i feel I'm now on the completely wrong track. The first idea i had for a fix was much better, but i couldn't get it to work. Would probably shaved quite a bit of the memory leak as well. Think i will go back to trying that one instead.

Oh, and how many instances of SpotifyHelper.exe do you have running?
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Spotify Plugin Released!

Post by .raptor »

New version up, should not crash anymore. (And the lag is still gone :great: )