diff --git a/components/data/user.xml b/components/data/user.xml index 996da52c..86d0e7ce 100644 --- a/components/data/user.xml +++ b/components/data/user.xml @@ -54,7 +54,16 @@ }) set_setting("available_users", formatJson(users)) end if + end function + function removeFromRegistry() + new_users = [] + users = parseJson(get_setting("available_users", "[]")) + for each user in users + if m.top.id <> user.id then new_users.push(user) + end for + + set_setting("available_users", formatJson(new_users)) end function function getPreference(key as String, default as String) diff --git a/components/tvshows/rowlist-show.xml b/components/tvshows/rowlist-show.xml index 7bea273d..f35284be 100644 --- a/components/tvshows/rowlist-show.xml +++ b/components/tvshows/rowlist-show.xml @@ -92,6 +92,14 @@ if key = "down" and (m.top.itemFocused + 1) = m.top.content.getChildCount() m.top.getScene().findNode("pager").setFocus(true) m.top.getScene().findNode("pager").getChild(0).setFocus(true) + return true + else if key = "options" + options = m.top.getScene().findNode("options") + list = options.findNode("panelList") + + options.visible = true + list.setFocus(true) + return true end if diff --git a/components/tvshows/scene.xml b/components/tvshows/scene.xml index 8208395b..60d33379 100644 --- a/components/tvshows/scene.xml +++ b/components/tvshows/scene.xml @@ -11,5 +11,6 @@ /> + diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs index 3cdf7d0e..de3b9ac7 100644 --- a/source/ShowScenes.brs +++ b/source/ShowScenes.brs @@ -207,8 +207,8 @@ sub ShowMovieOptions(library) page_num = 1 page_size = 30 - sort_order = get_user_setting("movie_sort_order", "Descending") - sort_field = get_user_setting("movie_sort_field", "DateCreated,SortName") + sort_order = get_user_setting("movie_sort_order", "Ascending") + sort_field = get_user_setting("movie_sort_field", "SortName") options_list = ItemList(library.id, {"limit": page_size, "StartIndex": page_size * (page_num - 1), @@ -242,7 +242,7 @@ sub ShowMovieOptions(library) {"title": "Sort Order", "base_title": "Sort Order", "key": "movie_sort_order", - "default": "Descending", + "default": "Ascending", "values": [ {display: "Descending", value: "Descending"}, {display: "Ascending", value: "Ascending"} @@ -357,8 +357,8 @@ sub ShowTVShowOptions(library) page_num = 1 page_size = 30 - sort_order = get_user_setting("tvshow_sort_order", "Descending") - sort_field = get_user_setting("tvshow_sort_field", "DateCreated,SortName") + sort_order = get_user_setting("series_sort_order", "Ascending") + sort_field = get_user_setting("series_sort_field", "SortName") options_list = ItemList(library.id, {"limit": page_size, "page": page_num, @@ -376,10 +376,49 @@ sub ShowTVShowOptions(library) pager.observeField("escape", port) pager.observeField("pageSelected", port) + sidepanel = scene.findNode("options") + panel_options = [ + {"title": "Sort Field", + "base_title": "Sort Field", + "key": "series_sort_field", + "default": "SortName", + "values": [ + {display: "Date Added", value: "DateCreated"}, + {display: "Release Date", value: "PremiereDate"}, + {display: "Name", value: "SortName"} + ]}, + {"title": "Sort Order", + "base_title": "Sort Order", + "key": "series_sort_order", + "default": "Ascending", + "values": [ + {display: "Descending", value: "Descending"}, + {display: "Ascending", value: "Ascending"} + ]} + ] + new_options = [] + for each opt in panel_options + o = CreateObject("roSGNode", "OptionsData") + o.title = opt.title + o.choices = opt.values + o.base_title = opt.base_title + o.config_key = opt.key + o.value = get_user_setting(opt.key, opt.default) + new_options.append([o]) + end for + + sidepanel.options = new_options + sidepanel.observeField("escape", port) + while true msg = wait(0, port) if nodeEventQ(msg, "escape") and msg.getNode() = "pager" options.setFocus(true) + ' TODO - rename + ' Obnoxiously here, "options" getNode is the "options panel" + ' and options.setFocus is the "options of tv shows" + else if nodeEventQ(msg, "escape") and msg.getNode() = "options" + options.setFocus(true) else if nodeEventQ(msg, "pageSelected") and pager.pageSelected <> invalid pager.pageSelected = invalid page_num = int(val(msg.getData().id)) @@ -517,7 +556,7 @@ sub ShowCollections(library) {"title": "Sort Field", "base_title": "Sort Field", "key": "movie_sort_field", - "default": "DateCreated", + "default": "SortName", "values": [ {display: "Date Added", value: "DateCreated"}, {display: "Release Date", value: "PremiereDate"}, @@ -526,7 +565,7 @@ sub ShowCollections(library) {"title": "Sort Order", "base_title": "Sort Order", "key": "movie_sort_order", - "default": "Descending", + "default": "Ascending", "values": [ {display: "Descending", value: "Descending"}, {display: "Ascending", value: "Ascending"} @@ -587,8 +626,8 @@ sub ShowSearchOptions(query) options = scene.findNode("SearchSelect") - sort_order = get_user_setting("search_sort_order", "Descending") - sort_field = get_user_setting("search_sort_field", "DateCreated,SortName") + sort_order = get_user_setting("search_sort_order", "Ascending") + sort_field = get_user_setting("search_sort_field", "SortName") results = SearchMedia(query) options.itemData = results diff --git a/source/api/userauth.brs b/source/api/userauth.brs index b1236980..9d45a936 100644 --- a/source/api/userauth.brs +++ b/source/api/userauth.brs @@ -42,7 +42,14 @@ function PickUser(id as string) set_setting("active_user", this_user.id) set_setting("server", this_user.server) set_setting("port", this_user.port) +end function +function RemoveUser(id as string) + user = CreateObject("roSGNode", "UserData") + user.id = id + user.callFunc("removeFromRegistry") + + if get_setting("active_user") = id then SignOut() end function function ServerInfo()