Skip to main content
Topic: My wsh panel code (Read 48255 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

My wsh panel code

Reply #50
lastfm_me_pak.zip updated. User who is using theme.zip, please update your panels, too. Instruction inside the archive.

Changes:
2010-12-08.1:
. Fix a problem when determining similar artist link position in rare cases

Download in first post.

@Primula: Are you sure it didn't work? Here's a pic of how it works for me:

Here, my mouse is hovering over the 2nd similar artist, the mouse should change to a hand and you'll see a balloon tooltip like that. It should work for artist that has text longer than the panel, too.

The problem I fixed wasn't specifically yours as I haven't figured out what's wrong in your config, yet. Did you change anything in my code? Anyway, update to my latest code, post a picture of your foobar config so I can figure out what to try next.

My wsh panel code

Reply #51
it works fine after i update and now i can click on every artist and title except charts title (that 'overall artist chart for blablabla'), doesnt really matter tho as i rarely use it and maybe its intentional? just so you know D:

thanks thuan D:

My wsh panel code

Reply #52
Intentional, I don't see where that should lead to except for the same page as recenttracks title so no I didn't include it. Hum, out of ideas now.

My wsh panel code

Reply #53
Added lastfm scrobble client, still in BETA but I wanna see if there's any feedback.

lastfm_me_pak.zip updated. User who is using theme.zip, please update your panels, too. Instruction inside the archive.

Changes:
2010-12-10:
. lastfm_playingtrackinfo: move every last.fm authentication steps to lastfm_bio panel
. Modify text and streamline lastfm authentication process
. Add lastfm scrobbler (BETA!!!), enable in lastfm_bio context menu, Last.fm options

Sidenotes:
. My lastfm panels use autocorrect feature of lastfm api, thus if your tags aren't precise they still works for artist biography and arts
. Last.fm scrobbler uses autocorrect feature. This is not in line with last.fm documentation but IMO it is better than clogging the database with typos or slightly incorrect tags (foo_audioscrobbler does the same)
. For now the scrobbler does not supports offline very well (still works, but in this case will not use autocorrect when going online) and it does not cache submission between foobar sessions (have a few ideas for these, will do later).

Download in first post.

My wsh panel code

Reply #54
oh wow another update
question tho, can we use your code alongside foo_audioscrobbler? and what's the advantage of this compared to foo_audioscrobbler?
this update kinda confuse me XD

My wsh panel code

Reply #55
Should not enable both at the same time, I still have the unofficial 1.4.7 in my config but it is disabled.

About advantages, I update now playing with duration so the duration of now playing entry appears on lastfm will stuck for the duration of the song not 15-20secs. I haven't checked very closely, but my client will scrobble with every data possible beside track, artist (read here). Lastly, I intend to add options for user to opt out autocorrect features and they can choose which to send. This way for ppl who is sending scrobble that has text appending to their track title (like radio stream), I can also add an option to remove these.

BTW, if you're confused about this update, and don't wanna use the feature, just don't enable it. The panels acts the same way as before, just that when you use the love button and you're not authenticated yet, you don't need to click on the love button again to change love status, it's automatic, now. That's the other change.

My wsh panel code

Reply #56
ah ok, I'll update but disable the scrobble and wait until it out from beta cause i need the cache feature XD
thanks D:

My wsh panel code

Reply #57
lastfm_me_pak.zip updated. User who is using theme.zip, please update your panels, too. Instruction inside the archive.

Changes:
2010-12-12:
. Rewrite last.fm scrobbler client (the first one was quite quick and dirty DOS-flavor, whipped it up when being half conscious from a party, at least the part where I contact last.fm was reusable )
. Add 5 secs delay before contacting last.fm now playing service
. Support caching between foobar2000 sessions
. Fix a problem with scrobbling before because I forgot to encode the message to send to last.fm

Download in first post.

Last.fm scrobbler client still lacks two features of foo_audioscrobbler 1.4.7: only scrobble track in user library and ipod sync feature. Obviously the latter won't be possible to implement here. The former will be implemented soon, I missed the function in the doc.

Still label the thing as BETA, as I don't wanna get yelled at if it does something wrong with your last.fm data (please do tell me what went wrong though), but from my testing it should behave stably and correctly now.

My wsh panel code

Reply #58
lastfm_me_pak.zip updated. User who is using theme.zip, please update your panels, too. Instruction inside the archive.

Changes:
2010-12-12.1:
. Add "Only file in media library" feature in last.fm scrobble client
. Add ability to change titleformatting strings to retrieve track title and artist for use in last.fm scrobble client
. Add ability to select which optional fields user wants to send with their last.fm now playing and scrobble queries

Download in first post.

Last.fm scrobbler client does not have ipod sync feature of foo_audioscrobbler 1.4.7. Obviously it is impossible to implement here, ergo this feature won't be implemented in the foreseeable future.

Feature wise, I'm done with the last.fm scrobble client. I will fix any bug if there's any.

My wsh panel code

Reply #59
Quickfix: lastfm_bio.txt

Changes:
2010-12-13:
. last.fm scrobble client: fix some logic failures


lastfm_me_pak.zip is also updated for later downloads.

My wsh panel code

Reply #60
oh wow, two updates in one day
thanks thuan, will install and test now

EDIT :
so i test it, and got this error in my console D:
Code: [Select]
Multiple ID3v2 tags encountered
<?xml version="1.0" encoding="utf-8"?>
<lfm status="failed">
<error code="6">trackNumber is not a valid non negative integer.</error></lfm>

<?xml version="1.0" encoding="utf-8"?>
<lfm status="failed">
<error code="6">trackNumber is not a valid non negative integer.</error></lfm>

and the track with that error didnt get scrobbled to last.fm
is that because it have multiple ID3v2 tags? I didnt even know what that means D:

My wsh panel code

Reply #61
The simplest thing to do is to disable track number query inclusion, likely your tag is the problem. I can't guess why without having the particular track to check. If you're willing to send me the track or sample, do it over in PM. Though,  I might change the default to not include optional fields that isn't required to scrobble, so users won't run into your particular problem. As you can see here http://www.last.fm/api/show?service=443 only artist, track, and playback timestamp are track information required to scrobble.

And actually, there's another update lastfm_bio.txt. More logic failures fixed. I've just tested and my code should work even when user's computer is disconnect from the internet without him explicitly checking offline by caching scrobbles to submit when user's online again. Soon it should reach perfection and my config don't need to include foo_audioscrobbler anymore.

My wsh panel code

Reply #62
hmm, it happens on every track that i play though, so for now i disable the track number query
i'm uploading 1 track for sample, kinda slow tho D:

for now I'll install the update

My wsh panel code

Reply #63
I have a fix for you. Replace line 561 with this:
Code: [Select]
var trackNumber = (fb.TitleFormat("$meta(tracknumber)").EvalWithMetadb(mdb)).replace(/^0+/,"");


The reason you got the problem is lastfm web service is not smart enough to discard leading zero in an integer.

My wsh panel code

Reply #64
ouw thanks, but only some of them that have leading zero in tags, not all of em
anyway i replace the line, and now i got this error
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<lfm status="failed">
<error code="6">trackNumber[0] is not a valid integer.</error></lfm>

i got this regardless the track number has a leading zero or not

disable again~

My wsh panel code

Reply #65
I know something like this might happen, I will add more sanity check later on track number, whether it is integer and do trimming on it of necessary. Anyway, can you check for me in properties of that file what is its track number? Some people add additional stuffs into their track data instead of  1, 2, 3 and it won't work then.

My wsh panel code

Reply #66
i tried it on tracks which track number is 1 and 01, none works

My wsh panel code

Reply #67
Did you check my post again, I edited it to
Code: [Select]
var trackNumber = (fb.TitleFormat("$meta(tracknumber)").EvalWithMetadb(mdb)).replace(/^0+/,"");


EDIT: It should work for non leading 0 tracknumber as it is for me, and the fix I added should work for track number with leading 0. Weird.
EDIT2: Try clearing the cache file, it's in foobar2000 profile folder named wsh_lfm_scrobble_cache.txt, just delete it. Erroneous  entries might still be cached.

My wsh panel code

Reply #68
ah~
seems like i copied the codes before you edit it as i notice something slightly different after i copied the second one

and now it works fine D:

My wsh panel code

Reply #69
Regardless, I will be adding more sanity check later for track number and error code return by lastfm so only legitimate queries get cached in case of network or lastfm service outage. Thanks for the test.

My wsh panel code

Reply #70
you're welcome ^^
i really love your code anyway D:

My wsh panel code

Reply #71
I uploaded a new version of lastfm_bio.txt. Download at the same place in first post.

Changes:
. Fix malformed track number issue
. Add more sanity checks in last.fm write service functions
. Better error reporting when accessing last.fm write services (love, now playing, scrobble) so user can check what is wrong with their track that it didn't get saved by last.fm (foo_audioscrobbler just silently fails I think)
. Some small changes

If everything goes well, I'll release a new pack at the end of the week and also update my theme.zip and another new theme that I'm using.


My wsh panel code

Reply #72
install it and it seems everything ok

btw, is console the only way to view error reporting? just asking, don't really need any fancy new panel lol
well, i got this "error"
Code: [Select]
Last.fm query: Track information... ERROR 
<?xml version="1.0" encoding="utf-8"?>
<lfm status="failed">
<error code="6">Track not found</error></lfm>
i think this is because the artist tag is gibberish (wrong charset or whatever it was), it's something like this -> “¡‘º Ãicv.‚ЂƔüj but when i play it, it shows fine on playlist and window title, dunno why lol
anyway, i found that "error" (maybe it really isnt an error) useful as it'll keep stats clean cause unfortunately 5=10% of my collection consist of that kind of tracks...

the rest is working flawlessly, thanks D:


EDIT
ok, now this is strange, only that certain track which got an error, the rest from the same album scrobbled just fine...
here's what on my console
Code: [Select]
Opening track for playback: "Q:\[ACHGM]\[2007-07-14] [ACHGM-DIE] [3126] Kono aozora ni yakusoku wo Character Song Vol.5 - Shizuka Fujimur.rar|01. Shizuka Fujimura (CV. Hitomi) - you….mp3"
Last.fm query: Track information... ERROR
<?xml version="1.0" encoding="utf-8"?>
<lfm status="failed">
<error code="6">Track not found</error></lfm>

Last.fm submission: Now playing... OK
Playcount sync: Contacting Last.fm....
<?xml version="1.0" encoding="utf-8"?>
<lfm status="failed">
<error code="6">Track not found</error></lfm>

Opening track for playback: "Q:\[ACHGM]\[2007-07-14] [ACHGM-DIE] [3126] Kono aozora ni yakusoku wo Character Song Vol.5 - Shizuka Fujimur.rar|02. Shizuka Fujimura (CV. Hitomi) - Short CD Drama 'Anata ga Saechan de, watashi ha......are'.mp3"
Last.fm submission: Scrobbled 1 track(s)... OK
Last.fm submission: Now playing... OK
Playcount sync: Contacting Last.fm....
Playcount sync: Last.fm responded 'OK'

as you can see, track number two has no error

My wsh panel code

Reply #73
Track information is from playingtrackinfo panel and has nothing to do with scrobbling. It just means that the track is new and has not been registered on last.fm. Also when you play the next track the last play track will get scrobbled, so actually the line "Last.fm submission: Scrobbled 1 track(s)... OK " is for your first track. Everything seems to be fine .

EDIT: I use popup for some important error reports (like when authenticating) otherwise I use the console. Another way is to log error to a file, but is this really necessary? Also about your track changing tag from gibberish to comprehensive, I think it's because your tag charset is wrong somewhere.

My wsh panel code

Reply #74
Small update to lastfm_bio.txt:

. Scrobble should work correctly when playing track tags are changed

 
SimplePortal 1.0.0 RC1 © 2008-2020