Skip to main content

Topic: foo_softplaylists (Read 165367 times) previous topic - next topic

0 Members and 2 Guests are viewing this topic.
foo_softplaylists
Reply #100
Hey Johan, could you briefly explain what the Recursion Limite does?

foo_softplaylists
Reply #101
Could you add playlists generated from the overall top tracks, hyped tracks,loved tracks. Obviously some people may not have any of these tracks but I think it could be useful for people with a lot of pop music.

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #102
i don't know if you looked at the link i posted in my PM last night but this is really bugging me why my script should cause your component to fail. this is the only relevant part of my script....

Code: [Select]
var username = "marc2003";
var api_key = "my_api_key";
var artist = fb.TitleFormat("$replace(%artist%,&,'%'26)").EvalWithMetadb(g_metadb);
var track = fb.TitleFormat("$replace(%title%,&,'%'26)").EvalWithMetadb(g_metadb);
var url = unescape(encodeURIComponent("http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=" + api_key + "&username=" + username + "&artist=" + artist + "&track=" + track));
xhttp = new ActiveXObject("Microsoft.XMLHTTP");
xhttp.open("GET",url,false);
xhttp.send();


i don't think there is anything i can change?

i looked at the server response when your component fails to love a track after my script runs and it says this...

Quote
POST /2.0/?method=track.love&track=Come%20To%20Me&artist=Bj.rk&api_key=REMOVED&api_sig=REMOVED&sk=REMOVED HTTP/1.1

User-Agent: foo_softplaylists

Host: ws.audioscrobbler.com

Content-Length: 0

Cache-Control: no-cache

HTTP/1.0 403 Forbidden

Date: Thu, 03 Dec 2009 08:23:35 GMT

Server: Apache/1.3.39 (Unix)

X-Proxy-Fix-Up: headers fixed up

X-Web-Node: www185

Connection: close

Content-Type: text/xml; charset=utf-8;

<?xml version="1.0" encoding="utf-8"?>
<lfm status="failed">
<error code="13">Invalid method signature supplied</error></lfm>


the server responses for my script all work as expected. just to be clear - this only happens when the artist or title has special characters in - very strange. i fully understand if you don't have time to look into this - afterall your component works perfectly when my script isn't running. but i'd really like to run the 2 side by side if i can.

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #103
Hey Johan, could you briefly explain what the Recursion Limite does?


When set to default 0, it just lists the similar tracks.
When set to 1, it lists the tracks similar to the similar tracks together with the similar tracks...
And so on...
So don't set it too high.

For next version I will put a global track limit for all the playlists, this will make it impossible for a certain request to keep running endlessly when putting some parameter too high.
  • Last Edit: 03 December, 2009, 08:54:33 AM by JohanDeBock
foo_softplaylists: http://tiny.cc/kh9m9

  • Keesface
  • [*][*]
foo_softplaylists
Reply #104
I just tried with recursion of 2 and 20 feed limit... Took too long .

I love similar tracks with recursion of 1 and feed 10 though.

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #105
the server responses for my script all work as expected. just to be clear - this only happens when the artist or title has special characters in - very strange. i fully understand if you don't have time to look into this - afterall your component works perfectly when my script isn't running. but i'd really like to run the 2 side by side if i can.
At the moment I can't really see what the problem could be. Maybe some more experienced dev can shed a light on this?
Maybe it has omething to do with the connections to or the service provided by Last.fm.
The really strange thing is that it only happen for special chars.
  • Last Edit: 03 December, 2009, 09:59:41 AM by JohanDeBock
foo_softplaylists: http://tiny.cc/kh9m9

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #106
ah well not to worry. i can live with it. i'll just use the website to love tracks with special chars in.

  • Yirkha
  • [*][*][*][*][*]
  • Moderator
foo_softplaylists
Reply #107
this only happens when the artist or title has special characters. your component works perfectly when my script isn't running.
At the moment I can't really see what the problem could be. Maybe it has omething to do with the connections to or the service provided by Last.fm. The really strange thing is that it only happen for special chars.
Well, I don't know anything about the Last.fm API, however Googling reveals that "Invalid method signature supplied" is returned when the api_sig doesn't match the data. Perhaps another charset conversion issue somewhere, like the MD5 sum is calculated on something else than what the server sees and validates it against? Hard to guess why it would be affected by some unrelated script, but it would at least make sense that it happens only on tracks with extended characters.

marc2003, you might want to provide the packet capture in the raw binary format, so that Johan could at least look if the request was sent in proper UTF-8, the signature matches and it's some problem on Last.fm's side, or if it really is not a valid signature for the request and there is some weird bug in the component. But I understand you are sensitive about your API key and stuff.
Full-quoting makes you scroll past the same junk over and over.

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #108
New version:
Soft Playlists 2009-12-04
-Added: possibility to output unmatched track info to console
-Added: aborting code, possibly time consuming tasks can be aborted now
-Changed: various strings cleanup
foo_softplaylists: http://tiny.cc/kh9m9

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #109
marc2003, you might want to provide the packet capture in the raw binary format


i had another look at this and it is the encoding.....

successful action....

Code: [Select]
POST /2.0/?method=track.love&track=Unison&artist=Bj..rk


unsuccesful action

Code: [Select]
POST /2.0/?method=track.love&track=Unison&artist=Bj.rk


and as the api_sig is the same in both cases, that would explain why one fails. but it's still no clearer why it's affected by my script. all this stuff really is way over my head. i'm no programmer.

@Johan, i'm trying to write my own "love" track feature in javascript but i'm falling over at the last hurdle. i've succesfully managed to create a valid api_sig so i can retrieve a session key but i can't create a valid one to love a track. is there anything obviously wrong with what i'm doing? i'm getting the same error 13 as above.

Code: [Select]
var api_sig = md5("api_key" + api_key + "artist" + artist + "methodtrack.lovesk" + sk + "track" + track + secret);
var url = "http://ws.audioscrobbler.com/2.0/?method=track.love&track=" + track + "&artist=" + artist +  "&api_key=" + api_key + "&api_sig=" + api_sig + "&sk=" + sk;
  • Last Edit: 04 December, 2009, 05:53:19 AM by marc2003

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #110
Yes this indeed shows why the signature didn't match, and indeed we still don't know why they influence eachother.
For some reason the data is sended non UTF encoded and then it fails. But why does it do that?

About your code:
Seems to be ok.
Is your sk ok?
Are you doing a http POST?
  • Last Edit: 04 December, 2009, 10:44:21 AM by JohanDeBock
foo_softplaylists: http://tiny.cc/kh9m9

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #111
i'm making some slight progress. earlier on i was using the javascript function encodeURIComponent on track.getinfo feeds and it was working perfectly. so i stupidly assumed i could use encodeURIComponent on track.love too but i'm completely wrong. removing this function allows my api_sig to check out ok and i can even love tracks - but only plain text ones. i'm back to square one if they have special characters. 

  • Yirkha
  • [*][*][*][*][*]
  • Moderator
foo_softplaylists
Reply #112
For some reason the data is sended non UTF encoded and then it fails. But why does it do that?
Obviously it's the XMLHTTP ActiveX object doing something weird with the WinInet API, because it affects whole process and not just its own HINTERNET. However you can specify that you are always going to push the host/path/query data in UTF-8, and you don't want anyone meddling with it, using the following code:
Code: [Select]
  DWORD value = CP_UTF8;
  InternetSetOptionA(hInternet, INTERNET_OPTION_CODEPAGE, &value, sizeof(value));
  InternetSetOptionA(hInternet, INTERNET_OPTION_CODEPAGE_PATH, &value, sizeof(value));
  InternetSetOptionA(hInternet, INTERNET_OPTION_CODEPAGE_EXTRA, &value, sizeof(value));
It makes the encoding problem go away, at least here on Win7/x64.
Note you probably shouldn't be very strict in checking the return values here (well not that your current code does...), because according to MSDN, there are some limitations for those flags:
Quote
Windows XP with SP2 and Windows Server 2003 with SP1:  This flag is not supported.
Version: Requires Internet Explorer 7.0.

Full-quoting makes you scroll past the same junk over and over.

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #113
Ok, thanks for hopefully clearing this out!
Will try the changes for next version.
foo_softplaylists: http://tiny.cc/kh9m9

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #114
New version:
Soft Playlists 2009-12-05
-Changed: fixed various bugs

Try this version marc2003 and report.
foo_softplaylists: http://tiny.cc/kh9m9

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #115
yup, working fine. many thanks for your efforts.

it's now running it complete harmony with my script. using WSH panel mod i've created a button that runs your component and then immediately queries the track.getinfo service to pull the playback stats and "loved" status and writes it to my file tags. 





  • ExUser
  • [*][*][*][*][*]
  • Read-only
foo_softplaylists
Reply #116
^ that is a very nicely designed UI, IMO

foo_softplaylists
Reply #117
yup, working fine. many thanks for your efforts.

it's now running it complete harmony with my script. using WSH panel mod i've created a button that runs your component and then immediately queries the track.getinfo service to pull the playback stats and "loved" status and writes it to my file tags. 


  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #118
nope. wsh panel mod is columns UI only. you can easily run it with a standard columns layout though. it doesn't have to use PSS/el_playlist like i'm using.

  • halluci
  • [*]
foo_softplaylists
Reply #119
For the next version, can you add an option to include the original track from which a similar songs playlist is generated?

  • marc2003
  • [*][*][*][*][*]
foo_softplaylists
Reply #120
nope.


i've changed my mind. it is possible using foo_dockable_panels. i've tested it and it works fine. i'll post up a "how to" when i can be bothered. (sorry Johan for all this off-topic talk )

screenshot
(note the little panel in the bottom right corner)

foo_softplaylists
Reply #121
Awesome, I'd be really interested in seeing how you do this.

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #122
New version:
Soft Playlists 2009-12-06
-Added: handling of <duration> and <trackNum> tags when saving and loading XSPF playlists
-Changed: more error handling
foo_softplaylists: http://tiny.cc/kh9m9

  • Galleon
  • [*]
foo_softplaylists
Reply #123
Sorry for off top. Is there software to generate XSPF playlists from Last.fm?

  • JohanDeBock
  • [*][*][*][*]
  • Developer
foo_softplaylists
Reply #124
No idea, I know they provide XSPF playlists as an alternative for some feeds.
Maybe I can include a special Last.fm -> XSPF submenu in future plugins with the same fucntion but for  Last.fm -> XSPF playlist instead of  Last.fm -> foobar library based playlist.
foo_softplaylists: http://tiny.cc/kh9m9