SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-01-2016, 11:30 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 134
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.
Reply With Quote
  #2  
Old 10-01-2016, 04:41 PM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
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.
Reply With Quote
  #3  
Old 10-02-2016, 07:13 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 134
Thanks that works! I can now get favorites in the same order as Sage displays.

David
Quote:
Originally Posted by tmiranda View Post
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")
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 02:03 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.