andrehaveman / spotify-node-applescript

Control Spotify on Mac OSX with NodeJS and AppleScript
MIT License
316 stars 38 forks source link

Fix get state for locales that have commas as decimal delimiters #13

Closed rmehner closed 11 years ago

rmehner commented 11 years ago

When your current set locale uses "," as decimal delimiter, AppleScript will automatically use this when you convert the number to a string. This will break the JSON parsing for the callback, as "," is invalid when not in quotes.

rmehner commented 11 years ago

Also: We should think about sharing this replace_chars function. Even though we then have interdependencies between the scripts. But I doubt that this is a real problem.

rmehner commented 11 years ago

Oh, would also be nice to get a 0.2.1 for that as soon as this is merged. Makes it easier for us to depend on. Thank you!

andrehaveman commented 11 years ago

Wouldn't it be simpler to just convert the position to an integer

andrehaveman commented 11 years ago
set cstate to cstate & ",\"position\": " & (player position as integer)
rmehner commented 11 years ago

Would also be a possibility, currently doing that in the app anyway. If you're fine with that, I'll do this.

(Still, replace_chars as shared function would be good, as it is needed in get_track and get_artwork)

rmehner commented 11 years ago

See latest commit.