Jump to content

New Plugin: Discord Notifications


rechigo

Recommended Posts

dude, how long has this plugin been available!?  Exactly what I was looking for...    Oh looks like feb lol...     @@ebr or whoever would be over plugins and the forum,  can we have (or is there already) as section that just posts new plugins no chit-chat,    maybe a sticky that only contains newly added catalog plugins?     I only find these things accidentally  :)  (i know this one isnt in the catalog yet) 

Edited by pir8radio
Link to comment
Share on other sites

Is your plugin using older methods?     I notice older plugins use the inline jquery,   So with security in place I can not use the settings page...   Can you not use whatever these older methods are?  (sorry not a plugin developer dont know how do get you in the right direction).

jquery.slim.min.js?v=4.4.0.30:2 Refused to execute inline script because it violates the following Content Security Policy directive: [REMOVED MY CSP] Either the 'unsafe-inline' keyword, a hash ('sha256-W1k6ORFd3jkKpPbfSN5Q+kVACo9AdtpLz+dlQvTXVVA='), or a nonce ('nonce-...') is required to enable inline execution.

C @ jquery.slim.min.js?v=4.4.0.30:2

Link to comment
Share on other sites

Is your plugin using older methods? I notice older plugins use the inline jquery, So with security in place I can not use the settings page... Can you not use whatever these older methods are? (sorry not a plugin developer dont know how do get you in the right direction).

jquery.slim.min.js?v=4.4.0.30:2 Refused to execute inline script because it violates the following Content Security Policy directive: [REMOVED MY CSP] Either the 'unsafe-inline' keyword, a hash ('sha256-W1k6ORFd3jkKpPbfSN5Q+kVACo9AdtpLz+dlQvTXVVA='), or a nonce ('nonce-...') is required to enable inline execution.

C @ jquery.slim.min.js?v=4.4.0.30:2

It does. The original project was a fork of the Slack notifications plugin which used jquery for the front end. I was going to do this a while ago, but I haven't gotten around to doing it quite yet, but I should be able to soon

 

Sent from my SM-G973U using Tapatalk

  • Like 1
Link to comment
Share on other sites

Hey, 

is it possible to post TV/Movie Name and not the Filename? 

 

If it could at some point to the same as tautulli, that would be great ;)

 

 13wsqTs.png

 

This is what i thought this plugin did...     Can this feature be added?      Looking to post to discord "new media"  either by specific library or any newly added media to the server (except recorded TV maybe, that would get annoying).   With media image and info like posted above.

Edited by pir8radio
Link to comment
Share on other sites

This is what i thought this plugin did...     Can this feature be added?      Looking to post to discord "new media"  either by specific library or any newly added media to the server (except recorded TV maybe, that would get annoying).   With media image and info like posted above.

 

I have been trying to do this, but with Emby's current notification system, it makes it a bit difficult. Right now, I am using the built in Emby notification system to get notification requests, which gives very little information when media is added (simply the title and the description), but most of the time I notice that Emby doesn't wait for metadata to be collected before sending the media added notification, so when it sends the notification before metadata is collected, all you'll get it the file name. If you were to add a second version to an item that is already in your library, then the notification will contain the actual title as well as the media description. There is another interface that I can use with my plugin called LibraryManager, which emits an event whenever media is added, however, it suffers from the same issue that the media added notification in that it doesn't wait for metadata to be gathered before the sending the event/notification.. I have a couple of hacky ideas to get around this, so I'll have to experiment with those in a little bit.

(Hope this makes sense)

Link to comment
Share on other sites

@@rechigo lol...   as im playing with the plugin im noticing things...  sorry for all of the posts....

Can you at least change how the new media is posted?    like right now it says:  "Fighting with My Family (2019) has been added to Emby Server"     I try to customize my stuff...  so I would rather it NOT say "to emby server"   either omit that or use the actual emby server name set in the dashboard?  

Edited by pir8radio
Link to comment
Share on other sites

I have been trying to do this, but with Emby's current notification system, it makes it a bit difficult. Right now, I am using the built in Emby notification system to get notification requests, which gives very little information when media is added (simply the title and the description), but most of the time I notice that Emby doesn't wait for metadata to be collected before sending the media added notification, so when it sends the notification before metadata is collected, all you'll get it the file name. If you were to add a second version to an item that is already in your library, then the notification will contain the actual title as well as the media description. There is another interface that I can use with my plugin called LibraryManager, which emits an event whenever media is added, however, it suffers from the same issue that the media added notification in that it doesn't wait for metadata to be gathered before the sending the event/notification.. I have a couple of hacky ideas to get around this, so I'll have to experiment with those in a little bit.

(Hope this makes sense)

 

@@Luke thinking the emby alerts for new media probably would be handy with more info no?   I don't know the back-end but delaying the "new media" alerts to give time to collect meta-data (which mine seems to do) and possibly including poster image in the alert would be nice...    :D   maybe return the OMDB json info as the alert for media that contains info? otherwise title like you are doing now?

 

This plugin has some pretty cool possibilities..    Like I just set it up and now, and i have it posting the tile to Discord, and zapier is mirroring that post to my facebook page all instantly...   pretty cool way to let people know about new media on the server....     Having it look a little better (media image) would be awesome. 

Edited by pir8radio
Link to comment
Share on other sites

@@rechigo lol...   as im playing with the plugin im noticing things...  sorry for all of the posts....

Can you at least change how the new media is posted?    like right now it says:  "Fighting with My Family (2019) has been added to Emby Server"     I try to customize my stuff...  so I would rather it NOT say "to emby server"   either omit that or use the actual emby server name set in the dashboard?  

Right now the bottleneck here is Emby's notification system... I will have to work out how I want to proceed in making my own media added notification, which I'll probably give you guys an option in the plugin settings to use the custom media added notification and enabling that could give some additional options too (that's for the future, for now I just want to get it to work w/ media name & description)

Link to comment
Share on other sites

Right now the bottleneck here is Emby's notification system... I will have to work out how I want to proceed in making my own media added notification, which I'll probably give you guys an option in the plugin settings to use the custom media added notification and enabling that could give some additional options too (that's for the future, for now I just want to get it to work w/ media name & description)

 

Understood...   I was just talking about the wording of the notification...  drop the mention of emby....   can do that with a simple replace...  but, ill keep an eye out for updates. 

Link to comment
Share on other sites

@@pir8radio

 

u5b.png
 

This is what you were looking for, right?

 

This will be included in the next release, along with the removal of all the old crap jQuery (we can't be using jQuery in 2020)

Link to comment
Share on other sites

@@pir8radio

 

u5b.png

 

This is what you were looking for, right?

 

This will be included in the next release, along with the removal of all the old crap jQuery (we can't be using jQuery in 2020)

 

 

:-)  THanks!       As for the first question im looking for the below to not say " to Emby Server":   I would rather it say added to nam Server.  nam being the server name i have set in the emby dashboard (second image) If that variable can not be used, then just change "to Emby Server"  to "to the media collection" or something neutral.  If i'm doing shady things, i dont want to bring down emby with me.... lol    I'm not doing shady things, just sayin'

 

*oh i think i just got what you are saying...  your emby server is called DevTest!  yea thats what i was looking for!   sweet..

 

5e78180de57bf_Screenshotfrom202003222057

 

 

5e7818f7e03bd_Screenshotfrom202003222102

Edited by pir8radio
Link to comment
Share on other sites

:-) THanks! As for the first question im looking for the below to not say " to Emby Server": I would rather it say added to nam Server. nam being the server name i have set in the emby dashboard (second image) If that variable can not be used, then just change "to Emby Server" to "to the media collection" or something neutral. If i'm doing shady things, i dont want to bring down emby with me.... lol I'm not doing shady things, just sayin'

 

*oh i think i just got what you are saying... your emby server is called DevTest! yea thats what i was looking for! sweet..

 

5e78180de57bf_Screenshotfrom202003222057

 

 

5e7818f7e03bd_Screenshotfrom202003222102

Yea, DevTest is my test server on my Mac

 

This will be in the next release, along with a configuration page written in pure ES5 (no more jQuery)

 

Sent from my SM-G973U using Tapatalk

  • Like 1
Link to comment
Share on other sites

Yea, DevTest is my test server on my Mac

This will be in the next release, along with a configuration page written in pure ES5 (no more jQuery)

Sent from my SM-G973U using Tapatalk

Excellent! I’m excited. Thanks!!

Link to comment
Share on other sites

 

 

Awesome!   Config is no longer using jquery and posts show from server name!      For anyone else interested you can also use Zapier to mirror discord posts to your facebook page (second image), pretty cool plugin!    good job.

 

Discord:

5e78b4288a1cf_Screenshotfrom202003230804

 

 

 

Facebook:

5e78b418f2faf_Screenshotfrom202003230805

  • Like 1
Link to comment
Share on other sites

This has been working flawlessly!    Now to try and bribe you to figure out either including the emby primary image, or using something like one of the API's to search for title and get a returned image before sending!  

https://www.themoviedb.org/documentation/api

http://www.omdbapi.com/

 

:D  :D  :)

 

Great work BTW.

Edited by pir8radio
Link to comment
Share on other sites

This has been working flawlessly!    Now to try and bribe you to figure out either including the emby primary image, or using something like one of the API's to search for title and get a returned image before sending!  

https://www.themoviedb.org/documentation/api

http://www.omdbapi.com/

 

:D   :D   :)

 

Great work BTW.

 

I've been investigating on how to get additional metadata for a while now.. First thought was to use the ItemAdded event, well, that event is triggered as soon as media is added, which is before metadata is populated. I then thought, hm, maybe the ItemUpdate event will emit once the metadata of an added film is populated... NOPE. I started a thread about getting this type of information and Luke said that those events need review, but who knows how long that might be. Weeks? Months? More? Don't worry though, hope is not lost... I still have other options for retrieving the metadata, one of them being what you mentioned above.

 

Going to do some work on it today and see what I figure out

Edited by rechigo
  • Like 1
Link to comment
Share on other sites

Could you temporarily store the notification to put a delay on them until the metadata has been added?

That was one of the ideas I had in mind

 

Sent from my SM-G973U using Tapatalk

Link to comment
Share on other sites

I've been investigating on how to get additional metadata for a while now.. First thought was to use the ItemAdded event, well, that event is triggered as soon as media is added, which is before metadata is populated. I then thought, hm, maybe the ItemUpdate event will emit once the metadata of an added film is populated... NOPE. I started a thread about getting this type of information and Luke said that those events need review, but who knows how long that might be. Weeks? Months? More? Don't worry though, hope is not lost... I still have other options for retrieving the metadata, one of them being what you mentioned above.

 

Going to do some work on it today and see what I figure out

 

 

Life would be great... if @@Luke could sprinkle some of his code magic on the alerts.   lol but its understood this has a pretty limited user base...

Edited by pir8radio
Link to comment
Share on other sites

I've been investigating on how to get additional metadata for a while now.. First thought was to use the ItemAdded event, well, that event is triggered as soon as media is added, which is before metadata is populated. I then thought, hm, maybe the ItemUpdate event will emit once the metadata of an added film is populated... NOPE. I started a thread about getting this type of information and Luke said that those events need review, but who knows how long that might be. Weeks? Months? More? Don't worry though, hope is not lost... I still have other options for retrieving the metadata, one of them being what you mentioned above.

 

Going to do some work on it today and see what I figure out

 

I wish you good luck. I have wrote the Telegram Plugin for Emby and struggled with the same problems that you have. For example the problem that not the Item Name is send but the filename (https://emby.media/community/index.php?/topic/76177-notification-only-filename-send/) or if it is possible to include a picture (https://emby.media/community/index.php?/topic/76676-sending-a-picture-in-an-notification/). Standard answer: In a future release. Trust me you are not looking forward for weeks that something like that is reviewed but months or years. I think in  2018 i have asked if it would be possible to add more tags to the new media notifications, guess what happened.

The first problem i circumvented be using the New Media Notification of the Playback Reporting Plugin, try it that is the way notifications should look like. Maybe you could also learn from it how to get extended info on new items from Emby,

 

Regarding the problem with the file cover, i have also made up my mind. On the other hand that should be a change made in the Emby Notification framework so all plugins could take advantage of it, but being honest the Notification framework does not seem to have a very high priority. 

Link to comment
Share on other sites

7if.png

 

Once we confirm that a match has been made, we'll simply have to check the fields that I wish to include in the embed to check if they're populated, and if it's not, we'll just exclude the field from the embed

 

There will be a slight limitation with posters/covers, remote access will have to be enabled, otherwise discord won't be able to reach the image (I'll check this programatically and exclude the image if remote access is disabled) Scratch that, we can instead get the original artwork url from the source (fanart, tvdb, etc) instead. the only caveat with that is coverart wont treat the item (oh big deal)

 

I also have to consider the fact that media might not ever get a match, in the case that something like that happens, I'll keep a count of how many times the item was queued for recheck, and after x amount of times we'll send the notification without the metadata

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