aauren / SpotifyToaster

Presents toast notifications (system tray popups) when Spotify changes songs
GNU General Public License v2.0
21 stars 3 forks source link

Crash Windows 8.1 #20

Closed Chris-Barton closed 9 years ago

Chris-Barton commented 9 years ago

Windows 8.1 Spotify 1.0.6.80.g2a801a53

Got this when ddebbuging in VS 2013

image

aauren commented 9 years ago

Thanks for opening this issue. Unfortunately, I don't have a Windows computer at the moment to continue development. I hope to obtain one soon. In the mean time... Can you tell me more about the error?

If I had to guess, I would say that at the time of the error your Spotify window did not contain both the artist and track name. The getCurrentTrackInfo() method tries to split the Spotify Window title into two parts, the artist and track name and return them as an array. The artist being at index 0 and the track being at index 1.

Inside getTrack() (where the error occurs), it checks to make sure that the getCurrenTrackInfo() array is not blank and has more than 1 element, but it was short sighted in not making sure that there were at least 2 elements in there. This is something I would like to remedy when I get a Windows machine to make a new binary. The point being, that the error you are receiving most likely comes from there not being a second item in that array (array index 1) because there was no track name.

Chris-Barton commented 9 years ago

Ive tried to compile the github version but your missing the protectedReasorces.res and some others check your uploading all you properties folder

so i cant debug it properly

its every time you change song it crashes however no error message will popup unless you run it in the debuger

if i can get it to compile ill let you know

aauren commented 9 years ago

The missing protectedResources.res file was purposeful so that I didn't have to share my API keys to LastFM. See the contribution section of the ReadMe for information on how to properly add that back to the project with your own generated API keys in order to build the project.

Chris-Barton commented 9 years ago

Yer just going throught the signing up process

Chris-Barton commented 9 years ago

Ok so got it running would a call stack help not used to c# /.net more of a c++ developer

Chris-Barton commented 9 years ago

image This is where it beaks

image

Call stack

aauren commented 9 years ago

Can you send me:

Chris-Barton commented 9 years ago

image

Chris-Barton commented 9 years ago

change to 0 fix but dont know if works cross platform also mod tracks dont fit on popup

Chris-Barton commented 9 years ago

*most

Chris-Barton commented 9 years ago

sorry head up both

getTrack() getArtist()

Return this "Iron Maiden - The Number Of The Beast - 1998 Remastered Version" i.e Artist - Track

aauren commented 9 years ago

Yeah, that's really helpful. It looks like the split on the "en dash" (/u2013) in getCurrentTrackInfo() isn't working any longer since both the artist and track are being combined into index 0 instead of being split like they were supposed to. If you want you can play around with the split code inside getCurrentTrackInfo() and see if you can get it working. Otherwise, I should be getting my hands on a Windows machine soon here and I'll be able to start debugging it.

It would also be good if it took into account tracks like the Iron Maiden one you pointed out that have dashes as part of the track name, since as the code is now "1998 Remastered Version" would go into index 3 (if it was properly splitting) and wouldn't show up in the track name.

Chris-Barton commented 9 years ago

have some ideas but do you know the max number of characters

Chris-Barton commented 9 years ago

per line

Chris-Barton commented 9 years ago

Fixed it

Changed

if (!string.IsNullOrEmpty(currentTrack)) { strArray = currentTrack.Split('\u2013'); }

To

if (!string.IsNullOrEmpty(currentTrack)) { strArray = currentTrack.Split('-'); }

If this doesn't work on non-windows OS i dont no the equivilent in C# but in c++ you can use

ifdef _WIN32