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 ''; + foreach ($xml->channel->item as $item) { + echo ''; + + $i++; + if ($i >= $this->maxitems) { + break; + } + } + 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 '
'; + echo '
'; + UI::show_box_bottom(); + } + } + + /** + * load + * This loads up the data we need into this object, this stuff comes + * from the preferences. + */ + public function load($user) { + $user->set_preferences(); + $data = $user->prefs; + + if (strlen(trim($data['rssview_feed_url']))) { + $this->feed_url = trim($data['rssview_feed_url']); + } + else { + debug_event($this->name,'No rss feed url, home plugin skipped','3'); + return false; + } + $this->maxitems = intval($data['rssview_max_items']); + + return true; + } +} diff --git a/modules/plugins/TheAudioDb.plugin.php b/modules/plugins/TheAudioDb.plugin.php index 6a1dfcf3..08210e18 100644 --- a/modules/plugins/TheAudioDb.plugin.php +++ b/modules/plugins/TheAudioDb.plugin.php @@ -23,7 +23,9 @@ class AmpacheTheaudiodb { public $name = 'TheAudioDb'; + public $categories = 'metadata'; public $description = 'TheAudioDb metadata integration'; + public $url = 'http://www.theaudiodb.com'; public $version = '000001'; public $min_ampache = '370009'; public $max_ampache = '999999'; diff --git a/modules/plugins/Tmdb.plugin.php b/modules/plugins/Tmdb.plugin.php index 892d37ca..9a152b26 100644 --- a/modules/plugins/Tmdb.plugin.php +++ b/modules/plugins/Tmdb.plugin.php @@ -23,7 +23,9 @@ class AmpacheTmdb { public $name = 'Tmdb'; + public $categories = 'metadata'; public $description = 'Tmdb metadata integration'; + public $url = 'https://www.themoviedb.org'; public $version = '000001'; public $min_ampache = '370009'; public $max_ampache = '999999'; diff --git a/modules/plugins/Tvdb.plugin.php b/modules/plugins/Tvdb.plugin.php index 0e3aef54..77d9289b 100644 --- a/modules/plugins/Tvdb.plugin.php +++ b/modules/plugins/Tvdb.plugin.php @@ -23,7 +23,9 @@ class AmpacheTvdb { public $name = 'Tvdb'; + public $categories = 'metadata'; public $description = 'Tvdb metadata integration'; + public $url = 'http://thetvdb.com'; public $version = '000001'; public $min_ampache = '370009'; public $max_ampache = '999999'; diff --git a/modules/plugins/Yourls.plugin.php b/modules/plugins/Yourls.plugin.php index 21dd219a..78e5bcd3 100644 --- a/modules/plugins/Yourls.plugin.php +++ b/modules/plugins/Yourls.plugin.php @@ -23,8 +23,9 @@ class AmpacheYourls { public $name = 'YOURLS'; + public $categories = 'shortener'; public $description = 'Url shorteners on shared links with YOURLS'; - public $url = 'http://yourls.org/'; + public $url = 'http://yourls.org'; public $version = '000002'; public $min_ampache = '360037'; public $max_ampache = '999999'; diff --git a/nbproject/licenseheader.txt b/nbproject/licenseheader.txt new file mode 100644 index 00000000..956a876e --- /dev/null +++ b/nbproject/licenseheader.txt @@ -0,0 +1,20 @@ +/* vim:set softtabstop=4 shiftwidth=4 expandtab: */ +/** + * + * LICENSE: GNU General Public License, version 2 (GPLv2) + * Copyright 2001 - 2014 Ampache.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License v2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ \ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties index 024c0984..a27544d5 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,5 +1,12 @@ +auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css +auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css include.path=${php.global.include.path} php.version=PHP_53 +project.licensePath=./nbproject/licenseheader.txt source.encoding=UTF-8 src.dir=. tags.asp=false diff --git a/templates/show_index.inc.php b/templates/show_index.inc.php index 8bc6bf94..3399d50a 100644 --- a/templates/show_index.inc.php +++ b/templates/show_index.inc.php @@ -19,6 +19,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ + +foreach (Plugin::get_plugins('display_home') as $plugin_name) { + $plugin = new Plugin($plugin_name); + if ($plugin->load($GLOBALS['user'])) { + echo '
' . $plugin->_plugin->display_home() . '
'; + } +} ?>