chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 Oh! I just found it in the code. Holly mackerel! It is the "GetChannelItemMediaInfo" method, and I believe this is the method that is about to fix all the issues in both channel plugins with regards to media versioning. Link to comment Share on other sites More sharing options...
ebr 14930 Posted September 21, 2022 Share Posted September 21, 2022 @chef a mediasource is a version of an item. Each mediasource will have multiple mediastreams (video, audio, subtitle, etc.) 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 10 minutes ago, ebr said: @chef a mediasource is a version of an item. Each mediasource will have multiple mediastreams (video, audio, subtitle, etc.) excellent thank you. The channel item wants MediaSources. should I just pass along: MediaSources = myBaseItem.GetMediaSources(enableAlternateMediaSources: true, enablePathSubstitution: true, LibraryManager.GetLibraryOptions(myBaseItem) Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 Oh finally! I understand! I got Media Sources working! Well... almost... I think I can fix that duplication issue. I can't believe it. What a freaking relief. 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 (edited) This unfinished version finally fixes the "undefined" version issue. It will also, make sure that all the different media sources (versions) of the media item in the library are listed. The only issue right now, is that one of the versions is listed twice. I will fix this next. Edited September 21, 2022 by chef 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 Oh bother! ATV doesn't show the media source selection at all. So the web app show too many and ATV shows none. man oh man. Link to comment Share on other sites More sharing options...
Happy2Play 8296 Posted September 21, 2022 Share Posted September 21, 2022 2 minutes ago, chef said: Oh bother! ATV doesn't show the media source selection at all. So the web app show too many and ATV shows none. man oh man. Not seeing any in my test in web client. But will test more as channel linked to test file instead of media and has no selector. 1 Link to comment Share on other sites More sharing options...
Happy2Play 8296 Posted September 21, 2022 Share Posted September 21, 2022 Same note here as Emby.Kids If users do not write nfo files with media this can be problematic if any metadata is changed in library or channel as they are technically two individual database entries. If users write nfo files both items would use the same nfo file and updating one should update the other on item refresh. 1 Link to comment Share on other sites More sharing options...
Happy2Play 8296 Posted September 21, 2022 Share Posted September 21, 2022 Not seeing any media info Video/Audio on channel vs library in newest version. Channel Library See the difference in genres also, but this is a test library database only metadata. 2 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 37 minutes ago, Happy2Play said: Not seeing any media info Video/Audio on channel vs library in newest version. Channel Library See the difference in genres also, but this is a test library database only metadata. Have you run a library scan after internet channel refresh by chance? Link to comment Share on other sites More sharing options...
Happy2Play 8296 Posted September 21, 2022 Share Posted September 21, 2022 1 minute ago, chef said: Have you run a library scan after internet channel refresh by chance? Both and removed plugin both scans and reinstalled. Link to comment Share on other sites More sharing options...
Junglejim 352 Posted September 21, 2022 Share Posted September 21, 2022 (edited) 9 hours ago, Happy2Play said: Not seeing any media info Video/Audio on channel vs library in newest version. Yep same here Channel (Notice blu-ray cover is missing and video/audio/subs info) Library EDIT: Also there are a few differences in the "New Releases" meta, like rating/genre/plot/background but I scraped this movie a while ago so if I refreshed the lib movie they would prob match up. EDIT: I was wrong about the refresh of the lib movie matching the "New Releases" meta. On further investigation it looks like "New Releases" is getting it's meta from TVDB (genre/plot at least) where as the lib movie is using TMDB. So that's why some meta is different, that's all good. EDIT: When I try to play a movie from "New Releases" I get.. "Playback Error No compatible streams are currently available." I have a intro that plays fine before the "New Releases" movie so I thought it was all good, maybe something to do with the video/audio meta missing? It plays fine from the movie lib. I'm sure it was working before the latest update, I got past the intro and into the movie. Edited September 21, 2022 by Junglejim 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 5 hours ago, Junglejim said: Yep same here Channel (Notice blu-ray cover is missing and video/audio/subs info) Library EDIT: Also there are a few differences in the "New Releases" meta, like rating/genre/plot/background but I scraped this movie a while ago so if I refreshed the lib movie they would prob match up. EDIT: I was wrong about the refresh of the lib movie matching the "New Releases" meta. On further investigation it looks like "New Releases" is getting it's meta from TVDB (genre/plot at least) where as the lib movie is using TMDB. So that's why some meta is different, that's all good. EDIT: When I try to play a movie from "New Releases" I get.. "Playback Error No compatible streams are currently available." I have a intro that plays fine before the "New Releases" movie so I thought it was all good, maybe something to do with the video/audio meta missing? It plays fine from the movie lib. I'm sure it was working before the latest update, I got past the intro and into the movie. Interesting, it is using tvdb? I see the compatible streams error too. One minutes, I think I have a fix here. Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 (edited) I've added some logging when the channel is sending back media sources to a client UI. When the item gets created in the channel, we map all the values from the library item over. This also includes mapping the entire media source from original item. It's a mystery why the item would be using tvdb data. new ChannelItemInfo() { DateCreated = item.DateCreated, Name = item.Name, Id = $"new_release_{item.InternalId}".GetMD5().ToString("N"), //Give it a new Id. RunTimeTicks = item.RunTimeTicks, ProductionYear = item.ProductionYear, ImageUrl = item.PrimaryImagePath, Type = ChannelItemType.Media, ContentType = ChannelMediaContentType.Movie, MediaType = ChannelMediaType.Video, IsLiveStream = false, OfficialRating = item.OfficialRating, Overview = item.Overview, PremiereDate = item.PremiereDate, Genres = item.Genres.ToList(), CommunityRating = item.CommunityRating, OriginalTitle = item.OriginalTitle, ProviderIds = item.ProviderIds, Studios = item.Studios.ToList(), People = LibraryManager.GetItemPeople(item), MediaSources = item.GetMediaSources(false, false, LibraryManager.GetLibraryOptions(item)) }); Stranger still, the channel Item will show all the media sources (versions) in the webapp, but ATV will only show one. The other thing that would be nice to solve is why in the normal library the Versions are named by parsing the brackets, but the channel doesn't do that. example: Library: Channel: Maybe the log it will tell us why. Fixes no compatible streams problem. I took an "all-nighter" trying different things to learn how channels really work, but I ended up with more question I think LOL! Emby.NewReleases.zip Edited September 21, 2022 by chef 2 Link to comment Share on other sites More sharing options...
ebr 14930 Posted September 21, 2022 Share Posted September 21, 2022 13 hours ago, chef said: ATV doesn't show the media source selection at all. Check settings. You probably have them turned off. 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 16 minutes ago, ebr said: Check settings. You probably have them turned off. Are these server side settings I might need to change? Link to comment Share on other sites More sharing options...
ebr 14930 Posted September 21, 2022 Share Posted September 21, 2022 7 minutes ago, chef said: Are these server side settings I might need to change? No, in the app. 1 Link to comment Share on other sites More sharing options...
Happy2Play 8296 Posted September 21, 2022 Share Posted September 21, 2022 As you already mentioned about duplication. Channel Library Link to comment Share on other sites More sharing options...
chef 3746 Posted September 21, 2022 Share Posted September 21, 2022 34 minutes ago, Happy2Play said: As you already mentioned about duplication. Channel Library Maybe there is some kind of default, which is the first media source available. Then by adding the media source to the channel item we are somehow duplicating it? Perhaps instead of returning a value, when one media source is present, just exiting the method is what is supposed happen. Do you see the media source options being available in ATV (if you have ATV)? I've tried Eric's suggestions, and looked though the different options/settings but I don't see multi versions available. There is something else there that we're missing. It's only a matter of time before this works, just have to learn a bit more about it. Link to comment Share on other sites More sharing options...
Happy2Play 8296 Posted September 21, 2022 Share Posted September 21, 2022 8 minutes ago, chef said: Do you see the media source options being available in ATV (if you have ATV)? Sorry I don't use any Android devices. 1 Link to comment Share on other sites More sharing options...
Junglejim 352 Posted September 22, 2022 Share Posted September 22, 2022 (edited) 13 hours ago, chef said: I've added some logging when the channel is sending back media sources to a client UI. When the item gets created in the channel, we map all the values from the library item over. This also includes mapping the entire media source from original item. It's a mystery why the item would be using tvdb data. new ChannelItemInfo() { DateCreated = item.DateCreated, Name = item.Name, Id = $"new_release_{item.InternalId}".GetMD5().ToString("N"), //Give it a new Id. RunTimeTicks = item.RunTimeTicks, ProductionYear = item.ProductionYear, ImageUrl = item.PrimaryImagePath, Type = ChannelItemType.Media, ContentType = ChannelMediaContentType.Movie, MediaType = ChannelMediaType.Video, IsLiveStream = false, OfficialRating = item.OfficialRating, Overview = item.Overview, PremiereDate = item.PremiereDate, Genres = item.Genres.ToList(), CommunityRating = item.CommunityRating, OriginalTitle = item.OriginalTitle, ProviderIds = item.ProviderIds, Studios = item.Studios.ToList(), People = LibraryManager.GetItemPeople(item), MediaSources = item.GetMediaSources(false, false, LibraryManager.GetLibraryOptions(item)) }); Stranger still, the channel Item will show all the media sources (versions) in the webapp, but ATV will only show one. The other thing that would be nice to solve is why in the normal library the Versions are named by parsing the brackets, but the channel doesn't do that. example: Library: Channel: Maybe the log it will tell us why. Fixes no compatible streams problem. I took an "all-nighter" trying different things to learn how channels really work, but I ended up with more question I think LOL! Emby.NewReleases.zip 9.46 kB · 4 downloads Cheers mate, it's working great now. I have the versions menu still as mentioned above even though I don't have any double versions of anything in my library. As for tvdb I don't have them enabled for my movie lib so not sure what's going on there. It's the only site that has that plot and genre info though for the movie in question (Prey). I have ATV but as I said above I don't have different versions of anything so I don't see the versions drop down menu usually. I can see the double version on my Samsung tablet that I'm using now but that's the mobile app. I'll double check my ATV later and get back to you. EDIT: Just checked my ATV and I don't see any double version menu in "New Releases". As mentioned I've never seen the version menu in ATV but I also can't see any setting for it either. Edited September 22, 2022 by Junglejim 1 Link to comment Share on other sites More sharing options...
Junglejim 352 Posted September 22, 2022 Share Posted September 22, 2022 (edited) Just noticed this in "New Releases", I scrolled down to the media info in the web app.. Two sets of identical media info, obviously the library version only has one. The only other channel that I have that I can compare this with is "Trailers" which is totally different not being local media like this, it doesn't have any media info like you have added it just scrapes the artwork and general movie info. I suppose "Trailers" could be local but who would do that.. I'm not sure if you based this off any other plugin but maybe there could be a double dip of code doing the same thing? I wouldn't stress about it too much, it could be a bug out of your control. It works and that's what counts. I'm sure you'll figure it out. Edited September 22, 2022 by Junglejim 1 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 22, 2022 Share Posted September 22, 2022 Here is something interesting. I think that each MediaSource has an ID which is the path to the file encoded using MD5. This seems to be a popular way (behind the scenes) of creating unique IDs in emby. If we are passing the same source into the channel, as one that is already in the library, and they both have the same ID, then is it possible that embys library query is returning both of those sources by IDs? Maybe, we need to alter the media source ID to something unique so emby doesn't see both db entries. Link to comment Share on other sites More sharing options...
chef 3746 Posted September 22, 2022 Share Posted September 22, 2022 (edited) Oh! I have finally done it! The method in the IChannel interface named "GetChannelItemMediaInfo" should be called "GetAdditionalChannelItemMediaInfo" If anyone comes across this in the future of IChannel development, this seems to work: First check to see how many versions are available. If there is more then one version available, skip the first source (the first source seems to be some kind of default that emby already knows about... somehow...), Then send MediaSources index 1 (which is the second item in the zero based index of media sources) to item.MediaSources.Count -1 I dunno... I'm the worst at explaining programming... I just works now... except on ATV. I only see the first media source listed. But that is fine. Emby.NewReleases.zip Edited September 22, 2022 by chef 4 Link to comment Share on other sites More sharing options...
chef 3746 Posted September 22, 2022 Share Posted September 22, 2022 Finally, I think the next thing to do, would be to do the same kind of parsing on the media source name that emby does internally for normal library items. From what I gather, emby must use a regex parser that first looks for square brackets and a string inside them. For each media source if the string inside the square brackets are the same between sources it would take the quality/resolution and use that. For example: 1080p [ theatrical ] 2160p [ theatrical ] Would resolve to: 1080p 2160p Whereas 1080p [ Theatrical ] 1080p [ IMAX ] Would resolve to: Theatrical IMAX Maybe it is not worth going that far, but I could be done. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now