[Slim-Checkins] r33727 - in /7.7/trunk/server/Slim/Plugin/MOG: Plugin.pm strings.txt

[email protected]
Newsgroups gmane.music.equipment.slimdevices.cvs
Message-ID <[email protected]>
Author: mherger
Date: Mon Nov 21 06:36:36 2011
New Revision: 33727

URL: http://svn.slimdevices.com/slim?rev=33727&view=rev
Log:
Bug: 17750
Description: add On MOG menu to local music too

Modified:
    7.7/trunk/server/Slim/Plugin/MOG/Plugin.pm
    7.7/trunk/server/Slim/Plugin/MOG/strings.txt

Modified: 7.7/trunk/server/Slim/Plugin/MOG/Plugin.pm
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Plugin/MOG/Plugin.pm?rev=33727&r1=33726&r2=33727&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Plugin/MOG/Plugin.pm (original)
+++ 7.7/trunk/server/Slim/Plugin/MOG/Plugin.pm Mon Nov 21 06:36:36 2011
@@ -6,6 +6,7 @@
 use base qw(Slim::Plugin::OPMLBased);
 
 use URI::Split qw(uri_split);
+use URI::Escape qw(uri_escape_utf8);
 use Slim::Plugin::MOG::ProtocolHandler;
 use Slim::Networking::SqueezeNetwork;
 use Slim::Utils::Strings qw(cstring);
@@ -31,6 +32,12 @@
 	# add custom commands to control radio's diversity
 	Slim::Control::Request::addDispatch(['mog', 'radiodiversity', '_diversity'],
 		[0, 1, 1, \&Slim::Plugin::MOG::ProtocolHandler::setRadioDiversity]);
+
+		# Track Info item
+	Slim::Menu::TrackInfo->registerInfoProvider( mog => (
+		after => 'middle',
+		func  => \&trackInfoMenu,
+	) );
 	
 	if ( main::WEBUI ) {
 		# Add a function to view trackinfo in the web
@@ -79,6 +86,35 @@
 
 }
 
+sub trackInfoMenu {
+	my ( $client, $url, $track, $remoteMeta ) = @_;
+
+	return unless $client;
+
+	# Only show if in the app list
+	return unless $client->isAppEnabled('mog');
+	
+	my $artist = $track->remote ? $remoteMeta->{artist} : $track->artistName;
+	my $album  = $track->remote ? $remoteMeta->{album}  : ( $track->album ? $track->album->name : undef );
+	my $title  = $track->remote ? $remoteMeta->{title}  : $track->title;
+	
+	if ( $artist || $album || $title ) {
+	
+		my $snURL = Slim::Networking::SqueezeNetwork->url(
+			'/api/mog/v1/opml/context?artist=' . uri_escape_utf8($artist)
+			. '&album=' . uri_escape_utf8($album)
+			. '&track='	. uri_escape_utf8($title)
+		);
+
+		return {
+			type      => 'link',
+			name      => $client->string('PLUGIN_ON_MOG'),
+			url       => $snURL,
+			favorites => 0,
+		};
+	}
+}
+
 sub getDisplayName () {
 	return 'PLUGIN_MOG_MODULE_NAME';
 }

Modified: 7.7/trunk/server/Slim/Plugin/MOG/strings.txt
URL: http://svn.slimdevices.com/slim/7.7/trunk/server/Slim/Plugin/MOG/strings.txt?rev=33727&r1=33726&r2=33727&view=diff
==============================================================================
--- 7.7/trunk/server/Slim/Plugin/MOG/strings.txt (original)
+++ 7.7/trunk/server/Slim/Plugin/MOG/strings.txt Mon Nov 21 06:36:36 2011
@@ -15,3 +15,18 @@
 
 PLUGIN_MOG_MODULE_NAME
 	EN	MOG
+
+PLUGIN_ON_MOG
+	CS	Na MOG
+	DA	PÃ¥ MOG
+	DE	Auf MOG
+	EN	On MOG
+	ES	En MOG
+	FI	MOGssa
+	FR	Sur MOG
+	IT	Su MOG
+	NL	Op MOG
+	NO	PÃ¥ MOG
+	PL	W usłudze MOG
+	RU	На MOG
+	SV	PÃ¥ MOG

_______________________________________________
checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.