diff --git a/docs/PLUGINS b/docs/PLUGINS index a1c9e916..fb3ec998 100644 --- a/docs/PLUGINS +++ b/docs/PLUGINS @@ -33,5 +33,6 @@ should be implemented as a public method: shortener(string $url) get_photos(string $search) gather_arts(string $type, array $options, int $limit) - get_song_preview($track_mbid, $artist_name, $title) - stream_song_preview($file) + get_song_preview(string $track_mbid, string $artist_name, string $title) + stream_song_preview(string $file) + display_home() diff --git a/lib/class/ampache_rss.class.php b/lib/class/ampache_rss.class.php index 7027301b..aae2af54 100644 --- a/lib/class/ampache_rss.class.php +++ b/lib/class/ampache_rss.class.php @@ -264,11 +264,12 @@ class Ampache_RSS $album->format(); $xml_array = array('title' => $album->f_name, - 'link' => $album->f_link_src, - 'description' => $album->f_artist_name . ' - ' . $album->f_name, - 'image' => Art::url($album->id, 'album'), - 'comments' => '', - 'pubDate' => $album->get_addtime_first_song()); + 'link' => $album->f_link_src, + 'description' => $album->f_artist_name . ' - ' . $album->f_name, + 'image' => Art::url($album->id, 'album'), + 'comments' => '', + 'pubDate' => date("c", $album->get_addtime_first_song()) + ); $results[] = $xml_array; } // end foreach diff --git a/lib/class/plugin.class.php b/lib/class/plugin.class.php index 43e473f7..d0d11ecb 100644 --- a/lib/class/plugin.class.php +++ b/lib/class/plugin.class.php @@ -74,11 +74,11 @@ class Plugin public static function get_plugins($type='') { // make static cache for optimization when multiple call - static $plugins_list; - if (!is_null($plugins_list)) - return $plugins_list; + static $plugins_list = array(); + if (isset($plugins_list[$type])) + return $plugins_list[$type]; - $plugins_list = array(); + $plugins_list[$type] = array(); // Open up the plugin dir $handle = opendir(AmpConfig::get('prefix') . '/modules/plugins'); @@ -109,13 +109,13 @@ class Plugin } } // It's a plugin record it - $plugins_list[$plugin_name] = $plugin_name; + $plugins_list[$type][$plugin_name] = $plugin_name; } // end while // Little stupid but hey - ksort($plugins_list); + ksort($plugins_list[$type]); - return $plugins_list; + return $plugins_list[$type]; } // get_plugins diff --git a/modules/plugins/7Digital.plugin.php b/modules/plugins/7Digital.plugin.php index 24725f2c..d87c9fb5 100644 --- a/modules/plugins/7Digital.plugin.php +++ b/modules/plugins/7Digital.plugin.php @@ -23,6 +23,7 @@ class Ampache7digital { public $name = '7digital'; + public $categories = 'misc,preview'; public $description = 'Song preview from 7digital'; public $url = 'http://www.7digital.com'; public $version = '000001'; diff --git a/modules/plugins/Amazon.plugin.php b/modules/plugins/Amazon.plugin.php index 419a4c1f..ff1ecd62 100644 --- a/modules/plugins/Amazon.plugin.php +++ b/modules/plugins/Amazon.plugin.php @@ -23,7 +23,9 @@ class AmpacheAmazon { public $name = 'Amazon'; + public $categories = 'metadata'; public $description = 'Amazon arts'; + public $url = 'http://www.amazon.com'; public $version = '000001'; public $min_ampache = '370009'; public $max_ampache = '999999'; diff --git a/modules/plugins/Bitly.plugin.php b/modules/plugins/Bitly.plugin.php index ba32792d..b606d09a 100644 --- a/modules/plugins/Bitly.plugin.php +++ b/modules/plugins/Bitly.plugin.php @@ -23,8 +23,9 @@ class AmpacheBitly { public $name = 'Bit.ly'; + public $categories = 'shortener'; public $description = 'Url shorteners on shared links with Bit.ly'; - public $url = 'http://bitly.com/'; + public $url = 'http://bitly.com'; public $version = '000002'; public $min_ampache = '360037'; public $max_ampache = '999999'; diff --git a/modules/plugins/ChartLyrics.plugin.php b/modules/plugins/ChartLyrics.plugin.php index 99df4b2e..482861a0 100644 --- a/modules/plugins/ChartLyrics.plugin.php +++ b/modules/plugins/ChartLyrics.plugin.php @@ -22,9 +22,10 @@ class Ampachechartlyrics { - public $name = 'ChartLyrics'; + public $name = 'ChartLyrics'; + public $categories = 'lyrics'; public $description = 'Get lyrics from ChartLyrics'; - public $url = ''; + public $url = 'http://www.chartlyrics.com'; public $version ='000001'; public $min_ampache ='360022'; public $max_ampache ='999999'; diff --git a/modules/plugins/Flickr.plugin.php b/modules/plugins/Flickr.plugin.php index b93bd62f..afe17aea 100644 --- a/modules/plugins/Flickr.plugin.php +++ b/modules/plugins/Flickr.plugin.php @@ -23,6 +23,7 @@ class Ampacheflickr { public $name = 'Flickr'; + public $categories = 'misc,slideshow'; public $description = 'Artist photos from Flickr'; public $url = 'http://www.flickr.com'; public $version = '000001'; diff --git a/modules/plugins/Gravatar.plugin.php b/modules/plugins/Gravatar.plugin.php index 5fb127e6..76d87203 100644 --- a/modules/plugins/Gravatar.plugin.php +++ b/modules/plugins/Gravatar.plugin.php @@ -23,6 +23,7 @@ class AmpacheGravatar { public $name = 'Gravatar'; + public $categories = 'avatar'; public $description = 'Users avatars with Gravatar'; public $url = 'http://gravatar.com'; public $version = '000001'; diff --git a/modules/plugins/Growl.plugin.php b/modules/plugins/Growl.plugin.php index 6789cb3a..41c4d6d2 100644 --- a/modules/plugins/Growl.plugin.php +++ b/modules/plugins/Growl.plugin.php @@ -23,8 +23,9 @@ class Ampachegrowl { public $name = 'Growl'; + public $categories = 'scrobbling'; public $description = 'Send your played songs notification to Growl'; - public $url = ''; + public $url = 'http://growl.info'; public $version ='000001'; public $min_ampache ='360003'; public $max_ampache ='999999'; diff --git a/modules/plugins/Headphones.plugin.php b/modules/plugins/Headphones.plugin.php index f1c0b081..c2f9b201 100644 --- a/modules/plugins/Headphones.plugin.php +++ b/modules/plugins/Headphones.plugin.php @@ -23,6 +23,7 @@ class AmpacheHeadphones { public $name = 'Headphones'; + public $categories = 'misc,wanted'; public $description = 'Automatically download accepted Wanted List albums with Headphones'; public $url = 'https://github.com/rembo10/headphones/'; public $version = '000001'; diff --git a/modules/plugins/Lastfm.plugin.php b/modules/plugins/Lastfm.plugin.php index 5fbe3e0c..c7a0d46e 100644 --- a/modules/plugins/Lastfm.plugin.php +++ b/modules/plugins/Lastfm.plugin.php @@ -22,12 +22,13 @@ class AmpacheLastfm { - public $name ='Last.FM'; - public $description ='Records your played songs to your Last.FM Account'; - public $url =''; - public $version ='000004'; - public $min_ampache ='360003'; - public $max_ampache ='999999'; + public $name = 'Last.FM'; + public $categories = 'scrobbling'; + public $description = 'Records your played songs to your Last.FM Account'; + public $url = 'http://www.lastfm.com'; + public $version = '000004'; + public $min_ampache = '360003'; + public $max_ampache = '999999'; // These are internal settings used by this class, run this->load to // fill them out diff --git a/modules/plugins/Libravatar.plugin.php b/modules/plugins/Libravatar.plugin.php index 3a360393..9bf768b8 100644 --- a/modules/plugins/Libravatar.plugin.php +++ b/modules/plugins/Libravatar.plugin.php @@ -23,6 +23,7 @@ class AmpacheLibravatar { public $name = 'Libravatar'; + public $categories = 'avatar'; public $description = 'Users avatars with Libravatar'; public $url = 'https://www.libravatar.org'; public $version = '000001'; diff --git a/modules/plugins/Librefm.plugin.php b/modules/plugins/Librefm.plugin.php index a71afe72..c582b754 100644 --- a/modules/plugins/Librefm.plugin.php +++ b/modules/plugins/Librefm.plugin.php @@ -22,12 +22,13 @@ class Ampachelibrefm { - public $name ='Libre.FM'; - public $description ='Records your played songs to your Libre.FM Account'; - public $url =''; - public $version ='000002'; - public $min_ampache ='360003'; - public $max_ampache ='999999'; + public $name = 'Libre.FM'; + public $categories = 'scrobbling'; + public $description = 'Records your played songs to your Libre.FM Account'; + public $url = 'https://libre.fm'; + public $version = '000002'; + public $min_ampache = '360003'; + public $max_ampache = '999999'; // These are internal settings used by this class, run this->load to // fill them out diff --git a/modules/plugins/LyricWiki.plugin.php b/modules/plugins/LyricWiki.plugin.php index 3c3d6c23..63d6ca5a 100644 --- a/modules/plugins/LyricWiki.plugin.php +++ b/modules/plugins/LyricWiki.plugin.php @@ -22,9 +22,10 @@ class Ampachelyricwiki { - public $name = 'LyricWiki'; + public $name = 'LyricWiki'; + public $categories = 'lyrics'; public $description = 'Get lyrics from LyricWiki'; - public $url = ''; + public $url = 'http://lyrics.wikia.com/Lyrics_Wiki'; public $version ='000001'; public $min_ampache ='360022'; public $max_ampache ='999999'; diff --git a/modules/plugins/MusicBrainz.plugin.php b/modules/plugins/MusicBrainz.plugin.php index a1df4be7..b954ee76 100644 --- a/modules/plugins/MusicBrainz.plugin.php +++ b/modules/plugins/MusicBrainz.plugin.php @@ -26,7 +26,9 @@ use MusicBrainz\Clients\RequestsMbClient; class AmpacheMusicBrainz { public $name = 'MusicBrainz'; + public $categories = 'metadata'; public $description = 'MusicBrainz metadata integration'; + public $url = 'http://www.musicbrainz.org'; public $version = '000001'; public $min_ampache = '360003'; public $max_ampache = '999999'; diff --git a/modules/plugins/Omdb.plugin.php b/modules/plugins/Omdb.plugin.php index 8552dab8..1afcf2d3 100644 --- a/modules/plugins/Omdb.plugin.php +++ b/modules/plugins/Omdb.plugin.php @@ -23,7 +23,9 @@ class AmpacheOmdb { public $name = 'Omdb'; + public $categories = 'metadata'; public $description = 'Omdb metadata integration'; + public $url = 'http://www.omdbapi.com'; public $version = '000001'; public $min_ampache = '370009'; public $max_ampache = '999999'; diff --git a/modules/plugins/RSSView.plugin.php b/modules/plugins/RSSView.plugin.php new file mode 100644 index 00000000..aab68337 --- /dev/null +++ b/modules/plugins/RSSView.plugin.php @@ -0,0 +1,135 @@ +load to + // fill them out + private $feed_url; + private $maxitems; + + /** + * Constructor + * This function does nothing... + */ + public function __construct() { + return true; + } + + /** + * install + * This is a required plugin function. It inserts our preferences + * into Ampache + */ + public function install() { + // Check and see if it's already installed + if (Preference::exists('rssview_feed_url')) { return false; } + + Preference::insert('rssview_feed_url','RSS Feed url','','25','string','plugins'); + Preference::insert('rssview_max_items','RSS Feed max items','5','25','integer','plugins'); + + return true; + } + + /** + * uninstall + * This is a required plugin function. It removes our preferences from + * the database returning it to its original form + */ + public function uninstall() { + Preference::delete('rssview_feed_url'); + Preference::delete('rssview_max_items'); + + return true; + } + + /** + * upgrade + * This is a recommended plugin function + */ + public function upgrade() { + return true; + } + + /** + * display_home + * This display the module in home page + */ + public function display_home() { + $xmlstr = file_get_contents($this->feed_url); + $xml = simplexml_load_string($xmlstr); + if ($xml->channel) { + UI::show_box_top($xml->channel->title); + $i = 0; + echo '
';
+ echo ' ';
+ echo '';
+ echo ' ' . date("Y/m/d H:i:s", strtotime($item->pubDate)) . ' ';
+ echo ''; + echo ' ';
+ if (isset($item->image)) {
+ echo ' ';
+ echo ''. $item->description .' ';
+ echo ' |