SageTV Community  

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

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-25-2005, 03:48 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Long ramble on AddShow, AddAiring, AddMediaFile

I am writing a webserver plugin to allow users to edit data for media files... This would allow people to add data to the DB for external media files. Some uses are:
  • defining or correcting per-eposide data for shows that have no episode data
  • giving the ability to add ratings for 'adult' shows to 'protect the children'
  • importing externally recorded items with EPG data into sage.

A couple of things I have found so far from playing around in Studio...
  • AddAiring's fouth parameter is DURATION (millis), not Stop Time
  • AddShow() with the same ExternalID replaces the existing show data (obvious)
  • ExternalID's come in various forms -- I know about EPxxx and SHxxx, are there others?
  • Sage's behaviour for scheduling/watched handling depends on the ExternalID prefix (eg, EPxxx are used to make sure a watched episode is not re-recorded, airings with SHxxx are always recorded)
  • AddMediaFile uses the fileduration and filetimestamp to calculate file start/stop time

I think therefore that:
- When editing show data for, I should always re-create a new EPxxx (or perhaps MVxxx for movies), an airing for the show and then set it on the mediafile otherwise all recorded episodes of that show will be edited, and any Zap2It updates on the original EpisodeId will undo my changes...
- When linking a file to an airing, I need to make sure the file has the correct start/stop times... This may involve changing the timestamp on the file and re-adding it (which will require renaming it)

- When creating a new EPxxxxx, I need to avoid a number-clash with Zap2it, or with XMLTV

With Zap2It, I can forsee big problems if I name-clash with Zap2It EpisodeId's -- they will effectivly undo any changes made, and may cause Sage to not record required episodes...

I know XMLTV's format (8 digit hex produced from a hash of title+episode)

From Zap2It's website I see that IDs are SH|EP followed by 10 decimal digits
Is this also what's in Sage?


So, my first questions are:
  • What are the supported formats of Episode ID handled by Sage: (size, format-hex/decimal etc)
  • What is the style/range of Episode ID's generated by Zap2It?
  • Can I make up my own ID using a format such as EP|MVext1234?

My next issue is regarding parental ratings in AddShow()

I have seen that with AddShow I can add one of the ratings listed in the parental controls screen in the 'Rating' argument, and it gets handled correctly including prompting for the PIN...

The Advisory Content seems to go as a String[] in the Expanded Ratings List (I successfully tested this using java_util_List_toArray(DataUnion("Graphic Violence","Language","Nudity"))...


Next question is Actors in AddShow() -- PeopleList and RolesForPeopleList -- a slight problem, DataUnions do not work. I see that the AddShow in the EPG plugin uses a String[] and a byte[]... don't know how you can create a byte[] in Studio! Maybe it will work in Java...
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki

Last edited by nielm; 04-26-2005 at 12:55 AM.
Reply With Quote
  #2  
Old 04-25-2005, 03:55 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I don't know what else to say about any of the rest of this, but my EPG data from Zap2It has show IDs with a prefix of MV, SH, or EP, followed by 10 digits -- just like you are seeing on the Zap2It website, I suppose.

- Andy
Reply With Quote
  #3  
Old 04-27-2005, 02:31 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Found a nasty:

If you do a SetMediaFileShow on a MediaFile that has been Imported, it will disappear from the imported video library, and re-appear in the Archived Shows...

But the next refresh finds the SAME media file again and re-adds it to the DB, so the same physical file has 2 MediaFile items...
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #4  
Old 04-27-2005, 02:47 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I wonder if that has to do with the fact that the media file ID is not appended to the end of the filename, so it doesn't see it as already being in the recording database? Maybe appending it to the filename would solve it for the time being...

- Andy
Reply With Quote
  #5  
Old 04-28-2005, 12:12 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by nielm
Next question is Actors in AddShow() -- PeopleList and RolesForPeopleList
Figured it out... They are both String arrays, and can be generated using syntax similar to:
Code:
java_util_List_toArray(DataUnion("Person1", "Person2", "Person3","Person4","Person5","Person6"))
java_util_List_toArray(DataUnion("Actor", "Actress","Director", "Producer","Writer","Supporting Actor"))
. The Roles array uses the same strings as GetPeopleInShowInRole(), namely:
Code:
Actor
Lead Actor
Supporting Actor
Actress
Lead Actress
Supporting Actress
Guest
Guest Star
Director
Producer
Writer
Choreographer
Sports Figure
Coach
Host
Executive Producer
Artist
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #6  
Old 04-28-2005, 12:15 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by Opus4
I wonder if that has to do with the fact that the media file ID is not appended to the end of the filename, so it doesn't see it as already being in the recording database? Maybe appending it to the filename would solve it for the time being...
I think I have already tried that... (and it's the Airing ID thats appended!)

If a file is added outside of any library directories, or was inside a TV directory, it is OK, it is only if the file is in a library directory that it will get re-added at next refresh....

It also happens on DVD's (which you cannot rename as the 'file' is the VIDEO_TS directory)...
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki

Last edited by nielm; 04-28-2005 at 12:27 PM.
Reply With Quote
  #7  
Old 04-29-2005, 08:32 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
And one last thing that got me...

You can create a duplicate airing (ie one that is on the same channel, at the same time but with a different EPGID) as an existing airing, but you cannot use this duplicate airing in a SetMediaFileAiring() call, if there is already a media file using the other airing in the DB.

As an example, I wanted the new webserver edit show info module to work like this
  • AddShow
  • Airing=AddAiring()
  • rename mediafile to match show-episode-airingid-0.mpg
  • newMediaFile=AddMediaFile(renamed file)
  • SetMediaFileAiring(newMediaFile, Airing)
this would mean that the old media file db entry would still be there, and if things don't work, I only have to rename the file back to the old name and delete the newMediaFile for things to be unchanged.

Unfortunaly, the SetMediaFileAiring does not work, so I have to delete the old mediafile DB entry first...
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #8  
Old 05-01-2005, 06:03 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
I noticed you're using the same naming format as SageTV. Just to let you know, the naming convention shouldn't affect anything. You should be able to name the files anyway you want and it'll have no effect on SageTV.

I found & fixed the bug where you'd get duplicate files. I assume this was only happening when you used Show ExternalIDs that started with SP, EP, SH or MV, right? (SP is sports) This was happening because SageTV was flagging them as TV files when it saw the special external ID....which caused them to be skipped over when doing the import scan....so the scan was fixed to also check acquisition mode (which is still set to automatic by import path).

For the bug where you're creating a duplicate airing....it might be OK. Are you going off the return value of SetMediaFileAiring only? Because if you call AddAiring and it overlaps on time/channel with an Airing already in the DB; any ManualRecords and MediaFile objects that link to it will automatically be updated to reflect this (otherwise Zap2it EPG data changes would cause the links to ManualRecords and MediaFiles to be lost....which was an old bug). So you may be done at the point you call AddAiring. Let me know how it goes.

Does that clear up everything on this topic yet? I
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #9  
Old 05-02-2005, 02:30 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by Narflex
I noticed you're using the same naming format as SageTV. Just to let you know, the naming convention shouldn't affect anything. You should be able to name the files anyway you want and it'll have no effect on SageTV.
yep I know: just being consistant, and also means that my How-To on replacing an mpg with an avi is still correct, and the future How-To on how to un-archive media files (shut down sage, put them in a TV directory and rename them, while keeping the AiringID!) will be correct.

Quote:
I found & fixed the bug where you'd get duplicate files. I assume this was only happening when you used Show ExternalIDs that started with SP, EP, SH or MV, right? (SP is sports)
Cool I only ever tried using EPxxx... Cant remember why now, probably thought that it would be unsafe to use any other ID.
Quote:
This was happening because SageTV was flagging them as TV files when it saw the special external ID....
Ah that would be a good reason to keep using EPxxxx, otherwise they would never show up in SageRecordings/Archived recordings... Side thought... This would be a very one way of generating a media library with Show metadata in the DB, but keeping library shows separate from TV shows... I was thinking something like an import system that uses the directory structure to auto-generate categories, and .my files with show info...

Quote:
For the bug where you're creating a duplicate airing....it might be OK. Are you going off the return value of SetMediaFileAiring only?
yes.
Quote:
Because if you call AddAiring and it overlaps on time/channel with an Airing already in the DB; any ManualRecords and MediaFile objects that link to it will automatically be updated to reflect this (otherwise Zap2it EPG data changes would cause the links to ManualRecords and MediaFiles to be lost....which was an old bug). So you may be done at the point you call AddAiring. Let me know how it goes.
Will do

Thanks for the info!
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki

Last edited by nielm; 05-02-2005 at 03:45 AM.
Reply With Quote
  #10  
Old 09-01-2006, 10:59 AM
malore's Avatar
malore malore is offline
Sage Fanatic
 
Join Date: Aug 2003
Location: Iowa
Posts: 877
I want to use AddShow to change the parental rating on some episodes that it's not set, but I can't seem to get it to work. I can change the movie rating and other things, but not the parental rating. I've tried using a simple string, data union, and java_util_List_toArray.

ratings = GetAiringRatings(Airing)
SetElement(ratings, 0, "TV14")
AddShow(GetShowTitle(Airing), IsShowFirstRun(Airing), GetShowEpisode(Airing), GetShowDescription(Airing), GetShowDuration(Airing), GetShowCategory(Airing), GetShowSubCategory(Airing), GetPeopleListInShow(Airing), GetRolesInShow(Airing), GetShowRated(Airing), GetShowExpandedRatings(Airing), GetShowYear(Airing), ratings, GetShowMisc(Airing), GetShowExternalID(Airing), GetShowLanguage(Airing), GetOriginalAiringDate(Airing))
Reply With Quote
  #11  
Old 09-01-2006, 11:21 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
According to the docs, the ParentalRating argument to AddShow is ignored. AddAiringDetailed has the real ParentalRating info.
__________________
-- Greg
Reply With Quote
  #12  
Old 09-01-2006, 02:46 PM
malore's Avatar
malore malore is offline
Sage Fanatic
 
Join Date: Aug 2003
Location: Iowa
Posts: 877
Thanks, I'm so used to figuring out everything on my own, I forgot that there are docs now. I might get spoiled.

AddAiringDetailed worked like a charm however, I don't see an easy way to get the information to fill in PartNumber, TotalParts, Stereo, ClosedCaptioning, SAP, Subtitled, PremierFinale since it's all lumped into GetExtraAiringDetails.

Last edited by malore; 09-01-2006 at 03:14 PM.
Reply With Quote
  #13  
Old 09-01-2006, 03:47 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
I posted some code a little while ago for parsing out that stuff from the files produced by Niel's XML generator. Feel free to crib from that if you like.

http://forums.sagetv.com/forums/show...29&postcount=9
__________________
-- Greg
Reply With Quote
  #14  
Old 09-01-2006, 04:06 PM
malore's Avatar
malore malore is offline
Sage Fanatic
 
Join Date: Aug 2003
Location: Iowa
Posts: 877
Working solution:

Details = GetExtraAiringDetails(Airing)
-PartNumber = java_lang_Integer_parseInt(java_lang_String_replaceFirst(Details,".*?Part (\\d+) of (\\d+).*", "$1"))
--TotalParts = java_lang_Integer_parseInt(java_lang_String_replaceFirst(Details,".*?Part (\\d+) of (\\d+).*", "$2"))
---AddAiringDetailed(GetShowExternalID(Airing), GetStationID(GetChannel(Airing)), GetAiringStartTime(Airing), GetAiringDuration(Airing), PartNumber, TotalParts, "TV14", IsAiringHDTV(Airing), java_lang_String_matches(Details,".*Stereo.*"),java_lang_String_matches(Details,".*Closed Captioned.*"), java_lang_String_matches(Details,".*SAP.*"),java_lang_String_matches(Details,".*Subtitled.*"), java_lang_String_replaceFirst(Details,".*?(Channel Premiere|Premiere|Season Finale|Season Premiere|Series Finale|Series Premiere).*", "$1"))

A lot of code just to change PG to TV14

Last edited by malore; 09-01-2006 at 04:10 PM.
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


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


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