Jump to content

Custom Provider/ Hook in the Download Engine via C# Plugin.


Recommended Posts

ginjaninja
Posted

If i want to insert some logic into the download sync engine would there be an approach to that? Any public  projects out there that do something like this already?

I woud like to embed artwork into files when they are synced.
I have the ffmpeg artwork injection working for mp3 and flac, just need a way to hook into the workflow (and force both transcoded and original downloads via the interception)

Thanks

Posted

Hi, there is no way to do this. Why wouldn't the files just have it embedded to begin with?

ginjaninja
Posted
8 minutes ago, Luke said:

Hi, there is no way to do this. Why wouldn't the files just have it embedded to begin with?

Thanks for confirming.
Embedding artwork in all files would add ~33GB to my music ssd, which i dont have right now, but maybe thats the only way to go. I had created a feature request, so will see if others in community have any interest in an embedding option, if its just me it might be time for me to upgrade my ssd!

Maybe a feature request for a surface for plugin developers would bemore realistic.

Posted (edited)

Here's a way how you can do this:

At first - so you better understand  this step by step - install the "Folder Sync" plugin.

With that plugin, you can configure a number of folders (typically network folders, but in this case, just local folders on the server).

Now configure a folder, name it "FolderSyncTest" and configure an empty dir on the server as path. Leave "access to all users" checked for now.

Once you have done this, go to an item (e.g. a song), use "Download to.." and you will see the FolderSyncTest folder. Use that for download.
Now the file will appear in that folder on the server. 

With your plugin, you can watch that folder for changes and whenever a new file arrives, you inject your metadata/images.

So, how to get the file to the actual recipient? You can either replace the file in the library (temporarily) or create a special library for those file (e.g. "Transfer"). In either case, you use the Emby API to make it download the changed file to the actual recipient.

Understood so far?

Next question is "Who IS the actual recipient?" - your plugin cannot know this. And probably you want the download feature to work exactly as normally. You can do it like this:

For every download target of every user - you create a folder-sync folder of the same name but with a suffix like " (with metadata injection)" - and this time with permissions only for the respective user.
So, each user will see the double amount of entries in the "Download to.." dropdown list, each entry with and without that suffiix.
Based on that name - after removing the suffix - your plugin will know the name of the download target and initiate download of the enriched file to that user's location.

 

3rd Level

The above will work, but it depends on another plugin - yes - plugin!

As the functionality you need is implemented by a plugin, you can of course do that part in your own plugin as well - and hidden as that part needs no UI in your case.

The bottom line is - you don't need the folder sync plugin for implementing this - it's rather that -I- needed that plugin to understandably explain the concept 😉 

 

Edited by softworkz

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