PDA

View Full Version : Quick Last.fm/audoscrobbler latest tracks pack.


Sparky_s
26 Sep 2006, 20:53
Following on from my quick hack to the member profiles, I have tested this setup out for quite a few months and I am very happy with the results.
The most recent add-on to the pack, I have tested for a few days and is pretty simple in terms of what it does.
Many special thanks to Skedoozy (http://www.vbulletin.org/forum/member.php?u=145502) for his idea on the AIM icons add on, which is included here.

What it is!
This is basically a template mod to the posbit templates to add any latest songs/tracks a user has played beside their avatar/name.

Install time?

~5 minutes max for each feature.
~15 max for the whole package.

Add-on 1- Latest tracks in member profile.

As per this hack: http://www.vbulletin.org/forum/showthread.php?t=122843
If you have already installed this, you can proceed to install the next feature. (Add-on 2)

Create new user profile field in User Profile Fields> Add new user profile field.

Edit the following:

Title= Last.fm recent tracks
Description= Your Last.fm username
Default Value= (leave blank)
Max length of allowed user input=100
Field Length=25
Profile Field Type= Single-Line Text Box
Display Order=99 (this is to make sure the last.fm field is last on the list)

Field Required= No
Field Editable by User= Yes
Private Field=No
Field Searchable on Members List= No
Show on Members List= No
Regular Expression= (blank)

Which page displays this option?= Edit Profile.

Once this is done, make sure to remember the field number, in my case it was 'field10'. In your case change it to whatever field number that you have.

In Styles & Templates> Style Manager.

Go to your chosen style and find MEMBERINFO under 'Member Info Templates'

After:
</tr>
</if>
$customfields
</table>Add:
<if condition="$post['field10']"><div><a href="http://www.last.fm/user/$post[field10]/?chartstyle=basicrt10"><img src="http://imagegen.last.fm/basicrt10/recenttracks/$post[field10].gif" border="0" alt="$post[field10]'s Profile Page" /></a></div></if>Save the template and thats it.

Live example here (http://www.htireland.com/member.php?u=2)

If you want a different style or want to have top albums, top tracks etc, all you need to do is go to your last.fm tools section and select charts. Copy the code for websites and just replace the username with $post[fieldX].

Please also note the "basicrt10" in the http address for both chartstyle and /recenttracks.

You can change this to any of the following in the codes here:
http://www.last.fm/tools/charts/

If you have any querys, post them here if you like or PM me.

Add-on 2 - Tracks in Postbit

Note: If you have your forum on postbit_legacy please scroll to Add- on 2.1 after you read how to add a profile field below.

Having created the user input field in add-on 1, we can now use them to also show the details on the postbit.
However you must first create the option for if the user wants to display their tracks beside their username/avatar.

Create new user profile field in User Profile Fields> Add new user profile field.

Single selection radio buttons.

Edit the following:

Title= Show Last.fm track with posts?
Description= Click YES to show your last played track where you post.
Items per line= (leave at zero)
Options= YES on first line, NO on second line.
Set default= select 'no'
Display order= 98
Field Required= No
Field Editable by User= Yes
Private Field=No
Field Searchable on Members List= No
Show on Members List= No
Allow user to input their own value for this option=no
Max length of allowed user input=100
Field length= 25
Regular Expression= (blank)
Which page displays this option?= Options:Other

Once that's done go to
Styles & Templates> Style Manager.

Your style>>>Postbit templates>>>>>postbit

Find
<div id="postmenu_$post[postid]">
<if condition="$show['profile']">
<a class="bigusername" href="member.php?$session[sessionurl]u=$post">$post[musername]</a>
$post[onlinestatus]
<script type="text/javascript"> vbmenu_register("postmenu_$post[postid]", true); </script>
<else />
$post[musername]
</if>
</div>

<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if>After </if> add:
<if condition="$post[field10]">
<if condition="$bbuserinfo[field11] != 'NO'"><a href="http://www.last.fm/user/$post[field10]/?chartstyle=basicrt10"><img src="http://imagegen.last.fm/basicrt10/recenttracks/1/$post[field10].gif" border="0" /></a></if></if>That is all for the postbit template.
Remember that [field11] will be whatever your profile field turns out to be. ie: 9, 10 etc.
The same also applies to the existing [field10] for the last.fm users name.

You can see a live example here (http://www.htireland.com/cablesatelliteterrestrial/t-sky-hd-preview-481.html).
Please not that I am using my own design to show latest tracks under the name "sparkysimple", you can change "basicrt10" to it if you rather that look.


[U]Add-on 2.1 - Tracks in Postbit_legacy

As the image is generally too big to use in postbit_legacy, I have choosen to have it added beneath the signatures, you can tinker around with this and post your results if you can do better. :)

Please follow the step above to add a user field....

After the above is done....

In Styles & Templates> Style Manager.

Your style>>>Postbit templates>>>>>postbit_legacy

Find
<if condition="$show['postedited']">
<!-- edit note -->
<div class="smallfont"> <hr size="1" style="color:$stylevar[tborder_bgcolor]" />
<em>
<phrase 1="$post[edit_username]" 2="$post[edit_date]" 3="$post[edit_time]">$vbphrase[last_edited_by_x_on_y_at_z]</phrase>.
<if condition="$post['edit_reason']">$vbphrase[reason]: $post[edit_reason]</if>
</em>
</div>
<!-- / edit note -->
</if>Add after </if>:
<if condition="$post[field10]">
<if condition="$bbuserinfo[field11] != 'NO'">$post[field10]'s latest tracks -<a href="http://www.last.fm/user/$post[field10]/?chartstyle=sparkysimple"><img src="http://imagegen.last.fm/sparkysimple/recenttracks/1/$post[field10].gif" border="0" /></a></if></if>Save all.


Add-on 3- Last.fm AIM icon linking to your profile

Special thanks to Skedoozy (http://www.vbulletin.org/forum/member.php?u=145502) for this idea.

Again you will need to create another user option field in the same fashion as above but rename as appropiate.


Find in postbit or postbit_legacy, whichever your forum is running on:
$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon] $post[skypeicon]After add the following:
<if condition="$bbuserinfo[field12] != 'NO'"><if condition="$post['fieldX']"><a href="http://www.last.fm/user/$post[fieldX]"><img src="/images/lastfm.gif" border="0" alt="$post[fieldX]'s Profile Page" /></a></if>Again, [field12] is used for example and [fieldX] will be the id of the last.fm username profile field.

The last.fm icon is available below to save to your images directory.
(rightclick- save as)


After all this is done, inform your users and watch tracks appear.

I will offer of what I know and my knoweledge as support to help anyone with and problems they may encounter.

Happy installing and remember to hit the install button. ;)

da420
26 Sep 2006, 21:21
I'm sorry, but I am unsure of what this product accomplishes exactly...

Maybe some screenshots?

This is basically a template mod to the posbit templates to add any latest songs/tracks a user has played beside their avatar/name.

I mean that I understand. But does it add the latest tracks automatically, or does a user have to manually add it?

tazB.ca
26 Sep 2006, 21:35
Thanks For This I Love Music And So My Members:D

Sparky_s
27 Sep 2006, 16:37
I'm sorry, but I am unsure of what this product accomplishes exactly...

Maybe some screenshots?



I mean that I understand. But does it add the latest tracks automatically, or does a user have to manually add it?

Oh sorry, I should of said more.

What it really does is grab the latest tracks info from last.fm.
They create an image of the last track you have played and have it on their server.
Basically what you are doing is grabbing that image and displaying it.

This is the image for my last.fm tracks info.
http://imagegen.last.fm/basicrt1/recenttracks/1/Sparky_s.gif (http://www.last.fm/user/Sparky_s/?chartstyle=basicrt1)

I'll upload a few screenshots for all soon.

I have tinkered around with the postbit_legacy template as to where the latest track image should be placed.

I know the edit buttons are on the right etc, using the stylevar, but does anyone have an idea as to get the image on the same line as them but only over on the left.
Stylevar left seems to keep it left but one line over. Maybe I need to tinker a bit more :)

SecTa
05 Oct 2006, 01:12
There is a possibility to use XML for integrating it in forum, take a look here (http://www.audioscrobbler.net/data/webservices/). This will be more customizable and won't lag as picture version does...

Sparky_s
16 Oct 2006, 00:16
I'm going to have a good luck at some other methods.

For the moment the image seems to be the simplest. Pitty it can be slow at times.

Sparky_s
30 Nov 2006, 15:32
Just an update:

There was a small error in the lastfm icon code.

I have since edited the code, so all should be ok.

Basically. I left the http: in after the src code.

Drix
27 May 2007, 18:28
Any chance for an update of this to 3.6.7 PL1?

That would be great!

Drix
29 May 2007, 05:13
Wasn't that much change in the template, so i fixed it myself. Thanks for the script!