Page 1 of 2

»Heavy Rotation« - Your top album in the last week

Posted: Wed Jan 24, 2007 1:44 pm
by mastaYoda
Image
Some of you might know the wonderful software Last.fm, which collects your music listening behaviour and provides useful statistics like weekly personal charts, overall track and artist top lists and similiar stuff like that. But beneath the data they are displaying on there website they provide a useful REST-based API which provides statistics in a machine readable format. This is what serendipity_plugin_heavyrotation is based on. To keep it short: it displays the cover of the top-album of the last week, for those who knows this is often called »heavy rotation« when it comes to broadcast terms.

All you need is to install the plugin via Spartacus, supplying your Last.fm-username and an Amazon API-key (Amazon is used to fetch the covers). You can see the plugin in action there.

WARNING: This plugin works only with PHP 5.1 since I like to use sensible OO-features, which are just provided by PHP 5.1. I'm focusing on maintainability and clean code, so I'm sorry if your hoster is not willing to provide you the needed environment.

Posted: Wed Jan 24, 2007 4:24 pm
by mattsches
Great idea, some suggestions however:

a) We already have an "audioscrobbler" plugin (last.fm bought audioscrobbler some time ago), and a few weeks ago someone already announced a "last.fm" plugin - though with a different set of features. Would it be possible to merge all these plugins into one?

b) About the Amazon API key: Would it be possbile to provide a default API key for users that don't want to register as a dev with Amazon? I know some applications that do this, so it seems to be ok with Amazon.

Apart from that I really like it, even if I can't use it because of my provider :wink:

Posted: Wed Jan 24, 2007 4:30 pm
by mastaYoda
I'm generally not a friend of all-in-one plugins. I prefer sharing libraries and I would like to see a way how plugins can do this. For example my class serendipity_plugins_heavyrotation_helper_audioscrobbler provides a default way how to access the audiscrobbler API.

And, btw: change the provider :-)

Posted: Wed Jan 24, 2007 5:07 pm
by mattsches
mastaYoda wrote:And, btw: change the provider :-)
Yeah, if it was that easy ... I've already got myself webspace from a different provider exactly because of PHP5. But I'm not happy with the new one either because of a few other shortcomings, and because PHP5 only runs as cgi ... bummer. Right now I'm thinking about switching to a dedicated server.

And about sharing libraries: I absolutely second that! Not only for PHP libs, but maybe javascript/ajax, too. But I also think that, at least in spartacus, we should try to keep the number of plugins as low as possible.

Posted: Thu Jan 25, 2007 12:42 am
by judebert
Yes, Garvin is always concerned about keeping the number of plugins low to avoid confusion. We generally prefer few all-in-one plugins (Windows way) to lots of little plugins that work together (Unix way).

You can still use the Unix way in your plugin programming, just not as separate plugins themselves. Or you can host your own plugins if Garvin won't allow them into SPARTACUS.

Posted: Thu Jan 25, 2007 9:28 am
by mastaYoda
As long as my small "do the thing right"-plugins are provided via Spartacus I'm honestly don't care.

Posted: Fri Jan 26, 2007 12:11 pm
by Hokey
It would be nice to mention the requirement of PHP-5.x in Spartacus to not confuse users that don't read here every day. :wink:

Posted: Fri Jan 26, 2007 12:23 pm
by mastaYoda
It is mentioned. Did you experienced any problems?

Posted: Fri Jan 26, 2007 12:38 pm
by Hokey
Sorry, my mistake. I meant the plugin-page of s9y where a hint regarding PHP 5.1 is missing:

Image

I think it could be useful to mention this in the plugin-description, so that non PHP5.1 users (like me :wink:) know where the error messages come from.

Posted: Fri Jan 26, 2007 12:49 pm
by mastaYoda
Hm, that's pretty strange. I've understood, that the requirements specification in the plugin file leads to not displaying the plugin, if you do not fullfill the requirements.

Posted: Fri Feb 02, 2007 5:28 am
by judebert
That's what I thought, too. Maybe it only works for the Serendipity version?

Posted: Fri Feb 02, 2007 1:52 pm
by mastaYoda
No, Garvin especially asked me to fill the reqirements fields. So I would guess it is also implemented for PHP.

Posted: Fri Feb 02, 2007 2:16 pm
by garvinhicking
Hi!

I thought it were implemented, but evidently the requirement check for PHP fails when using spartacus - only locally downloaded plugins are checked for the requirements.

So the spartacus plugin needs some attention *g*

Best regards,
Garvin

Posted: Thu Apr 26, 2007 7:29 pm
by thedogcow
Getting the following error, any idea why? I have filled out all the settings correctly!

Code: Select all

Fatal error: Uncaught exception 'serendipity_plugin_heavyrotation_albumhandler_chickeneggproblem' with message 'Could not read image from a file. Error was: File /home/matthew/public_html/templates_c/serendipity_plugin_heavyrotation.txt does not exists' in /home/matthew/public_html/plugins/serendipity_plugin_heavyrotation/lib/albumhandler.php:208 Stack trace: #0 /home/matthew/public_html/plugins/serendipity_plugin_heavyrotation/plugin.inc.php(137): serendipity_plugin_heavyrotation_albumhandler->getInstance() #1 /home/matthew/public_html/include/plugin_api.inc.php(836): serendipity_plugin_heavyrotation->generate_content('On ??Heavy Rota...') #2 /home/matthew/public_html/include/functions_smarty.inc.php(514): serendipity_plugin_api::generate_plugins('right') #3 /home/matthew/public_html/templates_c/freshy^%%71^713^713F0509%%index.tpl.php(152): serendipity_smarty_printSidebar(Array, Object(Smarty)) #4 /home/matthew/public_html/bundled-libs/Smarty/libs/Smarty.class.php(1258): include('/home/matthew/p...') #5 /home/matthew/pub in /home/matthew/public_html/plugins/serendipity_plugin_heavyrotation/lib/albumhandler.php on line 208

Re: »Heavy Rotation« - Your top album in the last week

Posted: Fri Apr 24, 2009 12:14 am
by mo
The sidebar plugin on my blog only updates the picture every few months. Could this be some sort of caching issue? I have checked the query to last.fm, and the server returns correct (updated) stats when I manually request it ( http://ws.audioscrobbler.com/1.0/user/.../weeklyalbumchart.xml )