Add files via upload

Added multilanguage support
This commit is contained in:
Moshkopp 2016-12-28 14:33:26 +01:00 committed by GitHub
parent ef6ba710e2
commit 4a057ba83c
5 changed files with 377 additions and 41 deletions

View File

@ -9,15 +9,23 @@
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en">Subsonic music addon for Kodi.</summary>
<summary lang="de">Subsonic Musik Addon für Kodi.</summary>
<description lang="en">
Stream, star and download your tunes, directly to Kodi !
For feature requests / issues:
https://github.com/gordielachance/plugin.audio.subsonic/issues
Contributions are welcome:
https://github.com/gordielachance/plugin.audio.subsonic
</description>
<description lang="de">
Stream, star and download your tunes, directly to Kodi !
For feature requests / issues:
https://github.com/gordielachance/plugin.audio.subsonic/issues
Contributions are welcome:
https://github.com/gordielachance/plugin.audio.subsonic
</description>
<disclaimer lang="en"></disclaimer>
<language>en</language>
<language>multi</language>
<platform>all</platform>
<license>MIT</license>
<forum></forum>

46
main.py
View File

@ -8,6 +8,7 @@
import os
import xbmcaddon
lang = xbmcaddon.Addon()
import xbmcplugin
import xbmcgui
import json
@ -15,9 +16,12 @@ import shutil
import dateutil.parser
from datetime import datetime
# Add the /lib folder to sys
sys.path.append(xbmc.translatePath(os.path.join(xbmcaddon.Addon("plugin.audio.subsonic").getAddonInfo("path"), "lib")))
import libsonic_extra #TO FIX - we should get rid of this and use only libsonic
from simpleplugin import Plugin
@ -79,22 +83,22 @@ def root(params):
menus = {
'artists': {
'name': 'Artists',
'name': lang.getLocalizedString(30019),
'callback': 'list_artists',
'thumb': None
},
'albums': {
'name': 'Albums',
'name': lang.getLocalizedString(30020),
'callback': 'menu_albums',
'thumb': None
},
'tracks': {
'name': 'Tracks',
'name': lang.getLocalizedString(30021),
'callback': 'menu_tracks',
'thumb': None
},
'playlists': {
'name': 'Playlists',
'name': lang.getLocalizedString(30022),
'callback': 'list_playlists',
'thumb': None
}
@ -141,22 +145,22 @@ def menu_albums(params):
menus = {
'albums_newest': {
'name': 'Newest albums',
'name': lang.getLocalizedString(30023),
'thumb': None,
'args': {"ltype": "newest"}
},
'albums_frequent': {
'name': 'Most played albums',
'name': lang.getLocalizedString(30024),
'thumb': None,
'args': {"ltype": "frequent"}
},
'albums_recent': {
'name': 'Recently played albums',
'name': lang.getLocalizedString(30025),
'thumb': None,
'args': {"ltype": "recent"}
},
'albums_random': {
'name': 'Random albums',
'name': lang.getLocalizedString(30026),
'thumb': None,
'args': {"ltype": "random"}
}
@ -545,6 +549,7 @@ def list_tracks(params):
# tracknumber += 1
# items[item]['tracknumber'] = tracknumber
# Starred
# Starred
elif menu_id == 'tracks_starred':
generator = connection.walk_tracks_starred()
@ -553,7 +558,6 @@ def list_tracks(params):
# Random
elif menu_id == 'tracks_random':
generator = connection.walk_tracks_random(**query_args)
# Filters
#else:
#TO WORK
@ -744,7 +748,7 @@ def navigate_next(params):
page = int(params.get('page',1))
page += 1
title = "Next page (%d)" % (page)
title = lang.getLocalizedString(30029) +"(%d)" % (page)
return {
'label': title,
@ -757,7 +761,7 @@ def navigate_next(params):
def navigate_root():
return {
'label': "Back to menu",
'label': lang.getLocalizedString(30030),
'url': plugin.get_url(action='root')
}
@ -870,10 +874,10 @@ def star_item(params):
if did_action:
if unstar:
message = 'Item has been unstarred.'
message = lang.getLocalizedString(30031)
plugin.log('Unstarred %s #%s' % (type,json.dumps(ids)))
else: #star
message = 'Item has been starred!'
message = lang.getLocalizedString(30032)
plugin.log('Starred %s #%s' % (type,json.dumps(ids)))
stars_cache_update(ids,unstar)
@ -900,11 +904,11 @@ def context_action_star(type,id):
if not starred:
if type == 'track':
label = 'Star track'
label = lang.getLocalizedString(30033)
elif type == 'artist':
label = 'Star artist'
label = lang.getLocalizedString(30034)
elif type == 'album':
label = 'Star album'
label = lang.getLocalizedString(30035)
else:
@ -913,11 +917,11 @@ def context_action_star(type,id):
#(since it is not available into the XML response from the server)
if type == 'track':
label = 'Unstar track'
label = lang.getLocalizedString(30036)
elif type == 'artist':
label = 'Unstar artist'
label = lang.getLocalizedString(30037)
elif type == 'album':
label = 'Unstar album'
label = lang.getLocalizedString(30038)
return (
label,
@ -946,9 +950,9 @@ def can_star(type,ids = None):
def context_action_download(type,id):
if type == 'track':
label = 'Download track'
label = lang.getLocalizedString(30039)
elif type == 'album':
label = 'Download album'
label = lang.getLocalizedString(30040)
return (
label,

View File

@ -0,0 +1,162 @@
# XBMC Media Center language file
# Addon Name: Subsonic
# Addon id: plugin.audio.subsonic
# Addon Provider:
# Addon Translate: Moshkopp
msgid ""
msgstr ""
msgctxt "#30000"
msgid "General"
msgstr ""
msgctxt "#30001"
msgid "Server"
msgstr ""
msgctxt "#30002"
msgid "Server URL"
msgstr ""
msgctxt "#30003"
msgid "username"
msgstr ""
msgctxt "#30004"
msgid "password"
msgstr ""
msgctxt "#30005"
msgid "Display"
msgstr ""
msgctxt "#30006"
msgid "Albums per page"
msgstr ""
msgctxt "#30007"
msgid "Tracks per page (ignored in albums & playlists)"
msgstr ""
msgctxt "#30008"
msgid "Download"
msgstr ""
msgctxt "#30009"
msgid "Download folder"
msgstr ""
msgctxt "#30010"
msgid "Streaming"
msgstr ""
msgctxt "#30011"
msgid "Transcode format"
msgstr ""
msgctxt "#30012"
msgid "Bitrate"
msgstr ""
msgctxt "#30013"
msgid "Advanced Settings"
msgstr ""
msgctxt "#30014"
msgid "API version"
msgstr ""
msgctxt "#30016"
msgid "Allow self signed certificates"
msgstr ""
msgctxt "#30017"
msgid "Cache (in minutes) - not yet implemented"
msgstr ""
msgctxt "#30018"
msgid "Cache datas time"
msgstr ""
msgctxt "#30019"
msgid "Artist"
msgstr ""
msgctxt "#30020"
msgid "Albums"
msgstr ""
msgctxt "#30021"
msgid "Tracks"
msgstr ""
msgctxt "#30022"
msgid "Playlists"
msgstr ""
msgctxt "#30023"
msgid "Newest albums"
msgstr ""
msgctxt "#30024"
msgid "Most played albums"
msgstr ""
msgctxt "#30025"
msgid "Recently played albums"
msgstr ""
msgctxt "#30026"
msgid "Random albums"
msgstr ""
msgctxt "#30029"
msgid "Next page"
msgstr ""
msgctxt "#30030"
msgid "Back to Menu"
msgstr ""
msgctxt "#30031"
msgid "Item has been unstarred."
msgstr ""
msgctxt "#30032"
msgid "Item has been starred!"
msgstr ""
msgctxt "#30033"
msgid "Star track"
msgstr ""
msgctxt "#30034"
msgid "Star artist"
msgstr ""
msgctxt "#30035"
msgid "Star album"
msgstr ""
msgctxt "#30036"
msgid "unstar track"
msgstr ""
msgctxt "#30037"
msgid "unstar artist"
msgstr ""
msgctxt "#30038"
msgid "unstar album"
msgstr ""
msgctxt "#30039"
msgid "Download track"
msgstr ""
msgctxt "#30040"
msgid "Download album"
msgstr ""

View File

@ -0,0 +1,161 @@
# XBMC Media Center language file
# Addon Name: Subsonic
# Addon id: plugin.audio.subsonic
# Addon Provider:
# Addon Translate: Moshkopp
msgid ""
msgstr ""
msgctxt "#30000"
msgid "General"
msgstr "Allgemein"
msgctxt "#30001"
msgid "Server"
msgstr "Server"
msgctxt "#30002"
msgid "Server URL"
msgstr "Serveradresse"
msgctxt "#30003"
msgid "username"
msgstr "Benutzername"
msgctxt "#30004"
msgid "password"
msgstr "Passwort"
msgctxt "#30005"
msgid "Display"
msgstr "Anzeige"
msgctxt "#30006"
msgid "Albums per page"
msgstr "Alben pro Seite"
msgctxt "#30007"
msgid "Tracks per page (ignored in albums & playlists)"
msgstr "Lieder pro Seite (wird in Alben und Playlisten ignoriert)"
msgctxt "#30008"
msgid "Download"
msgstr "Download"
msgctxt "#30009"
msgid "Download folder"
msgstr "Download Verzeichnis"
msgctxt "#30010"
msgid "Streaming"
msgstr "Übertragung"
msgctxt "#30011"
msgid "Transcode format"
msgstr "Umwandlungs Format"
msgctxt "#30012"
msgid "Bitrate"
msgstr "Bitrate"
msgctxt "#30013"
msgid "Advanced Settings"
msgstr "Erweitert"
msgctxt "#30014"
msgid "API version"
msgstr "API Version"
msgctxt "#30016"
msgid "Allow self signed certificates"
msgstr "Erlaube eigensignierte Zertifikate"
msgctxt "#30017"
msgid "Cache (in minutes) - not yet implemented"
msgstr "Speicher (in Minuten) noch nicht eingebaut"
msgctxt "#30018"
msgid "Cache datas time"
msgstr "Speicher Daten Zeit"
msgctxt "#30019"
msgid "Artist"
msgstr "Künstler"
msgctxt "#30020"
msgid "Albums"
msgstr "Alben"
msgctxt "#30021"
msgid "Tracks"
msgstr "Lieder"
msgctxt "#30022"
msgid "Playlists"
msgstr "Playlisten"
msgctxt "#30023"
msgid "Newest albums"
msgstr "neueste Alben"
msgctxt "#30024"
msgid "Most played albums"
msgstr "häufig gehörte Alben"
msgctxt "#30025"
msgid "Recently played albums"
msgstr "zuletzt gehörte Alben"
msgctxt "#30026"
msgid "Random albums"
msgstr "Zufällige Alben"
msgctxt "#30029"
msgid "Next page"
msgstr "Nächste Seite"
msgctxt "#30030"
msgid "Back to Menu"
msgstr "Hauptmenü"
msgctxt "#30031"
msgid "Item has been unstarred."
msgstr "Bewertung entfernt"
msgctxt "#30032"
msgid "Item has been starred!"
msgstr "Bewertung hinzugefügt"
msgctxt "#30033"
msgid "Star track"
msgstr "Bewerte Lied"
msgctxt "#30034"
msgid "Star artist"
msgstr "Bewerte Künstler"
msgctxt "#30035"
msgid "Star album"
msgstr "Bewerte Album"
msgctxt "#30036"
msgid "unstar track"
msgstr "Lied Bewertung löschen"
msgctxt "#30037"
msgid "unstar artist"
msgstr "Künstler Bewertung löschen"
msgctxt "#30038"
msgid "unstar album"
msgstr "Album Bewertung löschen"
msgctxt "#30039"
msgid "Download track"
msgstr "Download Lied"
msgctxt "#30040"
msgid "Download album"
msgstr "Download Album"

View File

@ -1,27 +1,28 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<!-- GENERAL -->
<category label="General">
<setting label="Server" type="lsep" />
<setting id="subsonic_url" type="text" label="Server URL" default="http://demo.subsonic.org"/>
<setting id="username" type="text" label="Username" default="guest3"/>
<setting id="password" type="text" option="hidden" label="Password" default="guest"/>
<setting label="Display" type="lsep" />
<setting id="albums_per_page" type="labelenum" label="Albums per page" default="50" values="10|25|50|100|250|500"/>
<setting id="tracks_per_page" type="labelenum" label="Tracks per page (ignored in albums & playlists)" default="100" values="10|25|50|100|250|500"/>
<setting label="Download" type="lsep" />
<setting id="download_folder" type="folder" label="Download folder" source="auto" option="writeable"/>
<setting label="Streaming" type="lsep" />
<setting id="transcode_format_streaming" type="labelenum" label="Transcode format" values="mp3|raw|flv|ogg"/>
<setting id="bitrate_streaming" type="labelenum" label="Bitrate" values="320|256|224|192|160|128|112|96|80|64|56|48|40|32"/>
<category label="30000">
<setting label="30001" type="lsep" />
<setting label="30002" id="subsonic_url" type="text" default="http://demo.subsonic.org"/>
<setting label="30003" id="username" type="text" default="guest3"/>
<setting label="30004" id="password" type="text" option="hidden" default="guest"/>
<setting label="30005" type="lsep" />
<setting label="30006" id="albums_per_page" type="labelenum" default="50" values="10|25|50|100|250|500"/>
<setting label="30007" id="tracks_per_page" type="labelenum" default="100" values="10|25|50|100|250|500"/>
<setting label="30008" type="lsep" />
<setting label="30009" id="download_folder" type="folder" source="auto" option="writeable"/>
<setting label="30010" type="lsep" />
<setting label="30011" id="transcode_format_streaming" type="labelenum" values="mp3|raw|flv|ogg"/>
<setting label="30012" id="bitrate_streaming" type="labelenum" values="320|256|224|192|160|128|112|96|80|64|56|48|40|32"/>
</category>
<!-- ADVANCED -->
<category label="Advanced Settings">
<setting label="Server" type="lsep" />
<setting id="apiversion" type="labelenum" label="API version" values="1.11.0|1.12.0|1.13.0|1.14.0" default="1.13.0"/>
<setting id="insecure" type="bool" label="Allow self signed certificates" default="false" />
<setting label="Cache (in minutes) - not yet implemented" type="lsep" />
<setting id="cachetime" type="labelenum" label="Cache datas time" default="5" values="1|5|15|30|60|120|180|720|1440"/>
<category label="30013">
<setting label="30001" type="lsep" />
<setting label="30014" id="apiversion" type="labelenum" values="1.11.0|1.12.0|1.13.0|1.14.0" default="1.13.0"/>
<setting id="insecure" type="bool" default="false" />
<setting label="30016" type="lsep" />
<setting label="30018" id="cachetime" type="labelenum" default="5" values="1|5|15|30|60|120|180|720|1440"/>
</category>
</settings>