bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 Just now, chef said: Then resolution is a problem. Was that in the OP request? Limiting access to 4k streams through tagging? Yeah, he wants to tag item 4k, and add the 4k to the block in the user setup thing. Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 (edited) 9 minutes ago, bakes82 said: Yeah I know, doesnt exist on the object returned // Decompiled with JetBrains decompiler // Type: MediaBrowser.Model.Entities.MediaStream // Assembly: MediaBrowser.Model, Version=4.5.0.28, Culture=neutral, PublicKeyToken=null // MVID: D6209AB7-0B07-4E22-B19D-786FB4321F01 // Assembly location: C:\Users\bradl\.nuget\packages\mediabrowser.common\4.5.0.28\lib\netstandard2.0\MediaBrowser.Model.dll using MediaBrowser.Model.Dlna; using MediaBrowser.Model.MediaInfo; using System; namespace MediaBrowser.Model.Entities { public class MediaStream { private static ReadOnlyMemory<char>[] GraphicSubCodecNames = new ReadOnlyMemory<char>[3] { "DVB_TELETEXT".AsMemory(), "sub".AsMemory(), "dvb_subtitle".AsMemory() }; private static ReadOnlyMemory<char>[] GraphicSubCodecPartialNames = new ReadOnlyMemory<char>[3] { "pgs".AsMemory(), "dvd".AsMemory(), "dvbsub".AsMemory() }; private static ReadOnlyMemory<char> AssCodecName = "ass".AsMemory(); private static ReadOnlyMemory<char> SsaCodecName = "ssa".AsMemory(); public string Codec { get; set; } public string CodecTag { get; set; } public string Language { get; set; } public string ColorTransfer { get; set; } public string ColorPrimaries { get; set; } public string ColorSpace { get; set; } public string Comment { get; set; } public long? StreamStartTimeTicks { get; set; } public string TimeBase { get; set; } public string CodecTimeBase { get; set; } public string Title { get; set; } public string Extradata { get; set; } public string VideoRange { get { if (this.Type != MediaStreamType.Video) return (string) null; string colorTransfer = this.ColorTransfer; return !string.IsNullOrEmpty(colorTransfer) && (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase) || string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase)) ? "HDR" : "SDR"; } } public string DisplayTitle { get; set; } public string DisplayLanguage { get; set; } public string NalLengthSize { get; set; } public bool IsInterlaced { get; set; } public bool? IsAVC { get; set; } public string ChannelLayout { get; set; } public int? BitRate { get; set; } public int? BitDepth { get; set; } public int? RefFrames { get; set; } [Obsolete("Currently this property doesn't have any write usage.'")] public int? PacketLength { get; set; } public int? Channels { get; set; } public int? SampleRate { get; set; } public bool IsDefault { get; set; } public bool IsForced { get; set; } public int? Height { get; set; } public int? Width { get; set; } public float? AverageFrameRate { get; set; } public float? RealFrameRate { get; set; } public string Profile { get; set; } public MediaStreamType Type { get; set; } public string AspectRatio { get; set; } public int Index { get; set; } public int? Score { get; set; } public bool IsExternal { get; set; } public SubtitleDeliveryMethod? DeliveryMethod { get; set; } public string DeliveryUrl { get; set; } public bool? IsExternalUrl { get; set; } public bool IsTextSubtitleStream { get { if (this.Type != MediaStreamType.Subtitle) return false; string codec = this.Codec; return (!string.IsNullOrEmpty(codec) || this.IsExternal) && MediaStream.IsTextFormat(codec.AsSpan()); } } public static bool IsTextFormat(ReadOnlySpan<char> codec) { if (codec.IsEmpty) return true; foreach (ReadOnlyMemory<char> graphicSubCodecName in MediaStream.GraphicSubCodecNames) { if (MemoryExtensions.Equals(graphicSubCodecName.Span, codec, StringComparison.OrdinalIgnoreCase)) return false; } foreach (ReadOnlyMemory<char> codecPartialName in MediaStream.GraphicSubCodecPartialNames) { if (codec.Contains(codecPartialName.Span, StringComparison.OrdinalIgnoreCase)) return false; } return true; } public bool SupportsSubtitleConversionTo(ReadOnlySpan<char> toCodec) { if (!this.IsTextSubtitleStream) return false; ReadOnlySpan<char> span1 = MediaStream.AssCodecName.Span; ReadOnlySpan<char> span2 = MediaStream.SsaCodecName.Span; if (MemoryExtensions.Equals(span1, toCodec, StringComparison.OrdinalIgnoreCase) || MemoryExtensions.Equals(span2, toCodec, StringComparison.OrdinalIgnoreCase)) return false; ReadOnlySpan<char> other = this.Codec.AsSpan(); return !MemoryExtensions.Equals(span1, other, StringComparison.OrdinalIgnoreCase) && !MemoryExtensions.Equals(span2, other, StringComparison.OrdinalIgnoreCase); } public bool SupportsExternalStream { get; set; } public string Path { get; set; } public MediaProtocol Protocol { get; set; } public string PixelFormat { get; set; } public double? Level { get; set; } public bool? IsAnamorphic { get; set; } public override string ToString() => string.Format("{0}: {1} {2}", (object) this.Type, (object) this.Codec, (object) this.DisplayTitle); } } Oh...that's the wrong class. The id values we need live on BaseItem. I mentioned checking the (ungrouped) Item's MediaStreams by using GetMediaStreams() instead of GetMediaInfo(). There won't be any ambiguity about what MediaStream belongs to what Item that way. Edited January 22, 2021 by roaku 1 Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 (edited) 1 minute ago, roaku said: Oh...that's the wrong class. The id values we need live on BaseItem. A stream doesnt have a Base Item. A base item has multi streams. Err I mean a source. Edited January 22, 2021 by bakes82 Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 (edited) 2 minutes ago, bakes82 said: A stream doesnt have a Base Item. A base item has multi streams. Err I mean a source. Right, but I mentioned checking the (ungrouped) Item's MediaStreams by using GetMediaStreams() instead of GetMediaInfo(). There won't be any ambiguity about what MediaStream belongs to what Item that way. If any of the MediaStreams in GetMediaStreams() matches the rule, that item matches. If a user has chosen to put multiple videos in one container...that's their problem. Edited January 22, 2021 by roaku Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 Just now, roaku said: Right, but I mentioned checking the (ungrouped) Item's MediaStreams by using GetMediaStreams() instead of GetMediaInfo(). There won't be any ambiguity about what MediaStream belongs to what Item that way. I need to see his code, there REST API and the C# plugin API dont align. You saying call Items via REST doesnt correspond to what the C# api has, or how do get it It might have to be called differently, its been a hassle honestly, cus the devs say look at REST I look and Im like okay now where is that in the SDK, its not, its semi implemented in some obscure diff named method. Link to comment Share on other sites More sharing options...
chef 3746 Posted January 22, 2021 Share Posted January 22, 2021 5 minutes ago, bakes82 said: I need to see his code, there REST API and the C# plugin API dont align. You saying call Items via REST doesnt correspond to what the C# api has, or how do get it It might have to be called differently, its been a hassle honestly, cus the devs say look at REST I look and Im like okay now where is that in the SDK, its not, its semi implemented in some obscure diff named method. I can attest to this. No alignment. 1 Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 Just now, chef said: I can attest to this. No alignment. How are you retrieving your initial list of items? REST API in c# Or native library manager something or other in C#? Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 1 minute ago, roaku said: How are you retrieving your initial list of items? REST API in c# Or native library manager something or other in C#? Emby has their own plugin SDK. Since its a DLL its using whatever magic they use to code emby with, not the API layer per say. https://www.nuget.org/packages/MediaBrowser.Server.Core/4.6.0.14-beta Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 5 minutes ago, chef said: I can attest to this. No alignment. Did you post the code on github yet? Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 (edited) 3 minutes ago, bakes82 said: Emby has their own plugin SDK. Since its a DLL its using whatever magic they use to code emby with, not the API layer per say. https://www.nuget.org/packages/MediaBrowser.Server.Core/4.6.0.14-beta I'm aware. The reason I'm asking is that calling 'new InternalItemsQuery()` without a 'user' argument will return the full list of items. That full list of Items should have the id properties we need on each one as well as the GetMediaStreams() method we need. I modified the Reports plugin a while back to return the full list of items the way I've been describing, that's why I expect this to work. Here's the relevant unmodified Reports code: https://github.com/MediaBrowser/EmbyReports/blob/master/EmbyReports/Api/ReportsService.cs#L182 Edited January 22, 2021 by roaku Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 1 minute ago, roaku said: I'm aware. The reason I'm asking is that calling new InternalItemsQuery() without a 'user' argument will return the full list of items. That full list should have the id properties we need. https://github.com/MediaBrowser/EmbyReports/blob/master/EmbyReports/Api/ReportsService.cs#L182 We need to see his code, I cant tell you if hes using the library manager or session manage or what hes doing Once I can see it I can pull it and see whats happening and see if there is a diff method. I know my kill script code is dealing with sessions so that returns only active sessions and those stream details. Let me check my trakt code as I loop over items there. Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 @chef Does this work? var mediaItems = libraryManager.GetItemList( new InternalItemsQuery { IncludeItemTypes = new[] {nameof(Movie)}, IsVirtualItem = false, OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.SeriesSortName, SortOrder.Ascending), new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) } }) .ToList(); mediaItems.First().GetMediaSources().First().Id Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 (edited) 1 minute ago, bakes82 said: We need to see his code, I cant tell you if hes using the library manager or session manage or what hes doing Once I can see it I can pull it and see whats happening and see if there is a diff method. I know my kill script code is dealing with sessions so that returns only active sessions and those stream details. Let me check my trakt code as I loop over items there. I know, but I've now provided him two routes to doing what he needs. There's only one more that I know of and that one should have the most power out of all of them. Edited January 22, 2021 by roaku Link to comment Share on other sites More sharing options...
chef 3746 Posted January 22, 2021 Share Posted January 22, 2021 7 minutes ago, bakes82 said: Did you post the code on github yet? here it the repo: https://github.com/chefbennyj1/Emby.AutoTag Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 2 minutes ago, bakes82 said: @chef Does this work? var mediaItems = libraryManager.GetItemList( new InternalItemsQuery { IncludeItemTypes = new[] {nameof(Movie)}, IsVirtualItem = false, OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.SeriesSortName, SortOrder.Ascending), new ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending) } }) .ToList(); mediaItems.First().GetMediaSources().First().Id My understanding... He doesn't need to get the Id of a MediaSource. He needs to do a rule check against the MedisSources of a given BaseItem, then modify the Tags of that BaseItem when there is a rule match. The Id of the BaseItem isn't relevant until he needs to modify its tags. Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 1 minute ago, roaku said: My understanding... He doesn't need to get the Id of a MediaSource. He needs to do a rule check against the MedisSources of a given BaseItem, then modify the Tags of that BaseItem when there is a rule match. The Id of the BaseItem isn't relevant until he needs to modify its tags. Then you prob cant do what the user is requesting From what i can tell there is 1 base item, it has 5 sources Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 Just now, bakes82 said: Then you prob cant do what the user is requesting From what i can tell there is 1 base item, it has 5 sources There should be a Video MediaStream, one or more Audio MediaStreams, possibly Subtitle MediaStreams. Depending on the rule being applied, any one of those MediaStreams might be relevant and can be filtered as needed. The key is that they all belong to that BaseItem. Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 Just now, roaku said: There should be a Video MediaStream, one or more Audio MediaStreams, possibly Subtitle MediaStreams. Depending on the rule being applied, any one of those MediaStreams might be relevant and can be filtered as needed. The key is that they all belong to that BaseItem. You dont seem to be following lol. There are no STREAMS. Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 The goal is to add a TAG of 4k to an item, then block all those from appearing in the UI. if you are dealing with streams, you are now in my 4k kill script code. Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 2 minutes ago, bakes82 said: You dont seem to be following lol. There are no STREAMS. Then you're most likely not doing what I'm describing unless the devs removed the functionality in the last 6 months. Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 If you tag the base item with 4k, and it has 1080p option also, the movie wont appear because its been tagged 4k also and the 4k tag is blocked, thus the whole base item movie is blocked even if it has sources of 720 or 1080. Tags are being applied at a base item not a media source. This prevents having duplicate IDs in db with the exact same info. Its a 1 to many relationship, but the 1 has the tag holder. Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 Just now, roaku said: Then you're most likely not doing what I'm describing unless the devs removed the functionality in the last 6 months. Well if you provide the code Ill take a look Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 2 minutes ago, bakes82 said: The goal is to add a TAG of 4k to an item, then block all those from appearing in the UI. if you are dealing with streams, you are now in my 4k kill script code. Except your code doesn't see multi-version items as full fledged, independent items. Link to comment Share on other sites More sharing options...
roaku 795 Posted January 22, 2021 Share Posted January 22, 2021 Just now, bakes82 said: Well if you provide the code Ill take a look Ya, I'm going to have to boot up my machine... Link to comment Share on other sites More sharing options...
bakes82 90 Posted January 22, 2021 Share Posted January 22, 2021 Just now, roaku said: Except your code doesn't see multi-version items as full fledged, independent items. They shouldn't be. Once you merge them the other ref should be deleted, and its now just pointing to 1 base item. This is what I would be expecting in a 1 to many DB relation ship. 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