Switch to side-by-side view

--- a/src/cdplugins/gmusic/gmusic-app.py
+++ b/src/cdplugins/gmusic/gmusic-app.py
@@ -168,13 +168,131 @@
 @plugin.route('/')
 def root():
     add_directory('Library', my_music)
-
+    add_directory('Genres', root_genres)
+    add_directory('Listen now', listen_now)
+    add_directory('Thematic', root_situations)
+    
+@plugin.route('/root_genres')
+def root_genres():
+    items = session.get_genres()
+    view(items, urls_from_id(genre_view, items))
+
+@plugin.route('/root_situations')
+def root_situations():
+    items = session.get_situation_content()
+    sits = items['situations']
+    if sits:
+        view(sits, urls_from_id(situation_view, sits))
+    sts = items['stations']
+    if sts:
+        view(sts, urls_from_id(dynstation_view, sts))
+
+@plugin.route('/situation/<situation_id>')
+def situation_view(situation_id):
+    items = session.get_situation_content(situation_id)
+    sits = items['situations']
+    if sits:
+        view(sits, urls_from_id(situation_view, sits))
+    sts = items['stations']
+    if sts:
+        view(sts, urls_from_id(dynstation_view, sts))
+    
+@plugin.route('/dynstation/<radio_id>')
+def dynstation_view(radio_id):
+    track_list(session.create_curated_and_get_tracks(radio_id))
+
+@plugin.route('/listen_now')
+def listen_now():
+    data = session.listen_now()
+    items = data['albums']
+    print("listen_now: albums: %s" % items, file=sys.stderr)
+    if len(items):
+        view(items, urls_from_id(album_view, items))
+    items = data['stations']
+    print("listen_now: stations: %s" % items, file=sys.stderr)
+    if len(items):
+        view(items, urls_from_id(station_view, items))
+
+@plugin.route('/station/<radio_id>')
+def station_view(radio_id):
+    track_list(session.get_station_tracks(radio_id))
+
+@plugin.route('/genre/<genre_id>')
+def genre_view(genre_id):
+    items = session.get_genres(genre_id)
+    if len(items) != 0:
+        # List subgenres
+        view(items, urls_from_id(genre_view, items))
+    else:
+        id = session.create_station_for_genre(genre_id)
+        track_list(session.get_station_tracks(id))
+        session.delete_user_station(id)
+        
 @plugin.route('/my_music')
 def my_music():
-    add_directory('Albums', my_music)
-
-#data = api.get_all_songs()
-#print("songs: %s" % json.dumps(data,indent=4))
+    add_directory('Albums', user_albums)
+    add_directory('Artists', user_artists)
+    add_directory('Promoted Tracks', promoted_tracks)
+    add_directory('Playlists', user_playlists)
+    add_directory('Radios Stations', user_stations)
+
+@plugin.route('/user_stations')
+def user_stations():
+    items = session.get_user_stations()
+    view(items, urls_from_id(station_view, items))
+
+@plugin.route('/promoted_tracks')
+def promoted_tracks():
+    track_list(session.get_promoted_tracks())
+
+@plugin.route('/user_playlists')
+def user_playlists():
+    items = session.get_user_playlists()
+    view(items, urls_from_id(playlist_view, items))
+
+@plugin.route('/user_albums')
+def user_albums():
+    items = session.get_user_albums()
+    print("user_albums: got %s" % items, file=sys.stderr)
+    view(items, urls_from_id(album_view, items))
+
+@plugin.route('/user_artists')
+def user_artists():
+    try:
+        items = session.get_user_artists()
+    except Exception as err:
+        msgproc.log("session.get_user_artists failed: %s" % err)
+        return
+    if items:
+        #msgproc.log("First artist name %s"% items[0].name)
+        view(items, urls_from_id(artist_view, items))
+
+@plugin.route('/album/<album_id>')
+def album_view(album_id):
+    track_list(session.get_album_tracks(album_id))
+
+@plugin.route('/playlist/<playlist_id>')
+def playlist_view(playlist_id):
+    track_list(session.get_playlist_tracks(playlist_id))
+
+def ListItem(tt):
+    return tt
+
+@plugin.route('/artist/<artist_id>')
+def artist_view(artist_id):
+    xbmcplugin.addDirectoryItem(
+        plugin.handle, plugin.url_for(related_artists, artist_id),
+        ListItem('Related Artists'), True
+    )
+    data = session.get_artist_info(artist_id)
+    albums = data["albums"]
+    view(albums, urls_from_id(album_view, albums))
+    track_list(data["toptracks"])
+    
+@plugin.route('/artist/<artist_id>/related')
+def related_artists(artist_id):
+    artists = session.get_artist_related(artist_id)
+    view(artists, urls_from_id(artist_view, artists))
 
 @dispatcher.record('search')
 def search(a):