|
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
|
||||
|
||||
What's in a Playlist?
I'm a bit stumped trying to figure out what type of Sage objects are stored in playlists. I have the following test code snippit that scans a playlist for a particular MediaFile by matching MediaFileIDs. (I'm using Sean's sagex-api.)
When I run the code I see that "item" is an Airing, but then "MF" comes back as null. The playlist actually contains music so I expected that "item" would be a MediaFile Object. If I try GetMediaFileID(item) it comes back as 0. I'm probably overlooking something obvious. Code:
Object[] items = PlaylistAPI.GetPlaylistItems(playlist); for (Object item : items) { int ID = 0; if (MediaFileAPI.IsMediaFileObject(item)) { System.out.println("MEDIAFILE"); ID = MediaFileAPI.GetMediaFileID(item); } else if (AiringAPI.IsAiringObject(item)) { System.out.println("AIRING"); Object MF = AiringAPI.GetMediaFileForAiring(item); if (MF == null) { System.out.println("NULL MF"); } ID = MediaFileAPI.GetMediaFileID(MF); } else if (ShowAPI.IsShowObject(item)) { System.out.println("SHOW"); } else { System.out.println("UNKNOWN"); } System.out.println("IDs=" + ID + " : " + mediaFileID); if (ID == mediaFileID) return true; }
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#2
|
||||
|
||||
I'm guessing it's some kind of pseudo-Airing object used for wrapping playlist items in a uniform way. Playing around with it in Expression Evaluator (always a good way to try stuff out before committing it to code), I find that it does respond sensibly to many AiringAPI methods such as IsAiringObject, GetAiringID, GetAiringTitle, and so on, but not apparently to GetMediaFileForAiring. MediaFileAPI and AlbumAPI methods do not appear to work.
By the way, according to the API docs for AddToPlaylist, Show objects are not valid playlist items. Only Airings, Albums, MediaFiles, and Playlists are allowed.
__________________
-- Greg |
#3
|
||||
|
||||
The problem might be in sagex-api, as using GKusnick Studio Tool, the following works:
Code:
if (pl.GetPlaylistItemTypeAt(i).equalsIgnoreCase("Airing")) { airing = sageApiAiring.Wrap(pl.GetPlaylistItemAt(i)); mf = airing.GetMediaFileForAiring(); } else if (pl.GetPlaylistItemTypeAt(i).equalsIgnoreCase("Album")) { album = sageApiAlbum.Wrap(pl.GetPlaylistItemAt(i)); mf = album.GetAlbumTracks().get(0).GetMediaFileForAiring(); }
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2 TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad |
#4
|
||||
|
||||
Quote:
Maybe there's a better way to do what I need. I was trying to write a simple method that returns a boolean indicating if a MediaFile is part of any playlist. (Because I want to use it in FilterByBoolMethod()) Is there an easier way to do this? I didn't see anything in (Core) PlaylistAPI or MediaFileAPI that provides this function....
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#5
|
|||
|
|||
I can verify that this works using the sagex-api. The code I just ran is below. Every Airing Object successfully got a MediaFile Object and subsequently an ID.
I am running using the remote API provider and against the latest sagex release. How is your environment setup? And is the code that you posted exactly what is being run? Code:
import sagex.api.AiringAPI; import sagex.api.MediaFileAPI; import sagex.api.PlaylistAPI; import sagex.api.ShowAPI; public class PlaylistTest { public static void main(String[] args) { Object[] playlists = PlaylistAPI.GetPlaylists(); for(Object p : playlists) { Object[] items = PlaylistAPI.GetPlaylistItems(p); for (Object item : items) { int ID = 0; if (MediaFileAPI.IsMediaFileObject(item)) { System.out.println("MEDIAFILE"); ID = MediaFileAPI.GetMediaFileID(item); } else if (AiringAPI.IsAiringObject(item)) { System.out.println("AIRING"); Object MF = AiringAPI.GetMediaFileForAiring(item); if (MF == null) { System.out.println("NULL MF"); } ID = MediaFileAPI.GetMediaFileID(MF); System.out.println("ID = " + ID); } else if (ShowAPI.IsShowObject(item)) { System.out.println("SHOW"); } else { System.out.println("UNKNOWN"); } } } } } |
#6
|
||||
|
||||
Quote:
What's in your playlists? Mine are all music.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#7
|
||||
|
||||
Just tried it again to make sure, MF is always null. The java code is attached, I'm building it as a JAR.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#8
|
||||
|
||||
Quote:
Tom, I suspect that your issue in the algorithm... is you study fonceur's logic, he's doing something different that you. He's testing the GetPlaylistItemTypeAt against a string, and then getting the Album, and then getting the file. I suspect if you rewrote your existing logic to match his, it would probably work.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#9
|
||||
|
||||
Quote:
There really isn't much to getting things working remotely, so if you ever want to try it, just let me know, and I'll walk your through it. Once you have it setup, you'll ask yourself how you ever developed for sage without it
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#10
|
|||
|
|||
Quote:
Thanks again for this stuckless life saver!! |
#11
|
||||
|
||||
Quote:
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#12
|
||||
|
||||
Quote:
GetAiringID() returns a valid ID for the playlist items, but it doesn't match the results from GetMediaFileID() for the song I pass into the method.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#13
|
||||
|
||||
Quote:
Quote:
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#14
|
|||
|
|||
Not really sure what your trying to do but albums are a wee bit funny (well to me they are )..... Anyway if your after the mediaid from an airing album you could try:
Code:
Album = GetElement(GetAlbumTracks(GetAlbumForFile(Airing)), i) MediaID = GetMediaFileID(Album)
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#15
|
||||
|
||||
The problem is that GetAlbumForFile(Airing) returns null. As Greg pointed out above, it seems when you get an "Airing" from a Playlist, it's not the same as a normal Airing.
I decided to go in a slightly different direction so I actually do not need to get the MediaFileID. Now I'm simply trying to get the Album Art associated with a Playlist Item which is also turning out to be strange because of the peculiar way Sage treats Playlist Items. I'm looking for a place in the STV where the album art is obtained for a playlist item. So far I haven't found it. What the default STV normally does is start playing the playlist and then it gets the loaded media file and derives the various pieces of information from that.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#16
|
||||
|
||||
Quote:
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#17
|
|||
|
|||
Ok, I'll try again
Code:
PlayList = GetElement(GetPlaylists(), 0) PlayListItem = GetElement(GetPlaylistItems(PlayList), 0) PlayListAlbum = GetAlbumForFile(PlayListItem) GetAlbumArt(PlayListAlbum)
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#18
|
||||
|
||||
Not only to you... Since they have no ID or cover art, you basically have to tag them with one of their songs...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2 TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad |
#19
|
||||
|
||||
GetAlbumForFile() returns a null. (I've got a logfile full of traces to prove it. )
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#20
|
||||
|
||||
I don't understand what you mean, can you explain please?
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Print PlayList | wjohn | SageTV Software | 2 | 04-04-2009 11:37 PM |
Playlist Problems | Madeen | SageTV Software | 3 | 01-29-2008 05:53 PM |
Movie Playlist | lordmeatball | SageTV Customizations | 7 | 12-02-2006 03:34 AM |
Playlist doesn't play | Redrum | SageTV Software | 3 | 02-20-2006 03:57 AM |