Jump to content

Anyone know how to exclude adult(Xrated) media from a query


Cheesegeezer

Recommended Posts

Cheesegeezer

Using c# and getting libraryItems via InternalItemQuery.

is there a string to filter on ExcludeItemTypes or is there another property i need to use.

or should the user be setting this content to x rated or something? 
 

thanks in advance

Edited by Cheesegeezer
Link to comment
Share on other sites

Happy2Play

Don't think there is beside MaxOfficialRating assuming the items have a rating.

As they are 

      "Type": "Movie",
,
      "MediaType": "Video"
  • Thanks 1
Link to comment
Share on other sites

Cheesegeezer
21 hours ago, Happy2Play said:

Don't think there is beside MaxOfficialRating assuming the items have a rating.

As they are 

      "Type": "Movie",
,
      "MediaType": "Video"

Sorry Happy missed this one.

Yup i ended up setting the UserMaxRating if null to RatingValue of 9 as any XRated items have a score of 10 and it seems to be working. but it's up to the end user to ensure this content has the max Parental rating set.  Seems to work nicely

// Set User Max Rating to 9 if no limit has been set (this will eliminate any Xrated content which is at the max setting of 10)
            var userMaxRating = user.Policy.MaxParentalRating != null ? user.Policy.MaxParentalRating.Value : 9;
            Log.Info("User.Name retrieved: {0}", user.Name);
            Log.Info("User.ParentalRating: {0}", userMaxRating.ToString());
            
            List<BaseItem> wItems = new List<BaseItem>();
            
            QueryResult<BaseItem> libraryResult = LibraryManager.GetItemsResult(new InternalItemsQuery(user)
            {
                Recursive = true,
                MaxParentalRating = userMaxRating,
                MediaTypes = new[] {"Video"},
                ExcludeTags = new []{"top-pick"},
                IncludeItemTypes = new[] {nameof(Movie), nameof(Episode) },
                ExcludeItemTypes = new[] {nameof(Trailer), nameof(BoxSet) },

                DtoOptions = new DtoOptions(true),
            });

 

Edited by Cheesegeezer
Link to comment
Share on other sites

Official answer - have the user configure the libraries that whatever this feature is will apply to. Then they can exclude adult content or anything else they wish.

  • Thanks 1
Link to comment
Share on other sites

Cheesegeezer
1 minute ago, Luke said:

Official answer - have the user configure the libraries that whatever this feature is will apply to. Then they can exclude adult content or anything else they wish.

It's a channel and i'm trying to avoid any config for this.  I don't think it's necessary.  But i think if the User sets their Allowed Parental Rating to the Max Value this will let them view what they want and restrict the other users.

image.png.ee7c7ed35c943638439e78f2def23805.png

 

Link to comment
Share on other sites

Cheesegeezer

@Luke @softworkz

I'm not sure if this is a bug in channels, however i've set up a kidsTest user which has the following settings applied to the profile

image.png.266a9fc9d6a32089154438a5e9278509.png

 

It filters any content in the other users channels except the unrated or unrecognised

for example

When i view the channel (Profile set to GB-R18 (value=10) and don't have any options ticked for block unrated content,  i can see this in my user channel, i've set some of these manually to unrated, value 8,9 & 10's so everything shows correctly

image.thumb.png.a9455420d0a54efb0598354ad0b93bc1.png

But in when i switch to the kidsTest User profile it still shows the unrated items in my channel and i can play them - scary stuff

image.thumb.png.1205f9f9248b2cd6f1fdc9bb5e71ab73.png

Running Beta 4.8.21 on Win 10

Logs don't show anything.

However normal library content it work for the kids profile.  Just wondering if there is something not wired up for the channels.

image.thumb.png.e4b764a0f9e85cda22d343868b5dd2cc.png

 

Link to comment
Share on other sites

Cheesegeezer
4 hours ago, Luke said:

Do the channel items have parental ratings set?

Yes, well some of them do, except house episodes and emby dev episode. they are baseItems from Emby.

 

You can see here from the log...

2023-01-26 06:57:05.434 Info Watch History: User ChannelName: Watch History for KidsTest
2023-01-26 06:57:05.434 Info Watch History: We are a match for chItem.Id=24 against chQuery.FolderId = 24
2023-01-26 06:57:05.434 Info Watch History: User.Name retrieved: KidsTest
2023-01-26 06:57:05.434 Info Watch History: User.ParentalRating: 5
2023-01-26 06:57:05.439 Debug Watch History: Total LibItems Found: 69
2023-01-26 06:57:05.439 Debug Watch History: Total Watched Items Found: 1 --- Max Limit Set By User = 100
2023-01-26 06:57:05.439 Debug Watch History: Reordered Item added = Despicable Me 2 ParentalRating: 1
2023-01-26 06:57:05.439 Info Watch History: User ChannelName: Watch History for DaveyB
2023-01-26 06:57:05.439 Info Watch History: We are a match for chItem.Id=1 against chQuery.FolderId = 1
2023-01-26 06:57:05.439 Info Watch History: User.Name retrieved: DaveyB
2023-01-26 06:57:05.439 Info Watch History: User.ParentalRating: 9
2023-01-26 06:57:05.449 Debug Watch History: Total LibItems Found: 119
2023-01-26 06:57:05.449 Debug Watch History: Total Watched Items Found: 11 --- Max Limit Set By User = 100
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Spider-Man: No Way Home ParentalRating: 7
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Emby SDK ParentalRating: 
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = The Matrix Resurrections (2021) ParentalRating: 9
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Top Gun: Maverick ParentalRating: 7
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Damned If You Do ParentalRating: 
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = The Socratic Method ParentalRating: 
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Occam's Razor ParentalRating: 
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Paternity ParentalRating: 
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Ready Player One ParentalRating: 6
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Maternity ParentalRating: 8
2023-01-26 06:57:05.449 Debug Watch History: Reordered Item added = Pilot ParentalRating: 

 

Edited by Cheesegeezer
Link to comment
Share on other sites

  • 4 weeks later...
Quote

But in when i switch to the kidsTest User profile it still shows the unrated items in my channel and i can play them

Does the emby metadata editor show the correct parental rating for those items?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...