Browse files

Reorganize Menus + translation error

  • Loading branch information...
1 parent ede2752 commit 947e012dbd331a3f1690241029dd937b714fd5f0 @pietervanh pietervanh committed Mar 25, 2012
View
39 default.py
@@ -62,6 +62,8 @@
MODE_USERS_FOLLOWINGS = 26
MODE_USERS_FOLLOWERS = 27
+MODE_YOU = 28
+
# Parameter keys
PARAMETER_KEY_OFFSET = u'offset'
PARAMETER_KEY_LIMIT = u'limit'
@@ -129,30 +131,38 @@ def addDirectoryItem(name, label2='', infoType="Music", infoLabels={}, isFolder=
print(url)
return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=li, isFolder=isFolder)
+def show_you_menu():
+ ''' Show the You menu. '''
+ if loginerror=="true":
+ xbmc.executebuiltin("Notification(%s,%s,%i)" % ("warning", LANGUAGE(31), 5000))
+ ADDON.openSettings()
+ else:
+ if login == 'true':
+ addDirectoryItem(name=LANGUAGE(6), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "dashboard", PARAMETER_KEY_MODE: MODE_TRACKS_DASH, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
+ addDirectoryItem(name=LANGUAGE(7), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "private", PARAMETER_KEY_MODE: MODE_TRACKS_PRIVATE, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
+ addDirectoryItem(name=LANGUAGE(2), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "favorites", PARAMETER_KEY_MODE: MODE_TRACKS_FAVORITES, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
+ addDirectoryItem(name=LANGUAGE(12), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "owntracks", PARAMETER_KEY_MODE: MODE_TRACKS_OWN, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
+ addDirectoryItem(name=LANGUAGE(8), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "followings", PARAMETER_KEY_MODE: MODE_USERS_FOLLOWINGS, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
+ addDirectoryItem(name=LANGUAGE(9), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "followers", PARAMETER_KEY_MODE: MODE_USERS_FOLLOWERS, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
+ addDirectoryItem(name=LANGUAGE(10), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "mygroups", PARAMETER_KEY_MODE: MODE_GROUPS_FAVORITES, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
+ xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
+ else:
+ ADDON.openSettings()
+
def show_tracks_menu():
''' Show the Tracks menu. '''
- if login == 'true':
- addDirectoryItem(name=LANGUAGE(2), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "favorites", PARAMETER_KEY_MODE: MODE_TRACKS_FAVORITES, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
- addDirectoryItem(name=LANGUAGE(6), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "dashboard", PARAMETER_KEY_MODE: MODE_TRACKS_DASH, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
- addDirectoryItem(name=LANGUAGE(7), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "private", PARAMETER_KEY_MODE: MODE_TRACKS_PRIVATE, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
- addDirectoryItem(name=LANGUAGE(12), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "owntracks", PARAMETER_KEY_MODE: MODE_TRACKS_OWN, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(4), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "tracks/hottest", PARAMETER_KEY_MODE: MODE_TRACKS_HOTTEST, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(3), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "tracks/search", PARAMETER_KEY_MODE: MODE_TRACKS_SEARCH, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
def show_users_menu():
''' Show the Users menu. '''
- if login == 'true':
- addDirectoryItem(name=LANGUAGE(8), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "followings", PARAMETER_KEY_MODE: MODE_USERS_FOLLOWINGS, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
- addDirectoryItem(name=LANGUAGE(9), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "followers", PARAMETER_KEY_MODE: MODE_USERS_FOLLOWERS, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(4), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "users/hottest", PARAMETER_KEY_MODE: MODE_USERS_HOTTEST, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(3), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "users/search", PARAMETER_KEY_MODE: MODE_USERS_SEARCH, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
def show_groups_menu():
''' Show the Groups menu. '''
- if login == 'true':
- addDirectoryItem(name=LANGUAGE(10), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "mygroups", PARAMETER_KEY_MODE: MODE_GROUPS_FAVORITES, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(4), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "groups/hottest", PARAMETER_KEY_MODE: MODE_GROUPS_HOTTEST, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(3), parameters={PARAMETER_KEY_URL: PLUGIN_URL + "groups/search", PARAMETER_KEY_MODE: MODE_GROUPS_SEARCH, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
xbmcplugin.endOfDirectory(handle=handle, succeeded=True)
@@ -241,6 +251,7 @@ def _show_keyboard(default="", heading="", hidden=False):
def show_root_menu():
''' Show the plugin root menu. '''
+ addDirectoryItem(name=LANGUAGE(13), parameters={PARAMETER_KEY_URL: PLUGIN_URL + 'you', PARAMETER_KEY_MODE: MODE_YOU, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(0), parameters={PARAMETER_KEY_URL: PLUGIN_URL + 'groups', PARAMETER_KEY_MODE: MODE_GROUPS, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(5), parameters={PARAMETER_KEY_URL: PLUGIN_URL + 'tracks', PARAMETER_KEY_MODE: MODE_TRACKS, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
addDirectoryItem(name=LANGUAGE(11), parameters={PARAMETER_KEY_URL: PLUGIN_URL + 'users', PARAMETER_KEY_MODE: MODE_USERS, PARAMETER_KEY_TOKEN: oauth_token}, isFolder=True)
@@ -251,6 +262,8 @@ def show_root_menu():
if not sys.argv[ 2 ] or not url:
# new start
ok = show_root_menu()
+elif mode == MODE_YOU:
+ ok = show_you_menu()
elif mode == MODE_GROUPS:
ok = show_groups_menu()
elif mode == MODE_TRACKS:
@@ -312,8 +325,4 @@ def show_root_menu():
tracks = soundcloud_client.get_user_tracks(int(params.get(PARAMETER_KEY_OFFSET, "0")), int(params.get(PARAMETER_KEY_LIMIT, "50")), mode, url, params.get("user_permalink"))
ok = show_tracks(parameters={PARAMETER_KEY_OFFSET: int(params.get(PARAMETER_KEY_OFFSET, "0")), PARAMETER_KEY_LIMIT: int(params.get(PARAMETER_KEY_LIMIT, "50")), PARAMETER_KEY_MODE: mode, PARAMETER_KEY_URL: url}, tracks=tracks)
elif mode == MODE_TRACK_PLAY:
- play_track(params.get(PARAMETER_KEY_PERMALINK, "1"))
-
-if loginerror=="true":
- xbmc.executebuiltin("Notification(%s,%s,%i)" % ("warning", "Login Failed", 5000))
-
+ play_track(params.get(PARAMETER_KEY_PERMALINK, "1"))
View
6 resources/language/Bulgarian/strings.xml
@@ -16,9 +16,13 @@
<string id="10">Моите групи</string>
<string id="11">Потребители</string>
<string id="12">Моите аудио записи</string>
-
+ <string id="13">You</string>
+
<!-- * Script Settings -->
<string id="22">Вписване в SoundCloud</string>
<string id="23">Потребител (ел. поща)</string>
<string id="24">Парола</string>
+
+ <!-- * Messages -->
+ <string id="31">Login Failed</string>
</strings>
View
4 resources/language/Dutch/strings.xml
@@ -13,9 +13,13 @@
<string id="10">Mijn groepen</string>
<string id="11">Gebruikers</string>
<string id="12">Eigen Nummers</string>
+ <string id="13">Jij</string>
<!-- * Script Settings -->
<string id="22">Inloggen op SoundCloud</string>
<string id="23">GebruikersNaam (email)</string>
<string id="24">Paswoord</string>
+
+ <!-- * Messages -->
+ <string id="31">Login Mislukt</string>
</strings>
View
6 resources/language/English/strings.xml
@@ -11,11 +11,15 @@
<string id="8">You Follow</string>
<string id="9">Your Followers</string>
<string id="10">My Groups</string>
- <string id="11">Users</string>
+ <string id="11">People</string>
<string id="12">Own Tracks</string>
+ <string id="13">You</string>
<!-- * Script Settings -->
<string id="22">Logon on SoundCloud</string>
<string id="23">User (email)</string>
<string id="24">Password</string>
+
+ <!-- * Messages -->
+ <string id="31">Login Failed</string>
</strings>

0 comments on commit 947e012

Please sign in to comment.