Jump to content

New Plugin: Issue finding an assembly that has been loaded


Anthony Musgrove

Recommended Posts

Anthony Musgrove

Hi all,

 

Almost finished writing this plugin; however I have now hit a brick wall.

 

The plugin is functioning amazingly, until I add the reference to the assembly Mmosoft.Facebook.Sdk - which works fine in a standalone exe Windows Forms project.

 

According to the Emby Log, the assembly (and file) is loaded:

 

2020-04-07 01:46:28.375 Info App: Loading Mmosoft.Facebook.Sdk, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9b6f182bee133a41 from /var/lib/emby/plugins/Mmosoft.Facebook.Sdk.dll

 

 

However when the plugin attempts to use it, it states that it cannot find the assembly.  This occurs in both Windows and Linux.   Could you please tell me where Emby would be looking for this file?  Or why if it's loaded it can't use it?

 

2020-04-07 01:51:34.249 Debug NotificationManager: Sending notification via Extended Notifier to user Anthony
2020-04-07 01:51:34.250 Error App: ExtendedNotifier: Error posting to Facebook: System.IO.FileNotFoundException: Could not load file or assembly 'Mmosoft.Facebook.Sdk, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9b6f182bee133a41'. The system cannot find the file specified.

File name: 'Mmosoft.Facebook.Sdk, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9b6f182bee133a41'
at ExtendedNotifier.Notifier.ProcessNotification(UserNotification request)
at ExtendedNotifier.Notifier.SendNotification(UserNotification request, CancellationToken cancellationToken)

 

warm regards, Thank you

Link to comment
Share on other sites

chef

Hi there @ AnthonyJM!

 

Adding extra libraries to emby is a bit difficult, mostly because you'd be referencing a library from embys root application folder.

 

This means that it can't really be put into the plugin catalog without adding your dependencies to the core.

That being said, you can add these sdk libraries to your own version on your computer, by adding them to emby's root folder. But still realizing that when Emby updates these files will be removed.

If you are interested in creating a Facebook plugin then  I would suggest wrapping their graph API using objects that are already available in the emby API.

 

I have created a Facebook plugin which you could look at on my GitHub.

It doesn't do all the things that the sdk would allow... Yet... But it does post to pages using a simple wrapper created with emby's IHttpsClient Interface.

https://GitHub.com/chefbennyj1/Emby.Facebook

Edited by chef
Link to comment
Share on other sites

Anthony Musgrove

Thank you Chef for your advice.

 

I have the plugin working PERFECTLY now, by using Embedded Assembly resources.  I essentially embed the FacebookSDK mentioned above, and its dependency (HtmlAgilityPack), and I set the Plugin to resolve any missing assemblies using embedded resources.

 

I am so damn excited!

 

5e8be6d721cb0_Working.png

 

Now I just need to make it look pretty, and boom, this is releasable!

  • Like 1
Link to comment
Share on other sites

Just for reference, the best way to handle this is to embed the entire source code of the libraries into your plugin project, this way you don't have dependencies on any external .dll's.

  • Thanks 1
Link to comment
Share on other sites

Anthony Musgrove

I just need to figure out a way now, on how to get the actual Media item's ID when the Add New Content notification is called,

 

I know the Plugin follows the standard:

 

public async Task SendNotification(UserNotification request, CancellationToken cancellationToken), however the 'request' object only exposes:

 

            request.Date;
            request.Description;
            request.Level;
            request.Name;
            request.Url;
            request.User
 
Date is just the datetime, Description is empty for Add New Content, Level is Normal, Name is 'The Simpsons S23X01 maggie Simpson in The Longest Daycare - Copy (4) - Copy has been added to Emby Server,  URL is empty, user is the user object.
 
I need to get the Media ID of the media that has been added to the server!
Link to comment
Share on other sites

Anthony Musgrove

Just for reference, the best way to handle this is to embed the entire source code of the libraries into your plugin project, this way you don't have dependencies on any external .dll's.

 

Thank you mate, that's what I will strive to achieve!

Edited by AnthonyJM
Link to comment
Share on other sites

Anthony Musgrove

And finding the 'Media Object' for Is Playing notification too, for example:

 

5e8be9021876d_playing.png

 

I want to be able to resolve that episode title to its respective library object, so I can get more information to post, like Thumbnail, runtime etc..

 

<3

Link to comment
Share on other sites

Anthony Musgrove

From what I can read/see, I need to somehow get access to an instance of ILibraryManager within the plugin so that I can query the library and match/find media by name.  Is this possible?

Link to comment
Share on other sites

Anthony Musgrove

Got it! :))  2020-04-07 13:29:52.658 Info Extended Notifier: QWERTY - Extended Notifier plugin running!

Link to comment
Share on other sites

Anthony Musgrove

DEBUG (Added): D:\Media\Movies\The Simpsons S23X01 2 Maggie Simpson in The Longest Daycare - Copy - Copy.mp4, D:\Media\Movies, The Simpsons S23X01 2 Maggie Simpson in The Longest Daycare - Copy - Copy

 

Thank you for all your help guys, this was much appreciated! :) 

  • Like 1
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...