Jump to content

New Plugin: Discord Notifications


rechigo

Recommended Posts

Hi yes, I was able to set up a virtual machine to test development on

 

I changed the HTTP client to one that will work with FrreeBSD and its working great so far

 

I've only been working on the plugin once or twice a week, so I haven't been getting much done recently. Right now I'm just in the testing phase, so a new version should be released soon

Link to comment
Share on other sites

Hi yes, I was able to set up a virtual machine to test development on

 

I changed the HTTP client to one that will work with FrreeBSD and its working great so far

 

I've only been working on the plugin once or twice a week, so I haven't been getting much done recently. Right now I'm just in the testing phase, so a new version should be released soon

Great to hear!

Sorry didn't want to push you. Just wanted to help as much as possible.

 

Thanks for all your great work!

Link to comment
Share on other sites

Sorry for few updates, I've been busy putting up with computer crap (and still am, but I needed a break before I went insane)

 

So I have a new version, addressing (I believe) all issues that have been brought up:

https://github.com/oonqt/Emby.Notifications.Discord/releases/tag/1.0.7.9

 

I am now working on version 2 which will expand the possibilities for notifications providing better integration with Discord than what's possible with Emby's build in notification system

 

Like on the original post is appreciated!

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

I have the latest version running for a few days now, works great with separate channels in discord for specific notifications! I have disabled notifications for episodes though because it becomes really spammy once you download complete shows at once. Even season notifications will profit from grouping in my opinion. 

 

Anyway I am really happy with the work you have done! It works great together with Requestrr. Now me and my users have a nice little Emby/Discord Ecosystem  :wub:

  • Like 1
Link to comment
Share on other sites

Sorry for few updates, I've been busy putting up with computer crap (and still am, but I needed a break before I went insane)

 

So I have a new version, addressing (I believe) all issues that have been brought up:

https://github.com/oonqt/Emby.Notifications.Discord/releases/tag/1.0.7.9

 

I am now working on version 2 which will expand the possibilities for notifications providing better integration with Discord than what's possible with Emby's build in notification system

 

Like on the original post is appreciated!

It works now on BDS without a problem.

Great Thanks!

  • Like 1
Link to comment
Share on other sites

I have disabled notifications for episodes though because it becomes really spammy once you download complete shows at once.

 

Correct, but on the other hand the episode notification is quite handy when episodes are released weekly.

 

That's why I suggested to differ two situations:

 

1. Season already exists and new episode gets added -> Trigger episode notification, so that users get notification of new episode.

2. Season doesn't exist yet and gets newly added to Emby, no matter how many episodes are in it -> Trigger season notification and not episode notification to avoid to many notifications

Link to comment
Share on other sites

Hello I have a suggestion.

Can we have like 2 plugins of discord notifications working together ? I want to be able to setup one to send notification about new media added to public group in my discord server and another one which is for the administrators for the users activity and server information

Link to comment
Share on other sites

Hello I have a suggestion.

Can we have like 2 plugins of discord notifications working together ? I want to be able to setup one to send notification about new media added to public group in my discord server and another one which is for the administrators for the users activity and server information

You can already do this, just not in the way you are asking

 

You have to create a new user on your server and configure notifications for that user, that way you can have notifications sent to multiple sources

 

This will be simplified in version 2

 

Let me know if you need more clarification

 

Sent from my Galaxy S10

Link to comment
Share on other sites

Sorry for few updates, I've been busy putting up with computer crap (and still am, but I needed a break before I went insane)

 

So I have a new version, addressing (I believe) all issues that have been brought up:

https://github.com/oonqt/Emby.Notifications.Discord/releases/tag/1.0.7.9

 

I am now working on version 2 which will expand the possibilities for notifications providing better integration with Discord than what's possible with Emby's build in notification system

 

Like on the original post is appreciated!

 

I'd just like to take a moment to send a HUGE thank you out to rechigo for their work on this. It's made wrangling my server a lot easier overall, and keeps people interested and informed about what's going up when they make requests and such. With a lot of my friends stuck at home, seeing those pings of new stuff has actually kept their days a bit brighter. I'm glad to do a tiny bit to make people a bit calmer right now, and this just makes that whole process painless.

 

Thank you so much!

  • Like 1
Link to comment
Share on other sites

Thanks for great update.

I can report that the problem/bug in version 1, where I would receive 4 notifications when 1 new episode was added, has been corrected in version 2

 

It is working great now.

Thank you again for a very bice plugin

  • Like 1
Link to comment
Share on other sites

thunderstorm456

Just wanted to say thanks to @@rechigo for this awesome plugin which I only discovered today. It does everything I was looking for and works brilliantly! Thanks for all your hard work, awesome effort!

  • Like 1
Link to comment
Share on other sites

Since the last Emby beta, the notifications are not getting send anymore, at least not for me. Will reboot the server to see if it helps, will generate a debug if rebooting did not help :)

Link to comment
Share on other sites

Ok guys I am not able to recreate this, tried with TV and Movies on 4.5.0.11

 

Some logs and some details on your plugin configuration will help to debug this

Link to comment
Share on other sites

I am running Emby 4.4.2.0 on a Synology NAS. Thats the Emby Package that they prepared for the Synology Package Manager.

 

I have multiple Users that are configured with Webhooks. Two don't use the enriched notifications, as they send the messages of the plugin Playback Reporting.

For now I have another user 'new_movies' that should send enriched notifications for movies.

 

This is the only error I see in the logs when adding new movies:

2020-05-26 10:10:07.876 Error App: Error in ItemAdded event handler
	*** Error Report ***
	Version: 4.4.2.0
	Command line: /var/packages/EmbyServer/target/server/EmbyServer.exe -package synology -programdata /var/packages/EmbyServer/target/var -ffmpeg /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/ffmpeg/bin/ffprobe -ffdetect /var/packages/EmbyServer/target/ffmpeg/bin/ffdetect -restartexitcode 121
	Operating system: Unix 4.4.59.0
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: False
	Mono: 6.8.0.105 (tarball Sun Apr  5 17:28:17 UTC 2020)
	Runtime: file:///volume1/@appstore/EmbyServer/3rdparty/mono/6.8.0.105/lib/mono/4.5/mscorlib.dll
	System.Environment.Version: 4.0.30319.42000
	Processor count: 2
	Program data path: /var/packages/EmbyServer/target/var
	Application directory: /volume1/@appstore/EmbyServer/releases/4.4.2.0
	System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object
	  at Emby.Server.Implementations.Library.UserManager.GetInternalId (System.Guid id) [0x00007] in <3605319732a64e8282cfdf09a091f02e>:0 
	  at Emby.Notifications.Discord.Notifier.isInVisibleLibrary (System.String UserId, MediaBrowser.Controller.Entities.BaseItem item) [0x0002d] in <e3ac83fbfa784f9ca44026146649592f>:0 
	  at Emby.Notifications.Discord.Notifier+<>c__DisplayClass17_0.<ItemAddHandler>b__0 (Emby.Notifications.Discord.Configuration.DiscordOptions options) [0x000eb] in <e3ac83fbfa784f9ca44026146649592f>:0 
	  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x0001e] in <9d3f0d4bd0fb4c1e8b6c2ac1ba1303ac>:0 
	  at Emby.Notifications.Discord.Notifier.ItemAddHandler (System.Object sender, MediaBrowser.Controller.Library.ItemChangeEventArgs changeEvent) [0x00044] in <e3ac83fbfa784f9ca44026146649592f>:0 
	  at (wrapper delegate-invoke) System.EventHandler`1[MediaBrowser.Controller.Library.ItemChangeEventArgs].invoke_void_object_TEventArgs(object,MediaBrowser.Controller.Library.ItemChangeEventArgs)
	  at Emby.Server.Implementations.Library.LibraryManager.CreateItems (System.Collections.Generic.List`1[T] items, MediaBrowser.Controller.Entities.BaseItem parent, System.Threading.CancellationToken cancellationToken) [0x00054] in <3605319732a64e8282cfdf09a091f02e>:0 
	Source: Emby.Server.Implementations
	TargetSite: Int64 GetInternalId(System.Guid)
Edited by jsflix
Link to comment
Share on other sites

I have another error message.
Half an hour ago I should have gotten a message from Playback Reporting with all the content watched since yesterday.
Looking into the logs reveals this error message:

 

2020-05-27 09:00:00.031 Info UserActivityReportNotification - TaskNotifictionReport: Activity Query : SELECT UserId, ItemType, ItemName, SUM(PlayDuration - PauseDuration) AS PlayTime FROM PlaybackActivity WHERE DateCreated > '2020-05-26 09:00:00.229616' GROUP BY UserId, ItemType, ItemName
2020-05-27 09:00:00.073 Info UserActivityReportNotification - TaskNotifictionReport: Default journal_mode for /var/packages/EmbyServer/target/var/data/playback_reporting.db is delete
2020-05-27 09:00:00.301 Info UserActivityReportNotification - TaskNotifictionReport: Cutoff DateTime for new items - date: 2020-05-26 09:00:00.229616 ago: 1.00:00:00.0717950
2020-05-27 09:00:00.301 Info UserActivityReportNotification - TaskNotifictionReport: User activity Message : ItemCount : 22
User activity since last check 1 day ago.

user1
 - (Episode) Killing Eve - s03e07 - Beautiful Monster (00:41:18)
 - (Episode) One Piece - s19e37 - The History of the Left Eye! Pedro vs. Baron Tamago (00:20:22)
 - (Episode) One Piece - s19e38 - Moist Cigarette! The Night Before Sanji's Wedding! (00:20:06)
 - (Episode) One Piece - s19e39 - The Undaunted Soul! Brook vs. Big Mom! (00:19:11)
 - (Episode) Snowpiercer - s01e02 - Prepare to Brace (00:45:08)
 - (Episode) Veep - s02e07 - Shutdown (00:26:56)
 - (Episode) World Trigger - s01e06 - Chika Amatori's Side Effect (00:00:00)

user2
 - (Episode) One Piece - s21e18 - Mysterious Grave Markers! A Reunion at the Ruins of Oden Castle! (00:22:00)
 - (Episode) One Piece - s21e19 - A Legendary Samurai! The Man Who Roger Admired! (00:20:47)
 - (Episode) One Piece - s21e20 - Bringing Down the Emperor of the Sea! A Secret Raid Operation Begins! (00:39:54)
 - (Episode) One Piece - s21e21 - The Strongest Man in the World! Shutenmaru, the Thieves Brigade Chief! (00:47:25)
 - (Episode) One Piece - s21e22 - Everyone is Annihilated! Kaido's Furious Blast Breath! (00:44:17)
 - (Episode) One Piece - s21e23 - Finally Clashing! The Ferocious Luffy vs. Kaido! (00:44:40)
 - (Episode) One Piece - s21e24 - Destructive! One Shot, One Kill: Thunder Bagua! (00:46:33)
 - (Episode) One Piece - s21e25 - A Living Hell! Luffy, Humiliated in the Great Mine! (00:46:53)
 - (Episode) One Piece - s21e26 - The Holyland in Tumult! Emperor of the Sea Blackbeard Cackles! (00:29:43)
 - (Episode) One Piece - s21e27 - It's On! The Special Operation to Bring Down Kaido! (00:21:18)
 - (Episode) One Piece - s21e28 - Rampage! The Prisoners: Luffy and Kid! (00:23:50)
 - (Episode) One Piece - s21e29 - A Great Sensation! Sanji's Special Soba! (00:26:42)
 - (Episode) One Piece - s21e30 - Luxurious and Gorgeous! Wano's Most Beautiful Woman: Komurasaki! (00:11:02)

user3
 - (Episode) Elementary - s04e20 - Art Imitates Art (00:43:49)
 - (Episode) Elementary - s04e21 - Ain't Nothing Like the Real Thing (00:42:43)


2020-05-27 09:00:00.783 Error Emby.Notifications.Discord: Failed to execute webhook: 
	*** Error Report ***
	Version: 4.4.2.0
	Command line: /var/packages/EmbyServer/target/server/EmbyServer.exe -package synology -programdata /var/packages/EmbyServer/target/var -ffmpeg /var/packages/EmbyServer/target/ffmpeg/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/ffmpeg/bin/ffprobe -ffdetect /var/packages/EmbyServer/target/ffmpeg/bin/ffdetect -restartexitcode 121
	Operating system: Unix 4.4.59.0
	64-Bit OS: True
	64-Bit Process: True
	User Interactive: False
	Mono: 6.8.0.105 (tarball Sun Apr  5 17:28:17 UTC 2020)
	Runtime: file:///volume1/@appstore/EmbyServer/3rdparty/mono/6.8.0.105/lib/mono/4.5/mscorlib.dll
	System.Environment.Version: 4.0.30319.42000
	Processor count: 2
	Program data path: /var/packages/EmbyServer/target/var
	Application directory: /volume1/@appstore/EmbyServer/releases/4.4.2.0
	System.Net.WebException: System.Net.WebException: The remote server returned an error: (400) Bad Request.
	  at System.Net.HttpWebRequest.GetResponseFromData (System.Net.WebResponseStream stream, System.Threading.CancellationToken cancellationToken) [0x00146] in <b373cc92cfb94ef6a19b4f1140645494>:0 
	  at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task`1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <b373cc92cfb94ef6a19b4f1140645494>:0 
	  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00020] in <b373cc92cfb94ef6a19b4f1140645494>:0 
	  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endAction, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in <9d3f0d4bd0fb4c1e8b6c2ac1ba1303ac>:0 
	--- End of stack trace from previous location where exception was thrown ---
	
	  at Emby.Notifications.Discord.DiscordWebhookHelper.ExecuteWebhook (Emby.Notifications.Discord.DiscordMessage message, System.String webhookUrl, MediaBrowser.Model.Serialization.IJsonSerializer _jsonSerializer) [0x0018b] in <e3ac83fbfa784f9ca44026146649592f>:0 
	  at Emby.Notifications.Discord.Notifier.QueuedMessageSender (System.Object sender, System.Timers.ElapsedEventArgs eventArgs) [0x000e6] in <e3ac83fbfa784f9ca44026146649592f>:0 
	Source: mscorlib
	TargetSite: Void Throw()

This error message repeats itself multiple times per second and until now.
I think restarting my NAS fixes this.

EDIT:
After a restart of my NAS the notification works again and there are no error messages.

 

EDIT2:
After adding another movie the error message of my previous message comes up again and I dont get an enriched notification.

Edited by jsflix
Link to comment
Share on other sites

Sorry jsflix, I have been busy for the last couple of days

 

The second error you have posted comes from a malformed webhook payload sent to discord. It's difficult to tell what caused it without looking at what data was sent to discord

 

The second error looks to stem from the item visibility checker (it determines whether or not user has access to a specific library, and if it does it will send the notification, if not, it will ignore it)

 

Let me know if this is still happening

Link to comment
Share on other sites

Sorry jsflix, I have been busy for the last couple of days

 

The second error you have posted comes from a malformed webhook payload sent to discord. It's difficult to tell what caused it without looking at what data was sent to discord

 

The second error looks to stem from the item visibility checker (it determines whether or not user has access to a specific library, and if it does it will send the notification, if not, it will ignore it)

 

Let me know if this is still happening

No worries! Thank you for your answer. As is I am totally happy with your work and if youre busy then I have to live without the extra notifications. No big deal for me! :)

My message users were indeed deactivated and had no access to my libraries.

I reactivated the new_movies user and gave him access to my movie library.

Unfortunately there are still no messages.

 

Do you know how I would get the malformed webhook payload to show up in my logs to show to you?

Link to comment
Share on other sites

 

Hello,
 
is there a manual somewhere how to install the addon? I have a Synology NAS. 

 

Are you using the Emby Package from the package center?

Because if you do you should be able to recreate my work flow for this.

I download the newest version on my pc and copy it to my shared media folder.

Then i tunnel into the NAS with an SSH connection via Putty using the credentials of my Synology user copying the Emby.Discord.Notification.dll to the plugins folder.

The plugins folder is located at '/volume1/@appstore/EmbyServer/var/plugins'.

After copying the dll-file I use chown embysvr and chmod 644 to give the needed rights.

A quick restart of Emby and then you can use the plugin.

 

If you need further assistance shoot me a private message :)

Link to comment
Share on other sites

I put the dll in the Folder: 

 

/volume1/Festplatte 1/Emby.Notifications.Discord.dll

 

then i open cmd on Windows and type

ssh admin@IP

Passwort

 

sudo-i ?

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