Jump to content

New Plugin: Smart Playlists 2.0


ShaneP

Recommended Posts

31 minutes ago, ShaneP said:

@akawoz Thanks for the positive feedback. Firstly, the "Sort newly added" and "limit' act quite differently, hence why one gets disabled.

  • Sort Newly: Will only sort any new items in the particular order, so let's say your emby playlist have 500 items already, and smartplaylist picks up a new 10 items to add, it will only sort the 10 items in the order you selected and add them to the bottom of the playlist. (Unfortunately Emby playlists/collections don't have sort functionality). On that I was thinking of building another "scheduled" process off the plugin that will sort the playlist and collections at a certain time if needed, as the only way to do it, it to basically remove the items and re-add in the order you have selected, this could be very expensive on the fly.
  • Limited, what the code does is let's say 100 new items have been flagged to add to a list, limited would sort the 100 items, then take the top 30 and then clear out the playlist and re-add, I have recently changed a little code here so if you're not seeing that behavior I'd say there's a bug, I will re-test and if I pick something up I will fix it for the next release. Will keep you posted.

So to follow up @akawoz I think there might be a bug there regarding live and limit in conjunction. If you change your Update Type to any of the shuffle options do you see the expected result?

Edited by ShaneP
Link to comment
Share on other sites

Thanks for working on this @ShaneP - just did a bunch of tests (in between tests I deleted the collection so that Smart Playlists would recreate it from scratch).

Doesn't matter what I change Update Type to or Limited Sort By (Release date desc, Release date asc) I always get the same sort in Emby. For clarity the sort I am looking for would be newest release -> oldest release ie. Texas Chainsaw, The Ledge, Fistful of Vengeance etc 

 

image.thumb.png.337a97046189cf92706c7feb648cf11d.png

Edited by akawoz
Link to comment
Share on other sites

5 minutes ago, akawoz said:

Thanks for working on this @ShaneP - just did a bunch of tests.

Doesn't matter what I change Update Type to or Limited Sort By (Release date desc, Release date asc) I always get the same sort in Emby. For clarity the sort I am looking for would be newest release -> oldest release ie. Texas Chainsaw, The Ledge, Fistful of Vengeance etc 

 

image.thumb.png.337a97046189cf92706c7feb648cf11d.png

Cool, thanks for that @akawoz, If you delete the playlist and run it again, do you see the same? (Execute button in manager to rerun) also, shuffle type will only run once in the time frame... so it could just not be running it. (execute button will always force a re-run)

Edited by ShaneP
Link to comment
Share on other sites

matmielke

I just installed the plugin with an emby-server 4.7.0.26beta installation.

Everything shows correct in the GUI and when clicking the "Smart Playlist" in the menue on the left side, it shows the Smart Playlist page with the "Add Smart Playlist" button. When klicking the button, nothing happens.

Instead, I get the following error in the log file:

2022-02-28 20:10:16.248 Error Server: Error processing request
*** Error Report ***
Version: 4.7.0.26
Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_armhf.deb
Operating system: Linux version 5.10.92-v7l+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #151
Framework: .NET 6.0.2
OS/Process: arm/arm
Runtime: opt/emby-server/system/System.Private.CoreLib.dll
Processor count: 4
Data path: /var/lib/emby
Application path: /opt/emby-server/system
System.InvalidOperationException: System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at SmartPlaylist.Domain.CriteriaDefinition.CriteriaDefinitions.GenreListedCriteriaDefinition.get_Type()
at _GetProperty[T]_Type_(GenreListedCriteriaDefinition )
at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object instance) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 425
at ServiceStack.Text.Common.WriteType`2.WriteLateboundProperties(TextWriter writer, Object value, Type valueType) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 473
at ServiceStack.Text.Common.WriteType`2.WriteAbstractProperties(TextWriter writer, Object value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 369
at ServiceStack.Text.Common.WriteListsOfElements`2.<>c__DisplayClass1_0.<.cctor>b__0(TextWriter writer, Object obj) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 232
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteGenericArrayMultiDimension(TextWriter writer, Array array, Int32 rank, Int32[] indices) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 367
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteGenericArray(TextWriter writer, Array array) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 374
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteArray(TextWriter writer, Object oArrayValue) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 332
at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object instance) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 450
at ServiceStack.Text.JsonSerializer.SerializeToWriter(Object value, Type type, TextWriter writer) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\JsonSerializer.cs:line 159
at Emby.Common.Implementations.Serialization.JsonSerializer.SerializeToWriter(Object obj, TextWriter writer)
at Emby.Common.Implementations.Serialization.JsonSerializer.SerializeToStream(Object obj, Stream stream)
at Emby.Server.Implementations.HttpServer.HttpListenerHost.SerializeToJson(Object o, Stream stream)
at Emby.Server.Implementations.Services.ResponseHelper.WriteObject(HttpListenerHost httpListenerHost, IRequest request, Object result, IResponse response, CancellationToken cancellationToken)
at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
Source: System.Linq
TargetSite: Void ThrowNoElementsException()

The plugin-DLL itself is located in

/var/lib/emby/plugins 

and

/opt/emby-server/system/plugins/

Could you please help me how to proceed?

 

Thanks and best regards,

Matthias

Edited by matmielke
typo
Link to comment
Share on other sites

3 hours ago, matmielke said:

I just installed the plugin with an emby-server 4.7.0.26beta installation.

Everything shows correct in the GUI and when clicking the "Smart Playlist" in the menue on the left side, it shows the Smart Playlist page with the "Add Smart Playlist" button. When klicking the button, nothing happens.

Instead, I get the following error in the log file:

2022-02-28 20:10:16.248 Error Server: Error processing request
*** Error Report ***
Version: 4.7.0.26
Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_armhf.deb
Operating system: Linux version 5.10.92-v7l+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #151
Framework: .NET 6.0.2
OS/Process: arm/arm
Runtime: opt/emby-server/system/System.Private.CoreLib.dll
Processor count: 4
Data path: /var/lib/emby
Application path: /opt/emby-server/system
System.InvalidOperationException: System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at SmartPlaylist.Domain.CriteriaDefinition.CriteriaDefinitions.GenreListedCriteriaDefinition.get_Type()
at _GetProperty[T]_Type_(GenreListedCriteriaDefinition )
at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object instance) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 425
at ServiceStack.Text.Common.WriteType`2.WriteLateboundProperties(TextWriter writer, Object value, Type valueType) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 473
at ServiceStack.Text.Common.WriteType`2.WriteAbstractProperties(TextWriter writer, Object value) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 369
at ServiceStack.Text.Common.WriteListsOfElements`2.<>c__DisplayClass1_0.<.cctor>b__0(TextWriter writer, Object obj) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 232
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteGenericArrayMultiDimension(TextWriter writer, Array array, Int32 rank, Int32[] indices) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 367
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteGenericArray(TextWriter writer, Array array) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 374
at ServiceStack.Text.Common.WriteListsOfElements`2.WriteArray(TextWriter writer, Object oArrayValue) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteLists.cs:line 332
at ServiceStack.Text.Common.WriteType`2.WriteProperties(TextWriter writer, Object instance) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\Common\WriteType.cs:line 450
at ServiceStack.Text.JsonSerializer.SerializeToWriter(Object value, Type type, TextWriter writer) in C:\BuildAgent\work\912418dcce86a188\src\ServiceStack.Text\JsonSerializer.cs:line 159
at Emby.Common.Implementations.Serialization.JsonSerializer.SerializeToWriter(Object obj, TextWriter writer)
at Emby.Common.Implementations.Serialization.JsonSerializer.SerializeToStream(Object obj, Stream stream)
at Emby.Server.Implementations.HttpServer.HttpListenerHost.SerializeToJson(Object o, Stream stream)
at Emby.Server.Implementations.Services.ResponseHelper.WriteObject(HttpListenerHost httpListenerHost, IRequest request, Object result, IResponse response, CancellationToken cancellationToken)
at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
Source: System.Linq
TargetSite: Void ThrowNoElementsException()

The plugin-DLL itself is located in

/var/lib/emby/plugins 

and

/opt/emby-server/system/plugins/

Could you please help me how to proceed?

 

Thanks and best regards,

Matthias

Hey @matmielke, thanks for this, I actually picked up this bug today by accident and fixed in the next release.

On 2/27/2022 at 12:24 AM, akawoz said:

Thanks for working on this @ShaneP - just did a bunch of tests (in between tests I deleted the collection so that Smart Playlists would recreate it from scratch).

Doesn't matter what I change Update Type to or Limited Sort By (Release date desc, Release date asc) I always get the same sort in Emby. For clarity the sort I am looking for would be newest release -> oldest release ie. Texas Chainsaw, The Ledge, Fistful of Vengeance etc 

 

image.thumb.png.337a97046189cf92706c7feb648cf11d.png

Hey @akawoz, so I did more digging into this, what the original code was doing is sorting by the items Premiere Date (Release Date field), which is not required, what it then does if the release date is not there it goes for the next best things, the production year. I tested you exact scenario and got it was working, can you just that the release date metadata field is correct on items you'd expect to see. Also, I have done a bit of tweaking around this. So hopefully this goes away :D

Link to comment
Share on other sites

Hey all, 2.2.0.1 is available for testing.


Version 2.2.0.1

  • Performance
    • Optimized Live mode by not pulling all items to compare against, only new items and previous added. (Hopefully this makes things a little better.)
  • Feature
    • Made plugin compatible with Emby > 4.7.0.0 (Backward compatible with current release 4.6)
    • Added 'Rating' criteria for:
      • Community
      • Critic
      • Custom
    • Added loader to management screen while loading large amounts of smartplaylists.
  • Bug
    • Fixed a bug on number input where the value would only be updated blur, meaning that the spinners are rendered useless.
    • Fixed a bug where there was no Genres in the system the editor would fail to load.

I have done a bit of rework on the "Live" update mode, so if you'd be so kind as to keep an eye on it for a day or two. Also, was able to get one version to work on Latest and Beta. So no need to have two branches any more.

 

As always, code is in the repo and let me know of any problems. Happy viewing!

SmartPlaylist-2.2.0.1.zip

Link to comment
Share on other sites

BaiGanJia

Emby 4.7.0.27

smartlist 2.2.0.1

Maybe I don't know how to use it,

it's Very unstable, many conditions are very clear, but it can't return my expected results.

For example I want to filter out 2000-2002 movies, it fails

Error App: [SmartPlaylist][Error]: Object reference not set to an instance of an object.


I wanted  Shawshank  and it didn't work either


```

 

image.png.eeb0b41881ef5e548c31fef8b9e0755d.pngimage.png.0f88623121358085867c9baa814abfee.pngimage.png.c1f9b043d33057c2c8cbe7b50fb82eca.pngimage.png.376cfa339a6a36a16ecd5de4e4864a5a.png

================================================

 

image.png.4e97156c30730367f9e076fdae22886b.pngimage.png.1709bda0fa3ffce70f41559e3d0edc40.png

Edited by Byebye
Link to comment
Share on other sites

Thanks for the update @ShaneP but I get the same error message.

If I change it to Manual (not Live) then it works but the sorting is still wrong.

 

image.thumb.png.98e0fca41a584a05149103afcd437f3a.png

image.thumb.png.d508e58cb8ed365777eadf5619bd17bf.png

Edited by akawoz
Link to comment
Share on other sites

14 hours ago, Byebye said:

Emby 4.7.0.27

smartlist 2.2.0.1

Maybe I don't know how to use it,

it's Very unstable, many conditions are very clear, but it can't return my expected results.

For example I want to filter out 2000-2002 movies, it fails

Error App: [SmartPlaylist][Error]: Object reference not set to an instance of an object.


I wanted  Shawshank  and it didn't work either


```

 

image.png.eeb0b41881ef5e548c31fef8b9e0755d.pngimage.png.0f88623121358085867c9baa814abfee.pngimage.png.c1f9b043d33057c2c8cbe7b50fb82eca.pngimage.png.376cfa339a6a36a16ecd5de4e4864a5a.png

================================================

 

image.png.4e97156c30730367f9e076fdae22886b.pngimage.png.1709bda0fa3ffce70f41559e3d0edc40.png

Hey @Byebye Thanks for that, yea there was definitely I bug I introduced when doing the Update Type: Live optimization, I missed a small things when creating a new playlist. I have fixed this. Let me know if this is good now.

12 hours ago, akawoz said:

Thanks for the update @ShaneP but I get the same error message.

If I change it to Manual (not Live) then it works but the sorting is still wrong.

 

image.thumb.png.98e0fca41a584a05149103afcd437f3a.png

image.thumb.png.d508e58cb8ed365777eadf5619bd17bf.png

Hey @akawoz, this is really odd as I cannot replicated this on my side, and is behaving as it should. I might need to send you a special debug version so I can try determine what's going on there. You did double check the release date metadata field right?

Link to comment
Share on other sites

Hey All,

Thanks to @Byebye finding a bug, I'm putting out a fixed version...
 

Version 2.2.0.2

  • Bug
    • Fixed newly introduced bug when Update type is live and the playlist or collection does not exist yet.
    • Fixed info window duration format. (Playlist will need to execute once to rectify)
    • Fixed playlist stats for live update type.

 

Happy testing.

SmartPlaylist-2.2.0.2.zip

Link to comment
Share on other sites

horstepipe

Hey @ShaneP

as not all movies have a critics rating, is there a way to do these rules:

- show movies with a community rating over 6,5
AND
- show movies with a critics rating over 6,5
	OR
- show movies without a critics rating

 

Edited by horstepipe
Link to comment
Share on other sites

horstepipe
4 minutes ago, horstepipe said:

Hey @ShaneP

as not all movies have a critics rating, is there a way to do these rules:

- show movies with a community rating over 6,5
AND
- show movies with a critics rating over 6,5
	OR
- show movies without a critics rating

 

even better would be this

- show movies with a community rating over 6,5
AND
- show movies with a critics rating over 6,5

	OR

- show movies with a community rating over 7,5
AND
- show movies without a critics rating

 

Link to comment
Share on other sites

horstepipe

another question:

where is the config of the plugin - or where are the playlist settings stored?

As I want to setup multiple playlists for each genre, I guess it takes way less time by editing the config file.

Link to comment
Share on other sites

21 hours ago, horstepipe said:

another question:

where is the config of the plugin - or where are the playlist settings stored?

As I want to setup multiple playlists for each genre, I guess it takes way less time by editing the config file.

@horstepipe they are stored in individual json files in your data/smartplaylist directory.

 

Also the above scenario is double AND = All (Group), OR = Any (Group). I will add a new operator called is empty for filter on metadata that does not have a value in the next release.

  • Thanks 1
Link to comment
Share on other sites

Any chance this plugin will be added to emby's plugin catalogue?

 

Thanks

Link to comment
Share on other sites

1 hour ago, Ninko said:

Any chance this plugin will be added to emby's plugin catalogue?

 

Thanks

Hey @Ninko, once all is stabilised, I’ll see what the process is.

Link to comment
Share on other sites

28 minutes ago, DarKni8 said:

Guys which version i can use for 4.6.7.0?

@DarKni8the latest version supports 4.6 and the beta.

Link to comment
Share on other sites

DarKni8

Thanks, I am getting this error when i click on add smart playlist. It opens nothing.

image.thumb.png.d3b4a81535c6efd873003885c3c673d8.png

Link to comment
Share on other sites

47 minutes ago, DarKni8 said:

Thanks, I am getting this error when i click on add smart playlist. It opens nothing.

image.thumb.png.d3b4a81535c6efd873003885c3c673d8.png

What version of the plug-in do you have? I’ve never seen this error before so not to sure, would have to investigate.

Link to comment
Share on other sites

DarKni8

    44 minutes ago, ShaneP said:  What version of the plug-in do you have? I’ve never seen this error before so not to sure, would have to investigate.  The one linked in first post.  44 minutes ago, ShaneP said:  What version of the plug-in do you have? I’ve never seen this error before so not

45 minutes ago, ShaneP said:

What version of the plug-in do you have? I’ve never seen this error before so not to sure, would have to investigate.

The release from github 

Link to comment
Share on other sites

BaiGanJia
On 3/1/2022 at 11:19 PM, ShaneP said:

Hey All,

Thanks to @Byebye finding a bug, I'm putting out a fixed version...
 

Version 2.2.0.2

  • Bug
    • Fixed newly introduced bug when Update type is live and the playlist or collection does not exist yet.
    • Fixed info window duration format. (Playlist will need to execute once to rectify)
    • Fixed playlist stats for live update type.

 

Happy testing.

SmartPlaylist-2.2.0.2.zip 182.8 kB · 6 downloads

thanks verymuch  it works ,thasnks again

Link to comment
Share on other sites

redhalo
22 hours ago, DarKni8 said:

Thanks, I am getting this error when i click on add smart playlist. It opens nothing.

image.thumb.png.d3b4a81535c6efd873003885c3c673d8.png

I can confirm that I have the same problem with add playlist opening nothing, except I don't appear to have an error in my logs. Latest version of plugin, tried with both the latest beta and stable Emby.

Edited by redhalo
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...