CVS edit link for daveeddydotcom

I want to contribute a Drupal module I have written to integrate Ampache (http://ampache.org) with Drupal. As of right now there is no Drupal module that integrates with Ampache, and there is definitely a desire for it (see http://drupal.org/node/80992).

This is my first Drupal (not my first encounter with PHP though) and I am really excited to release it in hopes that people will actually use it! This module will allow Drupal users to place a block on their site that will display the song they are currently listening to on Ampache along with the album art.

I have worked hard to make this module really customizable, easy to use, and more importantly secure. In the coming week or so i'm going to make a YouTube video going over how to install the module, and how to secure it by creating a limited Ampache account with ACL's on Ampache's end to allow for the drupal module to access Ampache securely.

I have a working version of this module that I use on my Drupal powered site right now (see http://www.daveeddy.com), it's the block on the right hand side labeled Ampache Now Playing.

Comments

daveeddydotcom’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new6.86 KB

Ampache Now Playing Module.

avpaderno’s picture

Status: Needs review » Needs work
Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

As per http://drupal.org/cvs-application/requirements, the motivation message should be expanded to contain more details about the features of the proposed module/theme; for modules it should include also a comparison with the existing solutions, while for themes a screenshot is also required.

daveeddydotcom’s picture

I'm not sure what information you are looking for that I did not state in the initial message, but I will try to be more succinct while adding more details.

Features

This module can pull information about the current playing song from an Ampache server via it's RSS feed, and display it in a block. It can pull the song title, album, and artist, the date the song was played, and from what user agent the song is being streamed to (ie, ampache web interface, iphone, android, etc.).

This module can also authenticate to Ampache, and pull the album art, and display it in the block also.

This module can cache both the album art and the RSS feed (both user customizable). The RSS is cached in the database for a default max age of 10 seconds, so if this module is used on a website that generates a large number of hits, this will limit the amount of connections drupal will make to Ampache.

The album art information is also stored in a database, and the artwork itself is saved, and scaled down (to make the file size smaller). It is saved in {drupal_default_files}/ampache.

The user can clear this cache at anytime if they choose from the module settings menu.

Other Modules

There is really no current solution that can do what this module does, i searched long and hard before coding this module for myself.

avpaderno’s picture

Status: Needs work » Needs review

Thanks for the reply.

When I ask for more information is because the requirements speak of few paragraphs instead of sentences.
You effectively added more information, as you didn't before reported which data are hosted on Ampache, and how the module grabs those data in.

daveeddydotcom’s picture

ah i see thank you for the quick reply.

What i described in post #3 is effectively my whole module, if there is any more information that I'm missing please let me know and I can add it in.

Thank you

daveeddydotcom’s picture

StatusFileSize
new6.86 KB

I'm not sure if my code is already being reviewed, but I have cleaned up some of the code to comply more with Drupals standards, and fixed hook_uninstall to clear all files downloaded by this module.

daveeddydotcom’s picture

Hello,

Would it be possible to get a time frame of when you think my module would be reviewed?

Thank you,
Dave

daveeddydotcom’s picture

StatusFileSize
new7.45 KB

Attached is the newest version of my module 1.0.2.

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order or importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. Schema descriptions are not passed to t().
  2. Deleting Drupal variables using a query that matches any Drupal variable with a name that starts with the module name would remove also the Drupal variables of other modules.
  3. Menu descriptions, and titles are not passed to t(), as that is already done by Drupal core code.
  4. The permission access administration pages is too generic to be used in this case; if the code should use an existing permission, then it should probably use administer blocks.
  5. 			$blocks[0]['info'] = t("$title");
    

    The first argument of t() is a literal string, not a concatenation of strings. The script used to create the translation template is not able to handle any dynamic value, even in the case of code similar to t($variable); this means that if the argument of the function is not a literal string, it will not appear in the translation template.

  6. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how the code should be formatted; how Drupal variables, global variables, constants, and functions defined from the module should be named.
    Check also you are not using tabs to indent the code.
  7. Comments should not be longer than 80 characters per line.
  8. 	if ($artwork_url && $show_album_art) { // show the album art
    		$google_link = 'http://www.google.com/search?q=' . _add_pluses($song_info['title']);
    		$msg .= "<div style=\"float:left;\"><p>
    			 <a href=\"$google_link\" target=\"new\">
    			 <img style=\"padding:4px;border-style:solid;
    				border-color:#ddd;border-width:1px;\" 
    				height=\"150px\" width=\"150px\" src=\"$artwork_url\" />
    			 </a>
    			 </p></div>";
    	}
    	$msg .= '<div style="float:left;">';
    
    

    The code should use a theme function to output HTML.

  9. 	drupal_set_message(t('Ampache album art cache cleared.  ' . $i . ' files deleted.'));
    
    

    Use t()-placeholders.

  10. /** 
     * Implementation of hook_validate() for the "account" page
     */
    
    

    It's not the implementation of hook_validate().

  11. function _ampachenowplaying_valid_url($url) {
    	return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
    }
    
    

    Why isn't the code using valid_url()?

avpaderno’s picture

Status: Needs work » Closed (won't fix)

Please read the following links as this is very important information about CVS applications.

Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for these applications. Please read Migrating from CVS Applications to (Git) Full Project Applications and Applying for permission to opt into security advisory coverage on how this affects and benefits you and the application process. In short, every user has now the permissions necessary to create new projects, but they need to apply for opt into security advisory coverage. Without applying, the projects will have a warning on projects that says:

This project is not covered by Drupal’s security advisory policy.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes