SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations


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.

Thread Tools Search this Thread Display Modes
Old 08-10-2011, 08:34 PM
darinh darinh is offline
Sage User
Join Date: May 2009
Location: Minneapolis, MN
Posts: 19
CLI importing video into recordings

I have been working to get metadata and fanart for recordings that I have converted and renamed as well as for TV episodes on DVD, and I think I have a handle on that after struggling with BMT and Ortus fanart solutions.

I just ran across mediascraper, but I am hesitant to try another fanart solution since I really am only missing one more piece of functionality...importing a video as a recording. I know that BMT supports this, but have not had success with it. I am hoping to script the conversion process, which includes metadata and fanart downloads and importing into recordings. My script is nearly complete except this last thing...

I also know that nielm's web server supports importing XML files, but it seems to be experimental and I didn't see a way to automate that.

Since I want it to be part of a script I am looking for a way to import videos from the command line (or from inside my Perl script). Any suggestions of where to look, or an existing program/script would be greatly appreciated!
Reply With Quote
Old 08-10-2011, 08:55 PM
Slugger Slugger is offline
Join Date: Mar 2007
Location: Kingston, ON
Posts: 4,008
From Perl, you can use the remote HTTP APIs (see sagex-api + remote sagex api plugins). This allows you to make most Sage API calls via HTTP.

If you're willing to move to Python, you can use the Python wrapper around the same sagex remote APIs that I created for our ongoing Boxee port. The python wrapper allows you to make most Sage API calls in pure python syntax (less a few gotchas, but probably not an issue for what you're trying to do).

Either way, when using a non-Java language, you're best bet is to use the sagex remote HTTP API interface. Making the calls remotely via HTTP to do file imports can be tricky because even though you're making the call remotely, it's still executed locally on the Sage server. So this means if you're importing a video, the file path must be local to the Sage server, not local to the host running the script. If you're running these scripts on the same host as the SageTV server then you can ignore this.
Twitter: @ddb_db
Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive
Capture: 2 x Colossus
STB Controller: 1 x USB-UIRT
Software:Java 1.7.0_71; SageTV 7.1.9
Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter
Plugins: Too many to list now...
Reply With Quote
Old 08-10-2011, 09:26 PM
darinh darinh is offline
Sage User
Join Date: May 2009
Location: Minneapolis, MN
Posts: 19
Yep, good idea. I was looking at the sagex-api and thought it could be good way to do this, but couldn't find a complete list of everything that was available in the API. I found some forum posts with some of the API listed, but didn't see a specific API that allowed for importing videos.

Do you know what the name of the API is for importing videos? Also, will Sage automatically make use of the .properties file that is present?
Reply With Quote
Old 08-11-2011, 05:58 AM
stuckless's Avatar
stuckless stuckless is offline
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,600
darinh, there really insn't an api for "importing" a mediafile. You can call AddMediaFile with all the paramters, but generally sagetv does the adding and a metadata provider (such as bm) simply gets notified about the file and then fetches the metadata/fanart.

The basic "automatic" metadata/fanart process goes lke this...

You add a file to the sagetv collection
You either call Refresh Library api OR you wait for the sagetv periodic refresh to happen
When sagetv "finds" the new file, it adds it, and if there is a .properties, then it will apply those properties to the metadata.
SageTV fires the MediaFileAdded event which then can trigger other actions to happen on the mediafile. In the case of BMT/Phoenix it listens for the MediaFileAdded event and IF there isn't a .properties, then it will fetch metadata fanart for the file.
Reply With Quote
Old 08-11-2011, 10:12 AM
darinh darinh is offline
Sage User
Join Date: May 2009
Location: Minneapolis, MN
Posts: 19
OK, that makes sense. Thanks so much for the information, that helps a bunch!

If BMT is configured to import TV episodes as recordings (the check box is selected on the configuration page) and it receives the notification that a new media file was added, and a properties file already exists will it still do its thing, or is Sage responsible for using the properties information and no more action is required to put the metadata into the database?

So, I have a bunch of videos, I have already imported them as videos into Sage, I create properties files for each video, but Sage doesn't seem to care or do anything with that information. Is a simple library refresh enough to get Sage to read in the metadata and potentially change the video into a recording?

I guess I am confused, when the option in BMT to import TV as recordings is set, what does that actually do in the code?

Reply With Quote

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

Advanced Search
Display Modes

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
What metadata for importing videos into TV recordings? (7.0.13) skiingwiz SageTV Beta Test Software 13 08-08-2010 01:38 PM
Importing recordings from BTV and maintaining history? tmar89 SageTV Software 2 07-31-2010 04:44 PM
Importing videos into SageTV Recordings nathanm SageTV Studio 2 12-11-2006 06:49 PM
Importing old BTV recordings into Sage 5.04 hammondr SageTV Software 6 10-17-2006 09:04 AM
importing other TV recordings into archive Belgrath SageTV Customizations 1 09-29-2006 09:21 AM

All times are GMT -6. The time now is 04:11 PM.

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