Serendipity-Buch

Handbuch für Serendipity bestellen

Das offizielle, umfassende Serendipity-Handbuch für Einsteiger und Profis ist nun im Handel und kann online bei Amazon oder OpenSourcePress, oder auch bei jedem Buchhändler, bestellt werden!

Forum-Information

Before posting about errors, make sure that the answer cannot already be found in our FAQ or by searching this forum!
Posting is restricted to registered users (registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.

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

Creating and modifying plugins.
User avatar
mastaYoda
Regular
 
Posts: 18
Joined: Wed Feb 08, 2006 1:13 pm

Postby mastaYoda » Wed Jan 24, 2007 2:44 pm

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.

User avatar
mattsches
Regular
 
Posts: 276
Joined: Sat Nov 05, 2005 10:35 pm
Location: Mainz, Germany

Postby mattsches » Wed Jan 24, 2007 5:24 pm

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:

User avatar
mastaYoda
Regular
 
Posts: 18
Joined: Wed Feb 08, 2006 1:13 pm

Postby mastaYoda » Wed Jan 24, 2007 5:30 pm

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 :-)

User avatar
mattsches
Regular
 
Posts: 276
Joined: Sat Nov 05, 2005 10:35 pm
Location: Mainz, Germany

Postby mattsches » Wed Jan 24, 2007 6:07 pm

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.

User avatar
judebert
Regular
 
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL

Postby judebert » Thu Jan 25, 2007 1:42 am

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

User avatar
mastaYoda
Regular
 
Posts: 18
Joined: Wed Feb 08, 2006 1:13 pm

Postby mastaYoda » Thu Jan 25, 2007 10:28 am

As long as my small "do the thing right"-plugins are provided via Spartacus I'm honestly don't care.

User avatar
Hokey
Regular
 
Posts: 141
Joined: Wed Dec 14, 2005 4:36 pm
Location: Germany

Postby Hokey » Fri Jan 26, 2007 1:11 pm

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:

User avatar
mastaYoda
Regular
 
Posts: 18
Joined: Wed Feb 08, 2006 1:13 pm

Postby mastaYoda » Fri Jan 26, 2007 1:23 pm

It is mentioned. Did you experienced any problems?

User avatar
Hokey
Regular
 
Posts: 141
Joined: Wed Dec 14, 2005 4:36 pm
Location: Germany

Postby Hokey » Fri Jan 26, 2007 1:38 pm

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.

User avatar
mastaYoda
Regular
 
Posts: 18
Joined: Wed Feb 08, 2006 1:13 pm

Postby mastaYoda » Fri Jan 26, 2007 1:49 pm

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.

User avatar
judebert
Regular
 
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL

Postby judebert » Fri Feb 02, 2007 6:28 am

That's what I thought, too. Maybe it only works for the Serendipity version?
Judebert
---
Website | Wishlist | PayPal

User avatar
mastaYoda
Regular
 
Posts: 18
Joined: Wed Feb 08, 2006 1:13 pm

Postby mastaYoda » Fri Feb 02, 2007 2:52 pm

No, Garvin especially asked me to fill the reqirements fields. So I would guess it is also implemented for PHP.

User avatar
garvinhicking
Core Developer
 
Posts: 26675
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Fri Feb 02, 2007 3:16 pm

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

Postby thedogcow » Thu Apr 26, 2007 7:29 pm

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

User avatar
mo
Regular
 
Posts: 37
Joined: Mon Jan 28, 2008 12:33 am

Postby mo » Fri Apr 24, 2009 12:14 am

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 )

Next


Return to Plugins

Who is online

Users browsing this forum: No registered users and 0 guests

cron