Returns a unsorted list of your recently listened songs.
Insert this txp tag to your template:
<txp:kch_lastfm_recently />
Here is a table of parameters:
Parameter | Needed | Default | Explanation |
---|---|---|---|
name | Yes | |
Your last.fm account name |
count | No | 3 | How many songs should be listed |
cover | No | 1 | Whether album covers should be displayed, or not |
track_format | No | {ar} – {s} ({t}) | Format of track information (See beyond) |
date_format | No | %d %h %Y %H:%M:%S | Time/Date format as used by strftime1 |
caching | No | 1 | Should we enable caching? (See section caching) |
And here is a list of track_format tokens (case sensitive):
{ar}
– Artist{s}
– Song name{al}
– Album name ( will turn to “(?)”, if Album is unknown){t}
– The Time, you’ve listened to the songThe output will be a unsorted list (<ul> ... </ul>
) with the CSS class kch_lastfm_recently
.
The single list elements have this format:
<li>
<img src="http://lastfm-or-amazon-server.foo/path/to/image" alt="Album cover" style="width:60px;height:60px;" />
<a href="http://last.fm/path/to/song/informations">The parsed track_format</a></li>";
</li>
If something went wrong, <txp:kch_lastfm_recently />
will not displaying anything, but it will write an HTML comment with an errormessage. So if you can not see anything, first check the returned HTML code, if there is a comment with an error message.
If you have enabled caching, kch_lastfm_recently will save the results to “/my/textpattern/installation/textpattern/cache”.
So if you want to use caching, you have to create a directory called “caching” inside the textpattern directory and the HTTP server must have write permission to it.
Results are cached for one minute. If you have multiple <txp:kch_lastfm_recently />
tags with different configurations, this is not a problem, because the cache file gets a unique identifier based on the parameters.
If you have the possibility to create the cache directory and set the required permissions, you really should use this feature, because the last.fm API calls can generate a lot of traffic, if your website has much hits.
1 Documentation of strftime