IPB

Welcome Guest ( Log In | Register )

17 Pages V  « < 3 4 5 6 7 > »   
Reply to this topicStart new topic
foo_softplaylists, Aggregated playlists from last.fm's loved track feature
Fractal_Mortalit...
post Dec 3 2009, 04:09
Post #101





Group: Members
Posts: 374
Joined: 20-June 05
Member No.: 22863



Hey Johan, could you briefly explain what the Recursion Limite does?


--------------------
http://www.last.fm/user/magnumforce2006
Go to the top of the page
+Quote Post
Dr_Colossus
post Dec 3 2009, 05:36
Post #102





Group: Members
Posts: 71
Joined: 8-July 08
Member No.: 55505



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.
Go to the top of the page
+Quote Post
marc2003
post Dec 3 2009, 09:43
Post #103





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



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
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. smile.gif
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 3 2009, 12:27
Post #104





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



QUOTE (Fractal_Mortality @ Dec 3 2009, 04:09) *
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.

This post has been edited by JohanDeBock: Dec 3 2009, 14:54


--------------------
foo_softplaylists: http://tiny.cc/kh9m9
Go to the top of the page
+Quote Post
Keesface
post Dec 3 2009, 14:33
Post #105





Group: Members
Posts: 96
Joined: 23-November 09
From: The Netherlands
Member No.: 75220



I just tried with recursion of 2 and 20 feed limit... Took too long tongue.gif.

I love similar tracks with recursion of 1 and feed 10 though.
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 3 2009, 15:59
Post #106





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



QUOTE (marc2003 @ Dec 3 2009, 09:43) *
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. smile.gif
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.

This post has been edited by JohanDeBock: Dec 3 2009, 15:59


--------------------
foo_softplaylists: http://tiny.cc/kh9m9
Go to the top of the page
+Quote Post
marc2003
post Dec 3 2009, 17:01
Post #107





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



ah well not to worry. i can live with it. i'll just use the website to love tracks with special chars in.
Go to the top of the page
+Quote Post
Yirkha
post Dec 3 2009, 23:01
Post #108





Group: FB2K Moderator
Posts: 2359
Joined: 30-November 07
Member No.: 49158



QUOTE (JohanDeBock @ Dec 3 2009, 15:59) *
QUOTE (marc2003 @ Dec 3 2009, 09:43) *
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.
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 4 2009, 02:01
Post #109





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



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
Go to the top of the page
+Quote Post
marc2003
post Dec 4 2009, 11:51
Post #110





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (Yirkha @ Dec 3 2009, 22:01) *
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
POST /2.0/?method=track.love&track=Unison&artist=Bj..rk


unsuccesful action

CODE
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. tongue.gif

@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
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;


This post has been edited by marc2003: Dec 4 2009, 11:53
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 4 2009, 16:40
Post #111





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



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?

This post has been edited by JohanDeBock: Dec 4 2009, 16:44


--------------------
foo_softplaylists: http://tiny.cc/kh9m9
Go to the top of the page
+Quote Post
marc2003
post Dec 4 2009, 18:01
Post #112





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



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. crying.gif
Go to the top of the page
+Quote Post
Yirkha
post Dec 5 2009, 00:33
Post #113





Group: FB2K Moderator
Posts: 2359
Joined: 30-November 07
Member No.: 49158



QUOTE (JohanDeBock @ Dec 4 2009, 16:40) *
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
  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.
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 5 2009, 02:25
Post #114





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



Ok, thanks for hopefully clearing this out!
Will try the changes for next version.


--------------------
foo_softplaylists: http://tiny.cc/kh9m9
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 5 2009, 18:47
Post #115





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



New version:
Soft Playlists 2009-12-05
-Changed: fixed various bugs

Try this version marc2003 and report.


--------------------
foo_softplaylists: http://tiny.cc/kh9m9
Go to the top of the page
+Quote Post
marc2003
post Dec 5 2009, 19:07
Post #116





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



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. cool.gif




Go to the top of the page
+Quote Post
Canar
post Dec 5 2009, 19:57
Post #117





Group: Super Moderator
Posts: 3327
Joined: 26-July 02
From: princegeorge.ca
Member No.: 2796



^ that is a very nicely designed UI, IMO


--------------------
∑:<
Go to the top of the page
+Quote Post
Fractal_Mortalit...
post Dec 6 2009, 03:21
Post #118





Group: Members
Posts: 374
Joined: 20-June 05
Member No.: 22863



QUOTE (marc2003 @ Dec 5 2009, 13:07) *
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. cool.gif



Pretty sweet... I don't supose anything like this could be accomplished with the default ui? unsure.gif


--------------------
http://www.last.fm/user/magnumforce2006
Go to the top of the page
+Quote Post
marc2003
post Dec 6 2009, 04:17
Post #119





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



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.
Go to the top of the page
+Quote Post
halluci
post Dec 6 2009, 05:02
Post #120





Group: Members
Posts: 5
Joined: 6-July 09
Member No.: 71230



For the next version, can you add an option to include the original track from which a similar songs playlist is generated?
Go to the top of the page
+Quote Post
marc2003
post Dec 6 2009, 14:26
Post #121





Group: Members
Posts: 4330
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (marc2003 @ Dec 6 2009, 03:17) *
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)
Go to the top of the page
+Quote Post
Fractal_Mortalit...
post Dec 6 2009, 16:15
Post #122





Group: Members
Posts: 374
Joined: 20-June 05
Member No.: 22863



Awesome, I'd be really interested in seeing how you do this.


--------------------
http://www.last.fm/user/magnumforce2006
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 7 2009, 00:28
Post #123





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



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
Go to the top of the page
+Quote Post
Galleon
post Dec 7 2009, 04:41
Post #124





Group: Members
Posts: 37
Joined: 11-December 07
Member No.: 49477



Sorry for off top. Is there software to generate XSPF playlists from Last.fm?
Go to the top of the page
+Quote Post
JohanDeBock
post Dec 8 2009, 15:51
Post #125





Group: Developer
Posts: 250
Joined: 23-March 05
Member No.: 20866



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
Go to the top of the page
+Quote Post

17 Pages V  « < 3 4 5 6 7 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st April 2014 - 04:58