|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Adding files from imported videos to recordings
Hi,
I have some files in the imported files directories (video diretories) that I would like to show as recorded shows in the Recodering section. How can I do that? I notice they have a show assosicated with them and a media file,I would like to change the name (title subtitle) and have them show in the Recordings (tv shows). Is there a way to do that using stuio APIs???
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#2
|
||||
|
||||
Does IsTVFile return true? If so, try calling MoveTVFileOutOfLibrary. If not, you may have to do AddAiring first and link it to the file with SetMediaFileAiring.
__________________
-- Greg |
#3
|
|||
|
|||
I use:
Quote:
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#4
|
|||
|
|||
and IsTVFile returns false, both for the old airing and the newShow, after the SetMediaFileShow call.
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#5
|
||||
|
||||
Where are you getting the Show to pass to SetMediaFileShow? Did you check the result of SetMediaFileShow to see if it succeeded?
The following sequence worked for me: AddShow AddAiringDetailed SetMediaFileAiring MoveTVFileOutOfLibrary
__________________
-- Greg |
#6
|
|||
|
|||
still no go.
the videos are not shown in malor view, in fact they stay there where they are (and if i set anew show then they just change the display name). SetMediaForAiring succeeds, IsTVFile returns false. any other ideas?
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#7
|
|||
|
|||
I do not know if I made clear what I want to accomplish here.
I have a file in the Video Library, and I want to have it shown as a recorded show (like shows I recorded and did not delete). It returns as not a TV file, and I want to make it one. Does the StationID field in addAiring count or can I just put 0 here? Which extId do I use for the new show and the new airing? Can any developer help here, if this is at all possible, or any stvi who did this already help (with an actuall example)??? The reason for this is that some shows which were recorded and then a HD failoure occure, I could get the shows themselves but the data (epg) was lost, and so I want to return them to the recorded state(tvfile) so I can view them at my leisure. Can this be done?>
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#8
|
|||
|
|||
Nielm? Dirk? Opus? nobody knows the answer or done this before?
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
#9
|
||||
|
||||
I have done it successfully, using the sequence I outlined earlier together with show info exported by Niel's XML file generator. If you don't have any show info to pass into these calls, though, I don't know how successful you're going to be.
Here's a clip from my code. There's a fair amount of debug output in there, and I haven't included all the support classes and subroutines, but this should give you the general idea. I am using a stationID of zero in cases where I can't find a match. Code:
private static void ExtractShows(Document xdoc, NodeList nlShows) throws InvocationTargetException, net.sf.sageplugins.sagexmlinfo.InvalidDateException { tracer.Enter("ExtractShows()"); for (int ishow = 0; ishow < nlShows.getLength(); ishow++) { Element elemShow = (Element)nlShows.item(ishow); String showID = elemShow.getAttribute("epgId"); tracer.TraceLine(showID); tracer.Indent(); String szTitle = SzGetOptionalElem(elemShow, "title"); String szEpisode = SzGetOptionalElem(elemShow, "episode"); boolean fFirstRun = FGetOptionalElem(elemShow, "firstRun"); long durationShow = LGetOptionalElem(elemShow, "duration") * 1000; String szCategory = SzGetOptionalElem(elemShow, "category"); String szSubCategory = SzGetOptionalElem(elemShow, "subCategory"); String szDescription = SzGetOptionalElem(elemShow, "description"); String szRating = SzGetOptionalElem(elemShow, "rating"); String szYear = SzGetOptionalElem(elemShow, "year"); String szLanguage = SzGetOptionalElem(elemShow, "language"); Date dateOrigAir = DateFromSz(SzGetOptionalElem(elemShow, "originalAirDate")); Element elemAdvisoryList = ElemGetOptional(elemShow, "advisoryList"); ArrayList<String> lszAdvisories = new ArrayList<String>(); if (elemAdvisoryList != null) { NodeList nlAdvisories = elemAdvisoryList.getElementsByTagName("advisory"); for (int iadvisory = 0; iadvisory < nlAdvisories.getLength(); iadvisory++) { Element elemAdvisory = (Element)nlAdvisories.item(iadvisory); lszAdvisories.add(elemAdvisory.getTextContent()); } } Element elemPeopleList = ElemGetOptional(elemShow, "peopleList"); ArrayList<String> lszPeople = new ArrayList<String>(); ArrayList<String> lszRoles = new ArrayList<String>(); if (elemPeopleList != null) { NodeList nlPeople = elemPeopleList.getElementsByTagName("person"); for (int iperson = 0; iperson < nlPeople.getLength(); iperson++) { Element elemPerson = (Element)nlPeople.item(iperson); lszPeople.add(elemPerson.getTextContent()); lszRoles.add(elemPerson.getAttribute("role")); } } ArrayList<String> lszMisc = new ArrayList<String>(); Element elemAiring = ElemGetOptional(elemShow, "airing"); int airingID = Integer.parseInt(elemAiring.getAttribute("sageDbId")); Date dateStart = DateFromSz(elemAiring.getAttribute("startTime")); long durationAiring = Long.parseLong(elemAiring.getAttribute("duration")) * 1000; String szParentalRating = SzGetOptionalElem(elemAiring, "parentalRating"); boolean fWatched = FGetOptionalElem(elemShow, "watched"); boolean fDontLike = FGetOptionalElem(elemShow, "dontLike"); // boolean fManualRecord = FGetOptionalElem(elemShow, "manualRecord"); String channelID = elemAiring.getAttribute("channelId"); Element elemChannel = ElemFromXpath(xdoc, "//channel[@channelId = '" + channelID + "']"); String szChannel = SzGetOptionalElem(elemChannel, "channelName"); int stationID = StationIDFromSzChannel(szChannel); String szExtra = SzGetOptionalElem(elemAiring, "extraDetails"); int ipart = 0; int cpart = 0; boolean fHD = false; boolean fStereo = false; boolean fCC = false; boolean fSAP = false; boolean fSubtitle = false; String szPremiereFinale = ""; if (szExtra != null) { final Pattern pattern = Pattern.compile("Part (\\d+) of (\\d+)"); String[] rgszExtra = szExtra.split(",\\s*"); for (String sz : rgszExtra) { Matcher m = pattern.matcher(sz); if (m.matches()) { ipart = Integer.parseInt(m.group(1)); cpart = Integer.parseInt(m.group(2)); } // else if (sz.equalsIgnoreCase("HDTV")) // fHD = true; else if (sz.equalsIgnoreCase("Stereo")) fCC = true; else if (sz.equalsIgnoreCase("Closed Captioned")) fCC = true; // else if (sz.equalsIgnoreCase("SAP")) // fSAP = true; // else if (sz.equalsIgnoreCase("Subtitles")) // fSubtitle = true; else if (sz.endsWith("Premiere") || sz.endsWith("Finale")) szPremiereFinale = sz; } } Element elemFile = ElemFromXpath(elemAiring, "mediafile/segmentList/segment"); String szFile = elemFile.getAttribute("filePath"); File file = new File(szFile); tracer.TraceLine("AddShow..."); tracer.TraceLine(" szTitle: " + (szTitle != null ? SzQuote(szTitle) : "null")); tracer.TraceLine(" fFirstRun: " + Boolean.toString(fFirstRun)); tracer.TraceLine(" szEpisode: " + (szEpisode != null ? SzQuote(szEpisode) : "null")); tracer.TraceLine(" szDescription: " + (szDescription != null ? SzQuote(szDescription) : "null")); tracer.TraceLine(" durationShow: " + Long.toString(durationShow)); tracer.TraceLine(" szCategory: " + (szCategory != null ? SzQuote(szCategory) : "null")); tracer.TraceLine(" szSubCategory: " + (szSubCategory != null ? SzQuote(szSubCategory) : "null")); tracer.TraceLine(" people: " + lszPeople.toString()); tracer.TraceLine(" roles: " + lszRoles.toString()); tracer.TraceLine(" szRating: " + (szRating != null ? SzQuote(szRating) : "null")); tracer.TraceLine(" advisories: " + lszAdvisories.toString()); tracer.TraceLine(" szYear: " + (szYear != null ? SzQuote(szYear) : "null")); tracer.TraceLine(" misc: " + lszMisc.toString()); tracer.TraceLine(" showID: " + showID); tracer.TraceLine(" szLanguage: " + (szLanguage != null ? SzQuote(szLanguage) : "null")); tracer.TraceLine(" dateOrigAir: " + dateOrigAir.toString()); Object show = sage.SageTV.api("AddShow", new Object[]{ szTitle, // Title fFirstRun, // IsFirstRun szEpisode, // Episode szDescription, // Description durationShow, // Duration szCategory, // Category szSubCategory, // SubCategory lszPeople.toArray(), // PeopleList lszRoles.toArray(), // RolesListForPeopleList szRating, // Rated lszAdvisories.toArray(), // ExpandedRatingsList szYear, // Year "", // ParentalRating lszMisc.toArray(), // MiscList showID, // ExternalID szLanguage, // Language dateOrigAir.getTime() // OriginalAirDate }); tracer.TraceLine("show = " + Tracer.SzTraceObject(show)); tracer.TraceLine("AddAiringDetailed..."); tracer.TraceLine(" showID: " + showID); tracer.TraceLine(" stationID: " + Integer.toString(stationID)); tracer.TraceLine(" dateStart: " + dateStart.toString()); tracer.TraceLine(" durationAiring: " + Long.toString(durationAiring)); tracer.TraceLine(" ipart: " + Integer.toString(ipart)); tracer.TraceLine(" cpart: " + Integer.toString(cpart)); tracer.TraceLine(" szParentalRating: " + (szParentalRating != null ? SzQuote(szParentalRating) : "null")); tracer.TraceLine(" fHD: " + Boolean.toString(fHD)); tracer.TraceLine(" fStereo: " + Boolean.toString(fStereo)); tracer.TraceLine(" fCC: " + Boolean.toString(fCC)); tracer.TraceLine(" fSAP: " + Boolean.toString(fSAP)); tracer.TraceLine(" fSubtitle: " + Boolean.toString(fSubtitle)); tracer.TraceLine(" szPremiereFinale: " + (szPremiereFinale != null ? SzQuote(szPremiereFinale) : "null")); Object airing = sage.SageTV.api("AddAiringDetailed", new Object[]{ showID, // ShowExternalID stationID, // StationID dateStart.getTime(), // StartTime durationAiring, // Duration ipart, // PartNumber cpart, // TotalParts szParentalRating, // ParentalRating fHD, // HDTV fStereo, // Stereo fCC, // ClosedCaptioning fSAP, // SAP fSubtitle, // Subtitle szPremiereFinale // PremierFinale }); tracer.TraceLine("airing = " + Tracer.SzTraceObject(airing)); if (fWatched) { tracer.TraceLine("SetWatched..."); sage.SageTV.api("SetWatched", new Object[]{airing}); } else { tracer.TraceLine("ClearWatched..."); sage.SageTV.api("ClearWatched", new Object[]{airing}); } if (fDontLike) { tracer.TraceLine("SetDontLike..."); sage.SageTV.api("SetDontLike", new Object[]{airing}); } else { tracer.TraceLine("ClearDontLike..."); sage.SageTV.api("ClearDontLike", new Object[]{airing}); } tracer.TraceLine("GetMediaFileForAiring..."); Object mf = sage.SageTV.api("GetMediaFileForAiring", new Object[]{airing}); if (mf == null) { tracer.TraceLine("GetMediaFileForFilePath..."); mf = sage.SageTV.api("GetMediaFileForFilePath", new Object[]{file}); if (mf == null) { tracer.TraceLine("AddMediaFile..."); mf = sage.SageTV.api("AddMediaFile", new Object[]{file, ""}); } tracer.TraceLine("SetMediaFileAiring..."); boolean fSuccess = (Boolean)sage.SageTV.api("SetMediaFileAiring", new Object[]{mf, airing}); tracer.TraceLine(fSuccess ? "Success" : "Failure"); } tracer.TraceLine("mf = " + ((File)sage.SageTV.api("GetFileForSegment", new Object[]{mf, 0})).getAbsolutePath()); tracer.TraceLine("IsVideoFile: " + ((Boolean)sage.SageTV.api("IsVideoFile", new Object[]{mf})).toString()); tracer.TraceLine("IsTVFile: " + ((Boolean)sage.SageTV.api("IsTVFile", new Object[]{mf})).toString()); tracer.TraceLine("IsLibraryFile: " + ((Boolean)sage.SageTV.api("IsLibraryFile", new Object[]{mf})).toString()); tracer.TraceLine("MoveTVFileOutOfLibrary..."); sage.SageTV.api("MoveTVFileOutOfLibrary", new Object[]{mf}); tracer.TraceLine("IsVideoFile: " + ((Boolean)sage.SageTV.api("IsVideoFile", new Object[]{mf})).toString()); tracer.TraceLine("IsTVFile: " + ((Boolean)sage.SageTV.api("IsTVFile", new Object[]{mf})).toString()); tracer.TraceLine("IsLibraryFile: " + ((Boolean)sage.SageTV.api("IsLibraryFile", new Object[]{mf})).toString()); tracer.Unindent(); } tracer.Exit("ExtractShows"); } private static int StationIDFromSzChannel(String szChannelNeeded) throws InvocationTargetException { int stationIDFound = 0; Object[] rgchannel = (Object[])sage.SageTV.api("GetAllChannels", null); for (Object channel : rgchannel) { String szChannel = (String)sage.SageTV.api("GetChannelName", new Object[]{channel}); int stationID = (Integer)sage.SageTV.api("GetStationID", new Object[]{channel}); if (szChannel.equals(szChannelNeeded)) return stationID; else if (szChannel.equals(szChannelNeeded + "DT")) stationIDFound = stationID; } return stationIDFound; }
__________________
-- Greg |
#10
|
|||
|
|||
I think the problem is that I try and use the old MediaFile, for some reason even though SetMediaForAiring reports as successfully, it is still not working fully.
I checked and Nielms web server (ofcourse) works. I am trying very hard to figure out what is happening here....
__________________
Server SageTv 6.3.5, Core2Duo 6300 ,2Gigs ,Saphire x1650, PVR250, 2*320GB + 160GB, java 1.6.1 Client SageTV Client 6.3.5 , AMD 3000, 1024Mb, Saphire x1600Pro256HDMI, java 1.6.1 Using Nielm's Web server 2.22 |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|