SageTV Community  

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

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2017, 08:12 PM
silkshadow's Avatar
silkshadow silkshadow is offline
Sage Expert
 
Join Date: Oct 2004
Location: Philippines
Posts: 550
Export list of watched titles?

Is there a way to export a list all titles marked watched in my imported video library?

Specifically would be great if I can get it for just titles currently in the imported media library that have been watched.

I am completely not up to speed on this v9 release but I am on v7 newest with CMT, BMT and all that which are up to date as per the plugin downloader in settings.

Thanks!
Reply With Quote
  #2  
Old 02-21-2017, 05:47 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
I'm sure this could be gleaned from a sagex call. Results would be JSON, most likely.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #3  
Old 02-21-2017, 10:30 PM
silkshadow's Avatar
silkshadow silkshadow is offline
Sage Expert
 
Join Date: Oct 2004
Location: Philippines
Posts: 550
JSON would be OK I believe, I should be able to parse that into whatever I need.

I am unfamiliar with sagex is that an addon I am not using? Is there a guide on how I might accomplish this?

Thank you!
Reply With Quote
  #4  
Old 02-22-2017, 03:19 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
There's a sagex-services plugin that you install, which will then enable access to the sagetv API via a REST interface at http://(your server's address):8080/sagex/api. Guidelines on its use will be present when you navigate to that URL.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #5  
Old 02-25-2017, 06:57 AM
silkshadow's Avatar
silkshadow silkshadow is offline
Sage Expert
 
Join Date: Oct 2004
Location: Philippines
Posts: 550
Thanks Fuzzy, looks like I have my project for the week.
Reply With Quote
  #6  
Old 02-25-2017, 12:36 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by silkshadow View Post
Thanks Fuzzy, looks like I have my project for the week.
I is pretty extensive, and for the most part, can do anyhting that can be done by the sagetv UI (and more). It essentially is a web based version of the entire sagetv API (documented here: http://download.sage.tv/api/sage/api...e-summary.html )
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #7  
Old 02-25-2017, 02:55 PM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
If you are familiar with Groovy, this would do the trick

Code:
import java.io.*;
import java.util.*;
import java.text.SimpleDateFormat;
import sagex.remote.rmi.*;
import sagex.SageAPI ;
import static groovy.io.FileType.*;
import sagex.api.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import org.apache.commons.io.FileUtils;

// Variables
String sageSystem = "HTPC-LR" ;
Integer loopCounter=0 ;

private RMISageAPI parseRmiSetting(String system) {
    String host, port;
    host = system ;
    port = "1098";
    return new RMISageAPI(host, Integer.parseInt(port));
}


// Start of program Main code
RMISageAPI api = parseRmiSetting(sageSystem);
  if(api != null) {
    SageAPI.setProvider(api);
    System.err.          println("# sagex-services manually set to '" + api.toString() + "'");
  } 

for( mfAiring in MediaFileAPI.GetMediaFiles("V") ) {
     if ( AiringAPI.IsWatched(mfAiring) ) {
          println ( MediaFileAPI.GetFileForSegment(mfAiring,0).toString() + " is marked as Watched. " ) ;
          loopCounter++
     }
}

println ("***************") ;
println ("***** END *****") ;
println ("** ${loopCounter} videos watched **") ;
println ("***************") ;
Reply With Quote
  #8  
Old 02-26-2017, 05:43 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
You can do it using this url, provided you have sagex-api/sagex-services installed.


Code:
http://192.168.1.10:8080/sagex/api?c=EvaluateExpression&1=FilterByBoolMethod(GetMediaFiles(%22V%22),%22IsWatched%22,true)&filter=MediaFileID|MediaTitle
It uses the EvaluateExpression API to combine multiple API requests... FilterByBoolMethod and GetMediaFiles. (%22 is just the double quote " encoded into URL form)

The &filter just limits the data coming back to the MediaTilte and MediaFileID.
Reply With Quote
  #9  
Old 02-28-2017, 04:02 AM
silkshadow's Avatar
silkshadow silkshadow is offline
Sage Expert
 
Join Date: Oct 2004
Location: Philippines
Posts: 550
So amazing, thank you guys!!

@graywolf, I run that in a command prompt, after installing Groovy add-in?

What I'll do is install both add ins and see which one I can get working, its been a while since I dug into Sage. Its simply been running well and there's been no need.

Thanks again!
Reply With Quote
  #10  
Old 02-28-2017, 06:38 AM
graywolf's Avatar
graywolf graywolf is offline
Sage Icon
 
Join Date: Oct 2009
Location: NC
Posts: 1,389
Been a while since I did the setup but from memory:
You install Groovy (external to Sage)
Install the sagex then copy the sagex-api.jar to the groovy lib directory (sagegroovy.jar is also helpful for other scripts)

Groovy has a console mode (which is what I use mostly) and you can run the script from there. Or create a bat file which I run via Task Scheduler.

Code:
@ECHO ON
cd C:\Groovy\Scripts\WatchedFolder

for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (
   set DayOfWeek=%%i
   set Month=%%j
   set Day=%%k
   set Year=%%l
   set Date=%%l%%j%%k
)

C:\Groovy\Groovy-2.3.7\bin\groovy.bat C:\Groovy\Scripts\WatchedFolder\ListWatchedVideos.groovy >"C:\Logs\SageTV\ListWatchedVideos_%Date%.txt" 2>&1
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
How do I Export a list of recorded TV? brandypuff SageTV Software 15 05-27-2016 10:24 AM
Export Media List trk2 SageTV v7 Customizations 3 09-10-2015 08:23 AM
Watched Status export/sync with Trakt? Jason SageTV v7 Customizations 0 06-08-2013 06:17 AM
Export a list of imported videos [JiF]Mike SageTV Software 3 02-19-2008 04:20 PM
Export "watched" show list? blackbear SageTV Software 0 10-27-2003 05:44 PM


All times are GMT -6. The time now is 01:20 PM.


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