Jump to content

New Plugin: Smart Playlists 2.0


ShaneP

Recommended Posts

sydlexius
12 hours ago, smernt said:

Ok, this seems to be working great so far! Question though, is there a way to combine a bunch of genres together into a single rule? I know there's the 'multiple values' option, but that requires typing out all of the values manually too. Being able to multi-select from the list version of the Genre rule would be great!

Also, 'Parental Rating' doesn't seem to be working. I'm trying to set a rule like this:
image.thumb.png.f18afd28c98eec062f20f9cd4173ef90.png

However, I keep getting the following kind of error:

Incomparable: 'Superbad', Field: 'Parental rating': 'No metadata value found'

This happens on all of the items, which means no items are being added to the playlist because it thinks they're all missing that metadata, even though they're not. For example, Superbad has the Parental Rating of 'R' in my metadata.

I wonder if the 'Parental Rating' rule is accidentally pulling from the 'Custom Rating' metadata field by mistake? As I don't use the custom ratings but all of my items have parental ratings attached.

Also, the list of Parental Ratings are a little confusing since they seem to only be US based. I'm in the UK and our ratings include U, 18, 12A etc, but they're not there, which also makes it difficult to filter in this way.

For example, here's what I see if I filter within Emby:

  Reveal hidden contents

image.png.b82025aee65de63f836b28128ef273a7.png




And this is what I see as options within Smart Playlist:
 

  Reveal hidden contents

image.thumb.png.4310c39c7e74486d8a9245f0e9f416c2.png

 

So this is where a regular expression comes to the rescue.  I don't know exactly how @ShaneP implemented it, but here's some pseudocode:

//^G|PG$//

the "|" is an "or" pipe.  The beginning of line operator "^" and end of line operator "$" aren't strictly necessary, when you're dealing with single-line strings.

Link to comment
Share on other sites

sydlexius
3 minutes ago, sydlexius said:

So this is where a regular expression comes to the rescue.  I don't know exactly how @ShaneP implemented it, but here's some pseudocode:

//^G|PG$//

the "|" is an "or" pipe.  The beginning of line operator "^" and end of line operator "$" aren't strictly necessary, when you're dealing with single-line strings.

So just doing some checking, but Parental Rating is not regular expression-enabled yet.

Link to comment
Share on other sites

ShaneP
21 hours ago, smernt said:

Ok, this seems to be working great so far! Question though, is there a way to combine a bunch of genres together into a single rule? I know there's the 'multiple values' option, but that requires typing out all of the values manually too. Being able to multi-select from the list version of the Genre rule would be great!

Also, 'Parental Rating' doesn't seem to be working. I'm trying to set a rule like this:
image.thumb.png.f18afd28c98eec062f20f9cd4173ef90.png

However, I keep getting the following kind of error:

Incomparable: 'Superbad', Field: 'Parental rating': 'No metadata value found'

This happens on all of the items, which means no items are being added to the playlist because it thinks they're all missing that metadata, even though they're not. For example, Superbad has the Parental Rating of 'R' in my metadata.

I wonder if the 'Parental Rating' rule is accidentally pulling from the 'Custom Rating' metadata field by mistake? As I don't use the custom ratings but all of my items have parental ratings attached.

Also, the list of Parental Ratings are a little confusing since they seem to only be US based. I'm in the UK and our ratings include U, 18, 12A etc, but they're not there, which also makes it difficult to filter in this way.

For example, here's what I see if I filter within Emby:

  Reveal hidden contents

image.png.b82025aee65de63f836b28128ef273a7.png




And this is what I see as options within Smart Playlist:
 

  Reveal hidden contents

image.thumb.png.4310c39c7e74486d8a9245f0e9f416c2.png

 

 Hey @smernt, So for the genre you have to options.Regex or Listed. Here are the examples.

Listed (Could also use text, Listed to reads of a list of Genre that is already in the system). ANY group = OR

image.thumb.png.90bdbc994660198659858a1655f88f2c.png

Or Regex

image.thumb.png.0ac1d5a692dfd1a4ce357eebf9de1909.png

 

As far as the parental rating is concerned, Smart Playlist uses the underlying Emby system to get the ratings, make sure that you Library is set to the right Country. So Settings -> Library -> Advanced. Can you check that. Is your metadata tagged correctly in Emby if the country code is not UK?

image.png.0565faba53476e8ba892c01456741f54.png

Link to comment
Share on other sites

ShaneP
8 hours ago, sydlexius said:

So just doing some checking, but Parental Rating is not regular expression-enabled yet.

Hey @sydlexius Thanks for the help, I'm not sure if regex makes sense on selection lists, i.e. don;t know if there is a valid use case for the effort as the change UI wise for listed regex could be quite a bit of work.

Link to comment
Share on other sites

ShaneP
On 7/23/2022 at 11:50 AM, koopa8840 said:

I'm running across this error, on Live Update:  Error Value cannot be null. (Parameter 'first')

As you can see, the Next Update time is set before Last Populated time. This morning I check the status and I have the error. You can see the Last Populated time has changed, but not the Next Update time. The log does not show anything. However, if you go to Scheduled Tasks and execute Refresh All Smart Playlists and Collections, the error is gone. Not sure what the cause is.create.thumb.png.7297cab10ce9204f29e260c759b23670.png

 

error.thumb.png.0b2f38bfbd956f4725bef534af8747d1.png

 

manual_run.thumb.png.f0a8d84adbafa4be884ff0ecc4e8ba32.png

 

log.png

 

I found this in the emby server log.

 

server_log.png.5327ff8d0c20a313444050009ac8c9b6.png

 

settings.png

@koopa8840 I can't seem to replicate and looking at the code, I can't even see a 'first' lamda query, but I could be missing something, if you're able to replicate this, this would help.

Link to comment
Share on other sites

ShaneP
23 hours ago, smernt said:

This looks great! I'm just about to get it installed. Thank you for doing this, it's sorely needed in default Emby.

For the Emby Devs: PLEASE just get this incorporated into Emby by default. People are doing the leg work & bringing features that should have been included years ago, so rather than just leave it like that, please make deals with these kind contributors & get these features built into Emby. I know it's definitely easier said than done, but it would certainly help tick off some of those feature requests which are buried under a few inches of dust. I'm sure the response will be 'this is planned for the future' 😂

@smernt Thank you! My plan is to stabilizes this release. (No more new features). Once it all looks clear, I'll submit to the Emby plug in gallery which would make it a little easier to install and more visible. 

  • Thanks 3
Link to comment
Share on other sites

nuentes
On 7/23/2022 at 10:08 AM, ShaneP said:

Hey @nuentes, Firstly any reason you don't want to upgrade to the latest version of Emby? Secondly, I am running Ubuntu as well, but the latest version of Emby so can't really debug. If I can I'll just create a new container and install 4.6.X.X and run it, if it's not a big fix I'll included in the next release. If you fire up Web Developer Tools in your browser do you see any javascript errors in the console that might shed some light on this?

I'm in the middle of re-encoding a bunch of videos on my server, and I don't want to stop it to uninstall/reinstall right now. I'll probably be upgrading by the end of the week.

And sorry, @ShaneP, but I don't see any javascript errors in the console.

Link to comment
Share on other sites

ShaneP
1 hour ago, nuentes said:

I'm in the middle of re-encoding a bunch of videos on my server, and I don't want to stop it to uninstall/reinstall right now. I'll probably be upgrading by the end of the week.

And sorry, @ShaneP, but I don't see any javascript errors in the console.

Awesome @nuentes I’ll see if I can get to the bottom of it anyhoo

Link to comment
Share on other sites

sydlexius
3 hours ago, ShaneP said:

Hey @sydlexius Thanks for the help, I'm not sure if regex makes sense on selection lists, i.e. don;t know if there is a valid use case for the effort as the change UI wise for listed regex could be quite a bit of work.

Perhaps with selection lists, you could place checkboxes next to each item?

Link to comment
Share on other sites

koopa8840
4 hours ago, ShaneP said:

@koopa8840 I can't seem to replicate and looking at the code, I can't even see a 'first' lamda query, but I could be missing something, if you're able to replicate this, this would help.

I can't replicate what the screenshots show, because I don't know what caused it. These are the steps I took; create Collection, Collection is populated, check Status 24hrs later and the error is there. However, when I copy a movie file to my movie folder the error occurs. If I go to Scheduled Tasks and manually Refresh Smart Playlists, the error is gone. I have set a Scheduled Task to Refresh every 15 minutes, so when I am moving movie files, I do not have to keep manually refreshing. Maybe the problem is related to not able to the read the file, while it is being moved? 🤷‍♂️

 

I'm going to look into Scripter-X and see if it is possible to execute a Refresh after moving a file is completed.

Edited by koopa8840
Link to comment
Share on other sites

ShaneP
11 minutes ago, koopa8840 said:

I can't replicate what the screenshots show, because I don't know what caused it. These are the steps I took; create Collection, Collection is populated, check Status 24hrs later and the error is there. However, when I copy a movie file to my movie folder the error occurs. If I go to Scheduled Tasks and manually Refresh Smart Playlists, the error is gone. I have set a Scheduled Task to Refresh every 15 minutes, so when I am moving movie files, I do not have to keep manually refreshing. Maybe the problem is related to not able to the read the file, while it is being moved? 🤷‍♂️

 

I'm going to look into Scripter-X and see if it is possible to execute a Refresh after moving a file is completed.

I don’t think the copy is the issue, the way the original design works is to collect metadata change events and when they reach or certain number or a time has passed it the executes. I’ll still see what I can find even if it’s just more logging to help pin point where this is happening.

Link to comment
Share on other sites

koopa8840
36 minutes ago, ShaneP said:

I don’t think the copy is the issue, the way the original design works is to collect metadata change events and when they reach or certain number or a time has passed it the executes. I’ll still see what I can find even if it’s just more logging to help pin point where this is happening.

I know the error occurs when moving files; just not sure what causes it when nothing is being moved. The Collection is Live and populates based on the bitrate being 10Mbps or lower. You can see in the attached log multiple SmartPlaylist errors (83 of them) occur when moving files. Sorry, I can't provide a SmartPlaylist log. It doesn't show anything.

 

The attached log includes 2022-07-23 01:02:12, which is in the attached screenshot.

embyserver-63794217600.txt

error.png

 

 

UPDATE

Just rebooted the server and have the error. See attached server log.

embyserver.txt

Edited by koopa8840
  • Thanks 1
Link to comment
Share on other sites

koopa8840

The last restart, I had a Scheduled Task set to Refresh Smart Playlists upon server restart and the error occurred. I was, also, moving a TV show file at this time. I deleted the task, and am NOT moving a file, restarted the server and no error appears. Hope this helps out.

UPDATE

I set a Schedule Task to Refresh Smart Playlist on restart and no error occurs. It seems the error occurs when moving files regardless of being TV, Music or Movie even though the settings are for Media Type = Movie.

Edited by koopa8840
Link to comment
Share on other sites

smernt
On 25/07/2022 at 12:22, ShaneP said:

As far as the parental rating is concerned, Smart Playlist uses the underlying Emby system to get the ratings, make sure that you Library is set to the right Country. So Settings -> Library -> Advanced. Can you check that. Is your metadata tagged correctly in Emby if the country code is not UK?

Hey @ShaneP, so I have all of the country options set to UK for all of my libraries, but I'm still encountering a problem with the Parental Rating filter.

For example, to simplify, if I have a simple filter such as 'Media Type is Movie AND Genre (Listed) is Comedy', the results are as you'd expect, all of my movies that have comedy genre.

image.thumb.png.4626cef479d9d0543bdf5c8afdd46610.png

image.thumb.png.ca7f6f4cbd4e397261e666eba9528924.png

 

However, if I add a Parental Rating filter to it so the full rule is 'Media Type is Movie AND Genre (Listed) is Comedy AND Parental rating is not PG', I get no results:

image.thumb.png.cbc675c28bc8070313034131659fbbf6.png

 

image.thumb.png.c7736a44193c4c68a5e66fe4808464a0.png

 

All of the results in the log file return the same thing for the Parental Rating rule:
 

Incomparable: 'The Quiet Man', Field: 'Parental rating': 'No metadata value found'

 

Using the same filter within the emby client, it returns 715 results. Also, while all of my Parental Ratings are UK based inside of Emby, such as 21 Jump Street being a GB-15 or Scary Movie being a GB-18, the list of Parental Ratings inside of Smart Playlist still doesn't include them and only includes the following, which may or may not be the problem.

image.png.1b3fc7c17d4bda7c32701f8cdac535b1.png

Link to comment
Share on other sites

nuentes
On 7/25/2022 at 10:30 AM, ShaneP said:

Awesome @nuentes I’ll see if I can get to the bottom of it anyhoo

I've updated to 4.7.5.0, and Smart Playlist is now appearing correctly. So definitely an issue with that release.

Link to comment
Share on other sites

goldsworthy1

Just installed the latest version 2.4.0.0... any ideas for the below?

 

2022-07-28 10:06:09.869 Error App: Error loading assembly /var/packages/EmbyServer/var/plugins/SmartPlaylist.dll
*** Error Report ***
Version: 4.7.5.0
Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /var/packages/EmbyServer/var -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /var/packages/EmbyServer/var/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology7_{version}_x86_64.spk -noautorunwebapp
Operating system: Linux version 4.4.180+ (root@build15) (gcc version 7.5.0 (GCC) ) #41890 SMP Thu Jul 15 03:43:42 CST 2021
Framework: .NET 6.0.2
OS/Process: x64/x64
Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll
Processor count: 4
Data path: /var/packages/EmbyServer/var
Application path: /volume1/@appstore/EmbyServer/system
System.BadImageFormatException: System.BadImageFormatException: Bad IL format.
at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore)
at System.Reflection.Assembly.Load(Byte[] rawAssembly)
at Emby.Server.Implementations.ApplicationHost.LoadAssembly(String file)
Source: System.Private.CoreLib
TargetSite: System.Reflection.Assembly Load(Byte[], Byte[])
Link to comment
Share on other sites

koopa8840

@ShaneP I did more testing and found the error definitely occurs when moving files. I can disable the Live collection, move files, enable the Live collection and have no error. Also, when the error occurs you have to manually Refresh in order for Scheduled Refreshes to execute.

Link to comment
Share on other sites

  • 2 weeks later...
Junglejim
59 minutes ago, chowbok said:

Is it just me, or is there no way to manually sort an existing smart playlist? If there is, how do I do it?

Hi mate, by manually do you mean drag and drop like emby's standard playlist feature?

I haven't tried it but there is a "Update type: manual" option at the top right. Maybe give that a go.

Another thing you could try is delete the generated smartplaylist but select the "Keep generated Playlist/Collection ?" option, then manually edit it from there.

Screenshot_2022-08-13_14-41-04.png.f9f677b75f58ceb1d3ef1e34eb5aabd8.png

 

Edited by Junglejim
Link to comment
Share on other sites

chowbok

No, I just mean invoke the sort on an existing playlist when I want to. Right now I only see how to do it on a timer.

Link to comment
Share on other sites

Junglejim
16 minutes ago, chowbok said:

No, I just mean invoke the sort on an existing playlist when I want to. Right now I only see how to do it on a timer.

Ok yea I see what you mean, try the "Update type: manual" then select your "Sort by" and hit the save button hopefully that should work.

From there on in you will have to enter the playlist settings and hit save to refresh it.

 

Edited by Junglejim
Link to comment
Share on other sites

Junglejim
25 minutes ago, chowbok said:

It's not letting me change it:

 

Screenshot_2022-08-13_00-59-50.png

That's strange, maybe don't sort on "newly added" and do the "Sort by" option, it's working for me just fine..

Screenshot_2022-08-13_15-54-02.thumb.png.0578686c276bbd33e2fcfbbae31c1faa.png

generates..

Screenshot_2022-08-13_15-54-22.thumb.png.e433eb2162180b2a07fc1c107ca97f2c.png

If I change to descending..

Screenshot_2022-08-13_15-54-46.thumb.png.ba0a1523ccc1b5559872132cab373523.png

I get..

Screenshot_2022-08-13_15-55-02.thumb.png.1d87a8e719b308647a1acc0bee2a2466.png

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