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

Creating and modifying plugins.
mastaYoda
Regular
Posts: 18
Joined: Wed Feb 08, 2006 12:13 pm
Contact:

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

Post 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.
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post 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:
mastaYoda
Regular
Posts: 18
Joined: Wed Feb 08, 2006 12:13 pm
Contact:

Post 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 :-)
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post 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.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post 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.
Judebert
---
Website | Wishlist | PayPal
mastaYoda
Regular
Posts: 18
Joined: Wed Feb 08, 2006 12:13 pm
Contact:

Post by mastaYoda »

As long as my small "do the thing right"-plugins are provided via Spartacus I'm honestly don't care.
Hokey
Regular
Posts: 141
Joined: Wed Dec 14, 2005 3:36 pm
Location: Germany
Contact:

Post 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:
mastaYoda
Regular
Posts: 18
Joined: Wed Feb 08, 2006 12:13 pm
Contact:

Post by mastaYoda »

It is mentioned. Did you experienced any problems?
Hokey
Regular
Posts: 141
Joined: Wed Dec 14, 2005 3:36 pm
Location: Germany
Contact:

Post 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.
mastaYoda
Regular
Posts: 18
Joined: Wed Feb 08, 2006 12:13 pm
Contact:

Post 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.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

That's what I thought, too. Maybe it only works for the Serendipity version?
Judebert
---
Website | Wishlist | PayPal
mastaYoda
Regular
Posts: 18
Joined: Wed Feb 08, 2006 12:13 pm
Contact:

Post by mastaYoda »

No, Garvin especially asked me to fill the reqirements fields. So I would guess it is also implemented for PHP.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
thedogcow
Posts: 1
Joined: Thu Apr 26, 2007 7:27 pm

Post 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
mo
Regular
Posts: 40
Joined: Sun Jan 27, 2008 11:33 pm
Contact:

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

Post 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 )
Post Reply