Context Menu: Show Artist Albums
authorClinton Ebadi <clinton@unknownlamer.org>
Sun, 26 Apr 2015 01:41:10 +0000 (21:41 -0400)
committerClinton Ebadi <clinton@unknownlamer.org>
Sun, 26 Apr 2015 01:41:10 +0000 (21:41 -0400)
Quickly jump to the highlighted item's artist album listing. Handy for
party mode.

context.item.songartist/addon.py [new file with mode: 0644]
context.item.songartist/addon.xml [new file with mode: 0644]

diff --git a/context.item.songartist/addon.py b/context.item.songartist/addon.py
new file mode 100644 (file)
index 0000000..b779a0b
--- /dev/null
@@ -0,0 +1,32 @@
+# Show Song Artist Context Menu (https://git.hcoop.net/?p=clinton/unknownlamer-kodi-addons.git)
+
+# Copyright (c) 2015 Clinton Ebadi <clinton@unknownlamer.org>
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# 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, see <http://www.gnu.org/licenses/>.
+
+import sys
+import xbmc
+import json
+
+def main ():
+    artist = sys.listitem.getMusicInfoTag().getArtist()
+    artistid = json.loads (xbmc.executeJSONRPC (json.dumps ({ 'jsonrpc': '2.0',
+                                                              'id': '1',
+                                                              'method':  'AudioLibrary.GetArtists',
+                                                              'params': { 'filter': { 'field': 'artist',
+                                                                                      'operator': 'is',
+                                                                                      'value' : artist }}})))['result']['artists'][0]['artistid']
+    xbmc.executebuiltin ('ActivateWindow (Music,musicdb://artists/%s/)' % artistid)
+
+if __name__ == '__main__':
+    main ()
diff --git a/context.item.songartist/addon.xml b/context.item.songartist/addon.xml
new file mode 100644 (file)
index 0000000..5007564
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<addon id="context.item.songartist" name="Show Artist" version="0.0"
+       provider-name="unknown_lamer">
+  <requires>
+    <import addon="xbmc.python" version="2.20.0"/>
+  </requires>
+
+  <extension point="kodi.context.item" library="addon.py">
+    <item>
+      <label>Show Artist Albums</label>
+      <visible>!IsEmpty(ListItem.Artist)</visible>
+    </item>
+  </extension>
+
+  <extension point="kodi.addon.metadata">
+    <platform>all</platform>
+    <summary lang="en">Show albums for song's artist</summary>
+    <description lang="en">Show albums for song's artist</description>
+    <license>GPLv3 or later</license>
+    <source>https://git.hcoop.net/?p=clinton/unknownlamer-kodi-addons.git</source>
+  </extension>
+</addon>