Jump to content

Plugin - Iconic Image Enhancer


roaku

Recommended Posts

4 hours ago, crusher11 said:

Restarting the server to install that has, by itself, resolved the issue. 

Tada I guess?

Just speculating again, but I think a library rescan might have solved this for you too since the restart did.

My best guess is that the data Emby was sharing with Iconic about the Item was stale somehow due to the movie version swapping.

But I really don't know and I'm not trying to pass the blame off of Iconic.

Restarting the server is something to add to my troubleshooting list, though...

 

Edit: This turned out to be an Iconic bug

Edited by roaku
Link to comment
Share on other sites

5 hours ago, roaku said:

the enhanced-images one Iconic can purge

The plug-in does not attempt to manipulate the cache folder, right?

Link to comment
Share on other sites

6 hours ago, crusher11 said:

How often does this refresh itself? I just replaced a DVD of one of my films with the Blu-ray version, which adds a commentary. But I don't see the Commentary icon on the poster.

 

This turned out to be a bug in Iconic and Emby is innocent of all wrongdoing. Thanks for identifying it and it's now been squashed for the release version.

tldr; is that there was a condition where the rules results for an Item could persist indefinitely without ever being re-analyzed. That was bad.

 

The longer version is that I recently added a rules results caching mechanism so that the rules could be checked for an Item just once at the start of the Item image generating process, then purged after that process is finished. Without this, the rules for an Item would be re-analyzed each time a part of the process needed to know how the rules applied to a given Item. This worked but meant the same questions would get re-answered 4 or 5 times per Item processed. That was also bad.

The rules caching is more complicated than it sounds, because Emby uses a single instance of the plugin class in a parallel way, which speeds things up but also means it's processing many Items at more or less the same time, and the rule analysis for one Item can get applied to a different Item if everything isn't carefully scoped within the class.

I had the scoping right, and I was clearing the rules cache for each Item after processing, but the condition I missed was that if the rules get analyzed and *no* rules matched, then the process aborts immediately (again, much more efficient) and therefore Emby never calls the cache clean up for that Item. That no match analysis will now be the only possible result for that Item until the server is restarted (thanks again for discovering this @crusher11).

The solution is to always ignore the rules results cache for the initial call for the rules results when processing an Item.

 

Link to comment
Share on other sites

3 minutes ago, ebr said:

The plug-in does not attempt to manipulate the cache folder, right?

Correct. It just happens by way of the cache string changing for that particular item image.

  • Like 1
Link to comment
Share on other sites

On 2/17/2021 at 4:19 AM, GrimReaper76 said:

Maybe you could try using a combo of  @chef's automated tagging plugin (as it allows multiple criteria on a single item, more fine-grained targeting) and Iconic' s Tag-based rule? Didn't try it, but sounds like a possibility? 🤷‍♂️

Edit1: Link

Edit2: Well, throw that out the window, I just couldn't make it work, there ain't 'user-defined' field for value, and without it just cannot get anywhere. Ah, well, it was worth a try. 

 

I should finish that plugin 😬

  • Like 1
Link to comment
Share on other sites

lundblad

Why is this plugin taking so "long" time to generate vs Coverart that is instant? I must scroll slowly thru all my movies so all covers can generate. if i go too fast they skip them. 

No hate with this message im just want to know :)

Link to comment
Share on other sites

2 hours ago, lundblad said:

Why is this plugin taking so "long" time to generate vs Coverart that is instant? I must scroll slowly thru all my movies so all covers can generate. if i go too fast they skip them. 

No hate with this message im just want to know :)

Iconic can only act on an image as it's requested through the image API.

My understanding is that Coverart pre-renders its images outside of any user requests for that image somehow.

It may be possible for Iconic to do that, too, with scheduled tasks and the like to request each image from the API so the user doesn't see it happen, but I haven't had time to look into that yet. It's probably not feasible, though, because Iconic can't act on the source image, so it would have to somehow know in advance what resized images a given user's client apps will be requesting.

On my Synology ARM with about 1000 movies, having Iconic on isn't significantly slower than Emby just generating the initial image cache for the resized images, which also happens per image request.

 

Edited by roaku
Explaining why we can't hide from the image processing time
Link to comment
Share on other sites

mickle026

I agree with roaku here, in my tests on first generation it's about the same speed as when you never had any thumbs and they were first generated for the first time.  I would expect that as they are new images.  After first load it's pretty much the same speed as emby does it.  So no difference than emby doing it really.

If you keep altering things then the images are new again, so it'll happen every time the images alter by your settings.

Once you are happy and after first load you probably won't even notice it from then onwards.

Link to comment
Share on other sites

1 hour ago, roaku said:

My understanding is that Coverart pre-renders its images outside of any user requests for that image somehow.

No, CA works the same way as your plugin.  I just think it isn't as complex.

Link to comment
Share on other sites

27 minutes ago, ebr said:

No, CA works the same way as your plugin.  I just think it isn't as complex.

Oh okay.

I misinterpreted this recent post of yours then:

I took 'ingestion time' to mean the intake of the original image from whatever source, but you meant 'ingestion time' to be the first request for a derivative of that original image through the image API. Got it.

 

For Iconic, there are rule types that require querying the library manager for more information about the item. The (unreleased) release version has some optimizations to only make that query if a rule(s) exist that will need it.

But again, the difference is imperceptible in my largest test case. The rule analysis is essentially instantaneous.

As far as I can tell, the actual time is spent with the 3rd party image processing library Emby and Iconic both lean on, which for Iconic has to: resize the source image to a uniform size so the badges will be consistent in size and position across all item images, load the icons font from the assembly*, draw the various layers of the badges, and render the result

 

*I just realized I might be able to save some more time by loading the font from assembly once in the class implementing IImageEnhancer and let it provide it to the derivative classes, since that seems to behave like a permanent singleton across the life of the server run.

 

Edited by roaku
Link to comment
Share on other sites

4 hours ago, lundblad said:

Why is this plugin taking so "long" time to generate vs Coverart that is instant? I must scroll slowly thru all my movies so all covers can generate. if i go too fast they skip them. 

No hate with this message im just want to know :)

Can you try out beta 0.9.2.1 linked below and let me know if it gives you any speed improvements?
 

 

Link to comment
Share on other sites

Is anyone annoyed by the Iconic Configuration link in the left nav? Does anyone like it?

main-nav.png.1f5628831a9aac376f300c43ef66ad03.png


I added it to make development easier for me, but I'm 50/50 on leaving it there for release, especially if most people will just be setting Iconic up once and not revisiting often after that.

Link to comment
Share on other sites

GrimReaper
1 minute ago, roaku said:

Is anyone annoyed by the Iconic Configuration link in the left nav? Does anyone like it?

main-nav.png.1f5628831a9aac376f300c43ef66ad03.png


I added it to make development easier for me, but I'm 50/50 on leaving it there for release, especially if most people will just be setting Iconic up once and not revisiting often after that.

Personally, I don't mind it, quite the contrary: I'm more annoyed having to go throuh Plugins for some plugin setup. But that's just me. 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

lundblad
16 hours ago, roaku said:

Can you try out beta 0.9.2.1 linked below and let me know if it gives you any speed improvements?
 

 

Hard to say, maybe a little? IS it going to be possible to use custom icons later maybe? :D (jpg/png)

Good plugin :) 

  • Thanks 1
Link to comment
Share on other sites

4 hours ago, lundblad said:

Hard to say, maybe a little? IS it going to be possible to use custom icons later maybe? :D (jpg/png)

Good plugin :) 

Ah well. Thanks for checking.

I do want to provide some sort of icon customization options in the future, but I don't think Iconic will ever use image formats like jpg/png. Vector graphics are a more likely possibility, but again, I don't have answers for any of that yet.

Link to comment
Share on other sites

cochize1

I see that the plugin is trying to update to the long awaited version 1.0, but it fails. Any idea why?

Quote

Access to the path '/volume1/Emby/plugins/Iconic.dll' is denied.
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Emby.Server.Implementations.IO.ManagedFileSystem.CopyFile(String source, String target, Boolean overwrite)
at Emby.Server.Implementations.Updates.InstallationManager.PerformPackageInstallation(IProgress`1 progress, String target, PackageVersionInfo package, CancellationToken cancellationToken)
at Emby.Server.Implementations.Updates.InstallationManager.InstallPackageInternal(PackageVersionInfo package, Boolean isPlugin, IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.Updates.InstallationManager.InstallPackage(PackageVersionInfo package, Boolean isPlugin, IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.ScheduledTasks.PluginUpdateTask.Execute(CancellationToken cancellationToken, IProgress`1 progress)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)

 

Link to comment
Share on other sites

@cochize1

 

I'd recommend uninstalling the old beta and restarting Emby, then installing the new version from the catalog and restarting Emby one more time.

In my case, the configuration from the beta was preserved and loaded properly by the catalog release version.

 

Edited by roaku
Link to comment
Share on other sites

lundblad
2 minutes ago, crusher11 said:

Wait, 1.0 was released? Did you mention that in this thread anywhere? Has anything changed from the last beta?

 

Not what i can see

Link to comment
Share on other sites

3 minutes ago, crusher11 said:

Wait, 1.0 was released? Did you mention that in this thread anywhere? Has anything changed from the last beta?

 


I put 1.0.0 in the catalog today to make sure everything is working as expected before drawing any attention to it.

I'll put some official sounding language about the release in the first post on Monday.

1.0.0 is mostly the same as the last beta, except 1.0.0 will only match one rule per movie unless it's registered through the Emby system.

Link to comment
Share on other sites

crusher11
3 minutes ago, roaku said:

1.0.0 will only match one rule per movie unless it's registered through the Emby system.

...what?

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