|
SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Favorites API questions
I am trying to get the Favorites in priority order like is displayed in the stv(V9.0.8.429). I can get the favorites using the code below but the order doesn't match what the stv is showing. I would also like to be able to make a favorite higher or lower priority so I can do a favorite rearrangement like STV does. The only api call I see that looks to change the priority is CreateFavoritePriority. Using the code below each time I run it I would expect the second favorite to become the highest priority favorite but when I run it several times it doesn't change the order. Googling the "SageTV GetFavorites" seems to imply that the order returned is in priority order but the api docs don't say anything about it. I am running this code below as a standalone program using sagex but it will ultimately be in a plugin.
Thanks! public static void testFavorites() { Object[] favorites = FavoriteAPI.GetFavorites(); for(int x = 0; x < favorites.length; x++) { String Title = FavoriteAPI.GetFavoriteTitle(favorites[x]); String description = FavoriteAPI.GetFavoriteDescription(favorites[x]); System.out.printf("Favorite title: %s Description: %s\n", Title, description); } if (favorites.length >1) { FavoriteAPI.CreateFavoritePriority(favorites[1], favorites[0]); System.out.printf("Favorite %s set to highest priority\n", FavoriteAPI.GetFavoriteTitle(favorites[1]) ); } } Last edited by davidb; 10-01-2016 at 11:32 AM. |
#2
|
||||
|
||||
Yes, sorting Favorites is a little strange.
Take a look at the Sort() method in the Database API. Set the last parameter (SortTechnique) to "FavoritePriority" and it will do what you want. SortedFavorites = Sort(GetFavorites(), false, "FavoritePriority")
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#3
|
||||
|
||||
Thanks that works! I can now get favorites in the same order as Sage displays.
David |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ROKU Questions, Plex Questions | ThePaladinTech | The SageTV Community | 16 | 08-26-2013 10:53 PM |
Questions on Archive settings & Favorites | -=Jeff=- | SageTV Software | 26 | 05-17-2011 03:42 PM |
Newbie questions... hardware questions | bigRoN18 | Hardware Support | 9 | 10-13-2010 02:50 PM |
Back to the basics: Favorites questions | mkanet | SageMC Custom Interface | 9 | 09-19-2009 10:27 AM |
noob questions on favorites... | kjfarley | SageTV Software | 3 | 09-09-2008 11:31 AM |