Jump to content

Script - Parental Rating Copier from Show to Episodes


Recommended Posts

ginjaninja
Posted (edited)

Overwrites the parental rating of every episode with the parental rating of the show.

requested by @Oxide

notes

  • Requires Powershell 7+
  • Review config.psd1, add admin credentials, change $testmode to $false when ready to make changes
  • as always test thoroughly on a backed up database.

changes

  • v0.0.0.7 fixed incompatible endpoint in recent Emby versions.
  • v0.0.0.6 amended some of the screen and logfile logging to improve clarity.

download

 

Parental Rating Copier v0.0.0.7.zip

issues suggestions welcome.

Edited by ginjaninja
  • Like 2
  • Thanks 2
GrimReaper
Posted

Does it expose those ratings in the UI and show them in episode detail view? 

ginjaninja
Posted
4 hours ago, GrimReaper said:

Does it expose those ratings in the UI and show them in episode detail view? 

seems to , why is there a known gotcha to look out for with parental ratings?

image.thumb.png.5ddf43cacc88f6903fc2dac6f4299c72.png

  • Thanks 1
GrimReaper
Posted

Nope, none that I know of. Thanks. 

Happy2Play
Posted
5 hours ago, ginjaninja said:

is there a known gotcha to look out for with parental ratings?

Not that I know of either, but by default genre and PR are inherited from Series but do not show on Episode.

Not sure how restrictions would apply if episode had different rating, then Series if this where to happen though.

This is where I discovered what I would have to say a legacy issue with episode genres as it only applied to specific episodes.

 

GrimReaper
Posted (edited)
38 minutes ago, Happy2Play said:

Not sure how restrictions would apply if episode had different rating, then Series if this where to happen though.

But since the script is only copying Series rating to Episodes, that should never occur with its usage, only if rating was manually appended, which is something that anyone can do at any time without using the script anyway? 

Edited by GrimReaper
  • 3 weeks later...
GrimReaper
Posted

Worked like a charm. Thank you. 👍

Posted

This is cool! Thanks for making this! 

  • 1 year later...
Posted

@ginjaninjaany chance you can make this into a plugin like you did for Geust Star Cleaner :)

ginjaninja
Posted
On 28/12/2023 at 15:53, Oxide said:

@ginjaninjaany chance you can make this into a plugin like you did for Geust Star Cleaner :)

accessing the emby web api from within the plugin environment was not trivial last time i looked and i havent found a way yet...the plugin environment's objects and methods sometimes were not equivalent to the simplicity of the web api but thats probably a testament to my lack of ability. I do need to get back into plugin learning but its going to be a few months before i have spare time...perhaps someone else can convert it?

  • Thanks 1
  • 6 months later...
cremonies
Posted

I'm sorry, I don't know what I'm doing but want this so I can use smart playlist to filter episode for my kids.

I have emby running on a Synology nas in a docker container.

Will it still work when running the script from a different computer?

ginjaninja
Posted
3 hours ago, cremonies said:

I'm sorry, I don't know what I'm doing but want this so I can use smart playlist to filter episode for my kids.

I have emby running on a Synology nas in a docker container.

Will it still work when running the script from a different computer?

yes, any device on network which supports powershell and can 'talk to' Emby server.

(there are no other prerequisites ..its just chatting http to the emby web api)

Posted
3 hours ago, cremonies said:

I'm sorry, I don't know what I'm doing but want this so I can use smart playlist to filter episode for my kids.

I have emby running on a Synology nas in a docker container.

Will it still work when running the script from a different computer?

There is no reason it shouldn't.

cremonies
Posted (edited)

edit:

got it to work. thank you so much. I thought I updated power shell to 7 but it did not install.

 

Edited by cremonies
  • 9 months later...
Baenwort
Posted

This should fix my issue with shows that get episode ratings from some meta sources but that I want to have the entire show access at another rating level using parental controls.

It is strange that there must be some use case when someone wants to set a different series rating but not have it carry to all episodes? I haven't thought of it but why else would this be needed?

Posted
8 hours ago, Baenwort said:

It is strange that there must be some use case when someone wants to set a different series rating but not have it carry to all episodes? I haven't thought of it but why else would this be needed?

Imagine there is a series that, in general, is rated PG but they air one episode that has content in it that you consider not really PG.  You can change the rating of that one episode so that your younger children do not see it.

The reverse could also be true - an adult series that airs a Christmas special or something that you wouldn't mind your children seeing.

  • 1 month later...
atreyu4055
Posted (edited)

This script used to work perfectly, but no longer works in Emby recent beta releases, I get 

image.png.a46041cdf0ea657339af9975330637bc.png

When I paste the contents of the $ApiURL variable into Chrome, its Emby that is returning the error message.

 

Edited by atreyu4055
  • 2 weeks later...
ginjaninja
Posted

The 0.0.0.6 script was using a now unintelligible endpoint....was working more by luck than judgement it seems..

have since changed and updated first post with 0.0.0.7

Ran it on my system once**, was surprised to find that nearly every show needed an update (i dont use the script myself)

**no  testing beyond that**.

 

It seems that almost no episodes have a parental rating on my system so they all needed updating....

 

maybe that was always the case...and im worrying unnecessarily but you may want to take a bit of extra care and backup database 1st or use testmode=$true in config.

  • 7 months later...
Baenwort
Posted (edited)

Hello, I'm trying to use the new 0.7 script and I get this error in PowerShell:

 

Invoke-WebRequest : A parameter cannot be found that matches parameter name 
'SkipCertificateCheck'.
At V:\Parental Rating Copier v0.0.0.7\OfficialRatingCopier.ps1:52 char:117
+ ... e "application/json" -SessionVariable 'Session' -SkipCertificateCheck
+                                                     ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindi 
   ngException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.Inv 
   okeWebRequestCommand
 
ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null.
At V:\Parental Rating Copier v0.0.0.7\OfficialRatingCopier.ps1:53 char:37
+ $serieslist = $serieslist.content | ConvertFrom-Json
+                                     ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [ConvertFrom-Json], ParameterBindingVal 
   idationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft 
   .PowerShell.Commands.ConvertFromJsonCommand

I do wish to note that although you named the zip file 0.7 the version number in both the config and the ps1 file in it say 0.6 still. Running Emby-Stable of 4.9.3.0

Edited by Baenwort
ginjaninja
Posted (edited)

the version numbers are not the issue..just me being sloppy...are you using powershell 7+ i know that is critical? 

edit

just tested on 4.9.4.1 Beta and still working...so im thinking your powershell version is the most likely culprit.

Edited by ginjaninja
Baenwort
Posted (edited)

I think I'm using a new enough one.

image.png.deaa87fdadb6f3549266f01510b0326b.png

Error again with that output on the same shell:

image.png.01f21cf7e31756cd02fbe911276b0b8d.png

Edited by Baenwort
ginjaninja
Posted

image.png.46b1d08c0fbc39833a753aa2aa059758.png

 

I think the winget command says what packages are installed but not what you are using. My blue powersheell is the old version for me. I launch powershell 7 via 'PWSH' in windows.

Baenwort
Posted
16 hours ago, ginjaninja said:

image.png.46b1d08c0fbc39833a753aa2aa059758.png

 

I think the winget command says what packages are installed but not what you are using. My blue powersheell is the old version for me. I launch powershell 7 via 'PWSH' in windows.

That seems to be correct. I changed my PS7 to be blue as I like that better than black so didn't see the difference. Execuiting $psversiontable.psversion showed I had the wrong one open.

 

Baenwort
Posted

Second, could you tell me if you'd support copying the 'Custom Rating' metadata field from the series to the episodes? I normally change that one so that it will show up for users without changing the displayed(offical) rating so that the original data is there for someone browsing but the series shows up for users with the custom rating level set as allowed.

Emby has that custom rating field, I presume for a reason, but this script only seems to check the official rating field.

ginjaninja
Posted

if you had interest in learning powershell/Emby api, u could make a copy of the script and tweak a couple of lines (backup database ofc)

$ApiURL = $EmbyURL + "/emby/Items?Recursive=true&Fields=Customrating%2COfficialrating%2CPath%2CPeople&ParentId=$($_.id)&IncludeItemTypes=Episode&api_key=$($user.AccessToken)"

You would need to add Customrating to the fields requested for each of the two api lookups....series and episodes..example above.

and then switch 'officialrating' to 'customrating' in at least these 4 places.

$seriesrating = $_.officialrating
$episoderating = $_.officialrating
#add officialrating property if api response does not include  -clause
$fullmetadata.officialrating = $seriesrating
 
if youve got as far as running powershell...tweaking the scripts might be next on the journey?

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...