hbag's profile picture

Published by

published
updated

Category: SpaceHey

Last.fm Top Track Badge

I spent last night (and some of this morning) setting up a little badge you can put on your profile. It'll display your current most-listened last.fm track (well, the one highest on the list with a youtube link), and if you click it, it'll redirect you to the track itself on YouTube. Because of Spacehey's external media proxy, the image won't always be 100% accurate, but hopefully the cache TTL isn't too big for it to be too much of an issue. It also doesn't look amazing, but I'm working on it. Here's mine!


If you'd like to use this badge on your own profile, it's fairly simple! First, you'll want to make sure your 'top tracks' list on last.fm is set to list view, rather than grid view. Your top artists and top albums can be whatever view you want, as it doesn't touch those, but the top tracks need to be list view in order for it to work. You can set it to all time, past 7 days, whatever you like, and it will work using those stats. Personally, I like to use the 'past 30 days' setting, but it's really up to you.

Following this, you should be able to just stick the following code on your profile, and the badge will embed:

<a href="https://magi.hilbo.zone/spacehey/lastfm/badge/link?user=[YOUR LAST.FM USERNAME]">
<img src="https://magi.hilbo.zone/spacehey/lastfm/badge?user=[YOUR LAST.FM USERNAME]"/>
</a>

Make sure to remove the [brackets] as well! Those are only there to help make it obvious where you need to stick your username. For example, with my badge, it's set as ?user=h-bag. Let me know if there's any issues, I'll do my best to resolve them. I can't do much about issues regarding the badge image not updating properly, that's an issue with Spacehey's external media caching. From my limited testing it seems like the cache lifetime isn't too long, though.

I've already got plans to update and improve this, and I think the first thing on the list will be removing the requirement to have your top tracks set to list view. I'll update this blog post as I make changes.


2 Kudos

Comments

Displaying 1 of 1 comments ( View all | Add Comment )

sundaymourning

sundaymourning's profile picture

its currently still showing the foobar thingy for me unfortunaterly.... maybe some cache bs? idk. the direct link seems to be showing the image correctly so IDK,.


Report Comment



yeah that sounds like cache bullshit. try clearing your browwser history and cookies maybe. or just wait a few hours

by hbag; ; Report