aboutsummaryrefslogtreecommitdiff
path: root/plugin.retrowave.indrajith
diff options
context:
space:
mode:
authorIndrajith K L2021-06-09 00:43:29 +0530
committerIndrajith K L2021-06-09 00:43:29 +0530
commitb2f9a3a474e9e761c382bad64e9f006adc7d607b (patch)
treeaeb846f784970713cc59af63647d26ccac6429dd /plugin.retrowave.indrajith
downloadretrowave-music-player-kodi-b2f9a3a474e9e761c382bad64e9f006adc7d607b.tar.gz
retrowave-music-player-kodi-b2f9a3a474e9e761c382bad64e9f006adc7d607b.tar.bz2
retrowave-music-player-kodi-b2f9a3a474e9e761c382bad64e9f006adc7d607b.zip
Initial Commit
* Working Media Player * Adds Album Art TODO: Adds Pagination
Diffstat (limited to 'plugin.retrowave.indrajith')
-rw-r--r--plugin.retrowave.indrajith/addon.py57
-rw-r--r--plugin.retrowave.indrajith/addon.xml35
-rw-r--r--plugin.retrowave.indrajith/resources/icon.pngbin0 -> 109947 bytes
3 files changed, 92 insertions, 0 deletions
diff --git a/plugin.retrowave.indrajith/addon.py b/plugin.retrowave.indrajith/addon.py
new file mode 100644
index 0000000..ea0f558
--- /dev/null
+++ b/plugin.retrowave.indrajith/addon.py
@@ -0,0 +1,57 @@
+import os
+import sys
+import urllib
+import xbmcaddon
+import xbmc
+import xbmcgui
+import xbmcplugin
+import requests
+from urllib.parse import parse_qs, urlencode
+
+
+def build_url(query):
+ base_url = sys.argv[0]
+ dialog = xbmcgui.Dialog()
+ dialog.notification('RetroWave Player', 'Base Url: '+base_url, xbmcgui.NOTIFICATION_INFO, 5000)
+ return base_url + '?' + urlencode(query)
+
+
+def getMusicList():
+ song_list = []
+ URL = "http://retrowave.ru/api/v1/tracks"
+ PARAMS = {'cursor': 1, 'limit': 3}
+ r = requests.get(url=URL, params=PARAMS)
+ data = r.json()
+ for song in data['body']['tracks']:
+ li = xbmcgui.ListItem(label=song['title'])
+ li.setArt({'thumb': 'http://retrowave.ru/' + song['artworkUrl'], 'fanart': 'http://retrowave.ru/' + song['artworkUrl']})
+ url = build_url({'mode': 'stream', 'url': 'http://retrowave.ru' + song['streamUrl'], 'title': song['title'], 'artwork': 'http://retrowave.ru/' + song['artworkUrl']})
+ song_list.append((url, li, False))
+
+ xbmcplugin.addDirectoryItems(addon_handle, song_list, len(song_list))
+ xbmcplugin.setContent(addon_handle, 'songs')
+ xbmcplugin.endOfDirectory(addon_handle)
+
+def play_song(url,title, artwork):
+ play_item = xbmcgui.ListItem(path=url,label=title)
+ play_item.setArt({'thumb': artwork, 'fanart': artwork})
+
+ dialog = xbmcgui.Dialog()
+ # dialog.notification('RetroWave Player', 'Mode: '+url, xbmcgui.NOTIFICATION_INFO, 5000)
+ # xbmcplugin.setResolvedUrl(addon_handle, True, listitem=play_item)
+ xbmc.Player().play(item=url, listitem=play_item)
+
+def main():
+ args = parse_qs(sys.argv[2][1:])
+ mode = args.get('mode', None)
+
+ if mode is None:
+ getMusicList()
+ elif mode[0] == 'stream':
+ dialog = xbmcgui.Dialog()
+ dialog.notification('RetroWave Player', 'Mode: '+args['title'][0], xbmcgui.NOTIFICATION_INFO, 5000)
+ play_song(args['url'][0], args['title'][0], args['artwork'][0])
+
+if __name__ == '__main__':
+ addon_handle = int(sys.argv[1])
+ main()
diff --git a/plugin.retrowave.indrajith/addon.xml b/plugin.retrowave.indrajith/addon.xml
new file mode 100644
index 0000000..4e6004c
--- /dev/null
+++ b/plugin.retrowave.indrajith/addon.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<addon id="plugin.vaporwave.indrajith" name="Indrajith's Retroplayer" provider-name="Indrajith K L" version="0.0.1">
+ <requires>
+ <import addon="xbmc.python" version="3.0.0"/>
+ <import addon="script.module.requests" version="2.9.1"/>
+ <import addon="script.module.web-pdb" />
+ </requires>
+ <extension library="addon.py" point="xbmc.python.pluginsource">
+ <provides>audio</provides>
+ </extension>
+ <extension point="xbmc.addon.metadata">
+ <summary lang="en_gb">Listen to Synthwave, Vaporwave Musics</summary>
+ <description lang="en_gb"/>
+ <disclaimer lang="en_gb"/>
+ <language/>
+ <platform>all</platform>
+ <license/>
+ <forum/>
+ <website/>
+ <email/>
+ <source/>
+ <news>
+ v0.0.1 (2021-08-06)
+ - Initial release
+ </news>
+ <assets>
+ <icon>resources/icon.png</icon>
+ </assets>
+ </extension>
+ <extension point="xbmc.addon.repository">
+ <info></info>
+ <checksum></checksum>
+ <datadir zip="true"></datadir>
+ </extension>
+</addon>
diff --git a/plugin.retrowave.indrajith/resources/icon.png b/plugin.retrowave.indrajith/resources/icon.png
new file mode 100644
index 0000000..e36d5f7
--- /dev/null
+++ b/plugin.retrowave.indrajith/resources/icon.png
Binary files differ