|
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
|
|||
|
|||
Need to Get mediafileID
Is there a way that I can get the Mediafileid using a java command or a sageex command for a given file. Maybe someone that knows a lot more than me can post some code... if possible.
GetMediaFileID() in the MediaFileAPI Right now I am getting it from the Nielm file xml created for each file.. would like a better approach. Code:
</peopleList> <originalAirDate>2013-12-03T00:00:00.00Z</originalAirDate> <airing channelId="0" duration="3600" favoriteId="10318944" sageDbId="10000232" startTime="2013-12-03T04:00:00.00Z"> <parentalRating>TV14</parentalRating> <recordSchedule duration="3600" startTime="2013-12-03T04:00:00.00Z"/> <isHDTV/> <stereo/> <closedCaptioned/> <mediafile duration="3592" sageDbId="10000220" startTime="2013-12-03T04:00:08.53Z" type="TV"> <segmentList> <segment duration="3592" filePath="R:\SAGER\Almost Human - S01E04 - The Bends -8636467-0.mkv" startTime="2013-12-03T04:00:08.53Z"/> </segmentList> </mediafile> </airing> </show> </showList> <systemMessageList/> </sageShowInfo>
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. Last edited by nyplayer; 02-13-2014 at 03:22 PM. |
#2
|
||||
|
||||
http://download.sage.tv/api/index.ht...iaFileAPI.html
GetMediaFileID(sage.MediaFile MediaFile) Returns the unique ID used to identify this MediaFile. GetMediaFileForFilePath(java.io.File FilePath) Returns the MediaFile from the database that corresponds to a specified file on disk so it would be something like: MediaFileAPI.GetMediaFileID(MediaFileAPI.GetMediaFileForFilePath(File("\\\\TOWER\\TV\\Bones-TheGhostintheMachine-1484891-0.mpg"))) Last edited by graywolf; 02-13-2014 at 06:00 PM. |
#3
|
||||
|
||||
Groovy but it is close enough to Java that you should be able to use it.
Might be some tidbits in here also you can use Code:
// ShowAPI.AddShow() // Make sure the show you create has an external ID starting with MV, SH or EP // MediaFileAPI.AddMediaFile() // MediaFileAPI.SetMediaFileShow() // Use the Show and MediaFile objs you created in the first calls as the arguments to this call import org.apache.commons.io.FileUtils; import static groovy.io.FileType.*; import com.google.code.sagetvaddons.sjq.network.ServerClient; File dest = new File("\\\\TOWER\\UnArchived\\lr\\Bones-TheGhostintheMachine-1484891-0.mpg"); //Object mf = MediaFileAPI.AddMediaFile(dest,''); Object mf = MediaFileAPI.GetMediaFileForFilePath(dest) ; //MediaFileAPI.SetMediaFileMetadata(mf,'ExternalID','EPmt80379S01E02') ; println ( "MF # of Segments = " + MediaFileAPI.GetNumberOfSegments(mf) ) ; //Object mfAiring = AiringAPI.AddAiring(java.lang.String ShowExternalID, int StationID, long StartTime, long Duration) ; Object mfAiring = MediaFileAPI.GetMediaFileAiring(mf) ; //Object mfAiring = AiringAPI.GetAiringForID(5935910); //Object mfShow = ShowAPI.GetShowForExternalID(ShowAPI.GetShowExternalID(mf) ) ; Object mfShow = AiringAPI.GetShow(mfAiring) ; //println ("Record = " + AiringAPI.Record(mfAiring) ); /* Object mfOld = AiringAPI.GetMediaFileForAiring(mfAiring) ; if ( mfOld == null ) { println ("Airing not linked to a MediaFile") ; if ( MediaFileAPI.SetMediaFileShow(mf,mfShow) ) { println ("MediaFile should now be linked properly"); } else { println ("Error in MediaFile link"); } } else { println ("Airing linked to MF = " + MediaFileAPI.GetSegmentFiles(mfOld) ) ; } */ // sage.Airing AddAiring(java.lang.String ShowExternalID, int StationID, MediaFileAPI.GetStartForSegment(mf,sage.MediaFile MediaFile, int SegmentNumber) , long Duration) /* sage.Show AddShow(java.lang.String Title, boolean IsFirstRun, java.lang.String Episode, java.lang.String Description, long Duration, java.lang.String Category, java.lang.String SubCategory, java.lang.String[] PeopleList, java.lang.String[] RolesListForPeopleList, java.lang.String Rated, java.lang.String[] ExpandedRatingsList, java.lang.String Year, java.lang.String ParentalRating, java.lang.String[] MiscList, java.lang.String ExternalID, java.lang.String Language, long OriginalAirDate) */ println ( "MF ExternalID = " + MediaFileAPI.GetMediaFileMetadata(mf,'ExternalID') ) ; println ("IsTVFile? = " + MediaFileAPI.IsTVFile(mf) ) ; println ( "Archived? = " + MediaFileAPI.IsLibraryFile(mf) ); println ( "Watched? = " + AiringAPI.IsWatched(mf) ); println ( "Don't Like? = " + AiringAPI.IsDontLike(mf) ); println ( "Not M or F? = " + AiringAPI.IsNotManualOrFavorite(mf) ); println ( "MediaType = " + MediaFileAPI.GetMediaFileMetadata(mf, "MediaType") ); println ( "Show External ID = " + ShowAPI.GetShowExternalID(mf) ); println ( "Media File ID = " + MediaFileAPI.GetMediaFileID(mf) ); println ( "AiringID = " + AiringAPI.GetAiringID(mfAiring) ) ; println ( " " ); println ( " " ); println ( "AiringAPI info to use for AddAiring" ); println ( " " ); println ("ChannelName = " + AiringAPI.GetAiringChannelName(mfAiring) ) ; println ( "ChannelNumber = " + AiringAPI.GetAiringChannelNumber(mfAiring) ) ; println ( "AiringDuration = " + AiringAPI.GetAiringDuration(mfAiring) ) ; println ( "AiringEndTime = " + AiringAPI.GetAiringEndTime(mfAiring) ) ; println ( "AiringID = " + AiringAPI.GetAiringID(mfAiring) ) ; println ( "AiringPartNumber = " + AiringAPI.GetAiringPartNumber(mfAiring) ) ; println ( "AiringPremiereFinaleInfo = " + AiringAPI.GetAiringPremiereFinaleInfo(mfAiring) ) ; println ( "AiringStartTime = " + AiringAPI.GetAiringStartTime(mfAiring) ) ; println ( "AiringTitle = " + AiringAPI.GetAiringTitle(mfAiring) ) ; println ( "AiringTotalParts = " + AiringAPI.GetAiringTotalParts(mfAiring) ) ; println ("ExtraAiringDetails = " + AiringAPI.GetExtraAiringDetails(mfAiring) ) ; println ("LatestWatchedTime = " + AiringAPI.GetLatestWatchedTime(mfAiring) ) ; println ("ParentalRating = " + AiringAPI.GetParentalRating(mfAiring) ) ; println ("RealWatchedEndTime = " + AiringAPI.GetRealWatchedEndTime(mfAiring) ) ; println ("RealWatchedStartTime = " + AiringAPI.GetRealWatchedStartTime(mfAiring) ) ; println ("RecordingName = " + AiringAPI.GetRecordingName(mfAiring) ) ; println ("RecordingQuality = " + AiringAPI.GetRecordingQuality(mfAiring) ) ; println ("ScheduleDuration = " + AiringAPI.GetScheduleDuration(mfAiring) ) ; println ("ScheduleEndTime = " + AiringAPI.GetScheduleEndTime(mfAiring) ) ; println ("ScheduleRecordingRecurrence = " + AiringAPI.GetScheduleRecordingRecurrence(mfAiring) ) ; println ("ScheduleStartTime = " + AiringAPI.GetScheduleStartTime(mfAiring) ) ; println ("TrackNumber = " + AiringAPI.GetTrackNumber(mfAiring) ) ; println ("WatchedDuration = " + AiringAPI.GetWatchedDuration(mfAiring) ) ; println ("WatchedEndTime = " + AiringAPI.GetWatchedEndTime(mfAiring) ) ; println ("WatchedStartTime = " + AiringAPI.GetWatchedStartTime(mfAiring) ) ; println ( " " ); println ( "ShowAPI info to use for AddShow" ); println ( " " ); println ("ShowTitle = " + ShowAPI.GetShowTitle(mfShow) ) ; println ("IsShowFirstRun = " + ShowAPI.IsShowFirstRun(mfAiring) ) ; println ("ShowEpisode = " + ShowAPI.GetShowEpisode(mfShow) ) ; println ("ShowDescription = " + ShowAPI.GetShowDescription(mfShow) ) ; println ("ShowDuration = " + ShowAPI.GetShowDuration(mfShow) ) ; println ("ShowCategoriesList = " + ShowAPI.GetShowCategoriesList(mfShow) ) ; println ("PeopleAndCharacterListInShow = " + ShowAPI.GetPeopleAndCharacterListInShow(mfShow) ) ; // NULL println ("ShowRated = " + ShowAPI.GetShowRated(mfShow) ) ; // NULL println ("ShowYear = " + ShowAPI.GetShowYear(mfShow) ) ; // NULL // NULL println ("ShowExternalID = " + ShowAPI.GetShowExternalID(mfShow) ) ; println ("ShowLanguage = " + ShowAPI.GetShowLanguage(mfShow) ) ; println ("OriginalAiringDate = " + ShowAPI.GetOriginalAiringDate(mfShow) ) ; println ("ShowSeasonNumber = " + ShowAPI.GetShowSeasonNumber(mfShow) ) ; println ("ShowEpisodeNumber = " + ShowAPI.GetShowEpisodeNumber(mfShow) ) ; /* SetMediaFileMetadata public void SetMediaFileMetadata(sage.MediaFile MediaFile, java.lang.String Name, java.lang.String Value) Sets the corresponding metadata property in the MediaFile's format. These are set in the database and are also exported to the corresponding .properties file for that MediaFile. When it exports it will append these updates to the .properties file. It will also update the property "custom_metadata_properties" (which is a semicolon/comma delimited list) which tracks the extra metadata properties that should be retained. Usage of any of the following names will update the corresponding Airing/Show object for the MediaFile as well: Title, Description, EpisodeName, Track, Duration, Genre, Language, RunningTime, Rated, ParentalRating, PartNumber, TotalParts, HDTV, CC, Stereo, SAP, Subtitled, 3D, DD5.1, Dolby, Letterbox, Live, New, Widescreen, Surround, Dubbed, Taped, SeasonNumber, EpisodeNumber Premiere, SeasonPremiere, SeriesPremiere, ChannelPremiere, SeasonFinale, SeriesFinale, ExternalID, Album, Year, OriginalAirDate, ExtendedRatings, Misc and All "Role" Names */ //File NewFile = new File("\\\\Tower\\Testing\\AmericasNewsroom-pm5913766-0.mpg"); //Object mf = MediaFileAPI.GetMediaFileForFilePath(NewFile); /* if ( MediaFileAPI.SetMediaFileShow(mf,mfShow) ) { println("Should be linked") ; } else { println("Is not linked"); } */ /* if ( MediaFileAPI.SetMediaFileAiring(mf,mfAiring) ) { println("Should be linkedto Airing") ; } else { println("Is not linked to Airing"); } */ /* import org.apache.commons.io.FilenameUtils def file = new File("C:/temp/test.txt") def dir = file.getParent() def base = FilenameUtils.getBaseName(file.getName()) def ext = FilenameUtils.getExtension(file.getName()) def i = 1 while(file.exists()) file = new File(dir, "$base-${i++}.$ext") println "New file is: $file" */ |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sort on mediafileid | Gustovier | Batch Metadata Tools | 1 | 04-19-2011 05:59 AM |