nwithan8 / tauticord

A Discord bot that displays live data from Tautulli
GNU General Public License v3.0
107 stars 22 forks source link

Voice Channel Not Being Created & Kill Not Working #123

Closed townsmcp closed 1 year ago

townsmcp commented 1 year ago

Hi, I have finally got round to installing Tauticord. I managed to get the new channel created, and it is mostly working (apart from killing a stream - see issues below):

Killing a stream:

Voice Channel:

Configuration:

Logs:

The following are the start up logs:

2023-07-24 11:46:18,418 - [INFO]: Starting Tauticord...
DEBUG:Connected to Tautulli version: v2.12.5
2023-07-24 11:46:18,447 - [INFO]: Connecting to Discord...
INFO:Connecting to Discord...
[2023-07-24 11:46:18] [INFO    ] discord.client: logging in using static token
INFO:logging in using static token
[2023-07-24 11:46:19] [INFO    ] discord.gateway: Shard ID None has connected to Gateway (Session ID: <REDACTED>).
INFO:Shard ID None has connected to Gateway (Session ID:  <REDACTED>).
2023-07-24 11:46:21,591 - [INFO]: Connected to Discord.
INFO:Connected to Discord.
2023-07-24 11:46:21,591 - [INFO]: Uploading required resources...
INFO:Uploading required resources...
2023-07-24 11:46:21,592 - [INFO]: Loading Tautulli text settings...
INFO:Loading Tautulli text settings...
2023-07-24 11:46:21,592 - [INFO]: Getting "tauticord" channel
INFO:Getting "tauticord" channel
2023-07-24 11:46:21,592 - [INFO]: "tauticord" channel collected.
INFO:"tauticord" channel collected.
2023-07-24 11:46:22,283 - [INFO]: Loading Tautulli voice settings...
INFO:Loading Tautulli voice settings...
2023-07-24 11:46:22,283 - [INFO]: Loading Tautulli summary service...
INFO:Loading Tautulli summary service...
2023-07-24 11:46:22,283 - [INFO]: Starting Tautulli library stats service...
INFO:Starting Tautulli library stats service...
DEBUG:JSON returned by GET request: {'stream_count': '0', 'sessions': [], 'stream_count_direct_play': 0, 'stream_count_direct_stream': 0, 'stream_count_transcode': 0, 'total_bandwidth': 0, 'lan_bandwidth': 0, 'wan_bandwidth': 0}
DEBUG:Count: 0
DEBUG:Using old message...
nwithan8 commented 1 year ago

Looking into the stream number issue.

The voice channels are not created because you have not enabled any of them in your configuration (see the Environmental Variables section of the README of this repository for details).

townsmcp commented 1 year ago

@nwithan8 so if I am reading Voice Channels correctly, it is saying to add a config section titled TC_VC_STATS_CATEGORY_NAME for auto-management by Tauticord which I have done with a value of Tautulli Stats: image However after redeploying the container no new voice channel created. Do I need to wait an hour for stats to be pulled or are they updated after the first deployment, then updated an hour later?

nwithan8 commented 1 year ago

You need to enable each voice channel option (e.g. TC_VC_STREAM_COUNT) with True.

nwithan8 commented 1 year ago

@townsmcp I can't immediately see any issue in the code for the stream stop bug you're running into. Could you recreate the bug and send me the relevant logs?

townsmcp commented 1 year ago

@nwithan8 here are the logs - I think the first few lines are the only relevant info but included others just in case:

023-07-25 12:32:48,636 - [INFO]: Updating Plex Status voice channel with new status: Online
INFO:Updating Plex Status voice channel with new status: Online
2023-07-25 12:32:48,974 - [INFO]: Updating Streams voice channel with new stream count: 1
INFO:Updating Streams voice channel with new stream count: 1
2023-07-25 12:32:49,187 - [INFO]: Updating Bandwidth voice channel with new bandwidth: 3.8 Mbps
INFO:Updating Bandwidth voice channel with new bandwidth: 3.8 Mbps
2023-07-25 12:32:49,380 - [INFO]: Updating Local Bandwidth voice channel with new bandwidth: 0.0 bps
INFO:Updating Local Bandwidth voice channel with new bandwidth: 0.0 bps
2023-07-25 12:32:49,608 - [INFO]: Updating Remote Bandwidth voice channel with new bandwidth: 3.8 Mbps
INFO:Updating Remote Bandwidth voice channel with new bandwidth: 3.8 Mbps
DEBUG:Using old message...
DEBUG:Editing old message...
DEBUG:Stopping stream 1️⃣...
2023-07-25 12:33:03,104 - [INFO]: **Invalid stream number.**
INFO:**Invalid stream number.**
DEBUG:JSON returned by GET request: {'stream_count': '1', 'sessions': [{'session_key': '58', 'media_type': 'episode', 'view_offset': '1468332', 'progress_percent': '42', 'quality_profile': 'Original', 'synced_version_profile': '', 'optimized_version_profile': '', 'user': 'townsmcp', 'channel_stream': 0, 'section_id': '1', 'library_name': 'TV', 'rating_key': '22794', 'parent_rating_key': '22792', 'grandparent_rating_key': '20088', 'title': 'Kaer Morhen', 'parent_title': 'Season 2', 'grandparent_title': 'The Witcher', 'original_title': '', 'sort_title': '', 'edition_title': '', 'media_index': '2', 'parent_media_index': '2', 'studio': 'Sean Daniel Company', 'content_rating': 'gb/18', 'summary': "Seeking a safe place for Ciri, Geralt heads for home, but danger lurks everywhere — even Kaer Morhen. Yennefer's dreams could be the key to her freedom.", 'tagline': '', 'rating': '', 'rating_image': '', 'audience_rating': '7.0', 'audience_rating_image': 'themoviedb://image.rating', 'user_rating': '', 'duration': '3508832', 'year': '2021', 'parent_year': '2021', 'grandparent_year': '2019', 'thumb': '/library/metadata/22794/thumb/1688721180', 'parent_thumb': '/library/metadata/22792/thumb/1688721180', 'grandparent_thumb': '/library/metadata/20088/thumb/1688721178', 'art': '/library/metadata/20088/art/1688721178', 'banner': '', 'originally_available_at': '2021-12-17', 'added_at': '1675811903', 'updated_at': '1688721180', 'last_viewed_at': '1690212016', 'guid': 'plex://episode/60e9c7039e30a3002c9f36fc', 'parent_guid': 'plex://season/60e9c7039e30a3002c9f36f5', 'grandparent_guid': 'plex://show/5d9c08e6ba6eb9001fbac2b1', 'directors': ['Stephen Surjik'], 'writers': ['Beau DeMayo'], 'actors': ['Henry Cavill', 'Anya Chalotra', 'Freya Allan', 'Mimî M. Khayisa', 'MyAnna Buring', 'Eamon Farren', 'Wilson Radjou-Pujalte', 'Tristan Mamasakhlisashvili', 'Anna Shaffer', 'Royce Pierreson', 'Tom Canton', 'Joey Batey', 'Mecia Simson', 'Bart Edwards', 'Graham McTavish', 'Lars Mikkelsen', 'Cassie Clare', 'Hugh Skinner', 'Kim Bodnia', 'Therica Wilson-Read', 'Terence Maynard', 'Mahesh Jadu', 'Ed Birch', 'Kaine Zajaz', 'Paul Bullion', 'Yasen Atour', 'Nathanial Jacobs', 'Aisha Fabienne Ross', 'Jodhi May', 'Ania Marson', 'Jota Castellano', 'Chuey Okoye', 'Shaun Dooley', 'Chris Fulton', 'Björn Hlynur Haraldsson', 'Judit Fekete', 'Máté Haumann', 'Rachel Prieto', 'Jeremy Crawford', 'Antony Byrne', 'Gaia Mondadori', 'Robbie Amell', 'Sam Woolf', 'Cal Watson', 'Josette Simon', 'Tobi Bamtefa', 'Maciej Musiał', 'Anna-Louise Plowman', 'Emma Appleton', 'Nóra Trokán', 'Martin Berencsy', 'Imogen Daines', 'Sonny Ashbourne Serkis', 'Sam Hazeldine', 'Simon Callow', 'Liz Carr', 'Adjoa Andoh', 'Basil Eidenbenz', 'Lilly Cooper', 'Luke CY', 'Rebecca Hanssen', 'Richard Tirado', 'Ged Forrest', 'Tracy-Ann Oberman', 'Safiyya Ingar', 'Frances Pooley', 'Jim Sturgeon', 'Rochelle Rose', 'Nathan Amarkwei', 'Gloria Adereti', 'Josh Weller', 'Poppy Almond', 'Philip Philmar', 'Harvey Quinn', 'Ryan Hayes', 'Bernhard Fuchs', 'Packy Lee', 'Mia McKenna-Bruce', 'Atanáz Babinchak', 'Krisztián Csákvári', 'Szandra Asztalos', 'Eliza Varga', 'Rebeka Balogh', 'Andrea M. Simon', 'Jade Croot', 'Sam Marks', 'Andrey Kurganov', 'Julian Rhind-Tutt', 'Jason Thorpe', 'Katia Bokor', 'Gudmundur Thorvaldsson', 'Ben Lambert', 'Declan Hannigan', 'Owen Good', 'Ossian Perret', 'Wayne Cater', 'Isobel Laidler', 'Ben Wiggins', 'Lucas Englander', 'Richard van Weyden', 'Philippe Spall', 'Roger Ringrose', 'Jordan Renzo', 'Stephen Wall', 'Adele Oni', 'Ron Cook', 'Colette Dalal Tchantcho', 'Anna Burnett', 'Ella-Rae Smith', 'Rob Malone', 'Joshua Higgott', 'Lu Corfield', 'Jim Caesar', 'Jack Wolfe', 'Jack Bandeira', 'Tristan Ruggeri', 'Francis Magee', 'Frida Gustavsson', 'Rhianna McGreevy', "Charlotte O'Leary", 'Matt Devere', 'Natasha Culzac', 'Pető Kata', 'Alexandra Szucs', 'Blair Kincaid', 'Amit Shah', 'Dónal Finn', 'Levente Lippai', 'Sándor Köleséri', 'Pál Fedinecz', 'Kristofer Hivju', 'Szofi Berki', 'Agnes Born', 'Balázs Szitás', 'Roderick Hill', 'Melissandre St. Hilaire', 'John Cummins', 'Radhouane Ayari', 'Lesley Ewen', 'Veronika Varga', 'Zsófia Miklós', 'Andrew Paul', 'Kristóf Widder', 'Péter Fancsikai', 'Blanka Herbály', 'Eper Stinner', 'Bogdan Iancu', 'Leigh Gill', 'Tamas Olt', 'Scott Alexander Young', 'Becky Wright', 'Dominic Creasy', 'David Broughton-Davies', 'Marcin Czarnik', 'Gábor Perei', 'Ross Telfer', 'Adam Zambryzcki', 'Anita Olatunji', 'Joachim Paul Assböck', 'Martin Angerbauer', 'Raquel Amegashie', 'Callum Coates', 'Anneke Weerts', 'Kevin Howarth', 'Wayne Brett', 'Michael Power', 'Michael Byrch', 'Benjamin Chaffin', 'Simeon Dyer', 'Michael Keane', 'Kain Francis', 'Viola Prettejohn', 'Paul Kynman', 'Howard Chadwick', 'Louis Boyer', 'Roland Tzafetás', 'Iván Lengyel', 'Barnabás Kovács-Szégner', 'Theo James', 'Carmel Laniado', 'Lizzie Clarke', 'Shannon Murray', 'Edward Rowe', 'Joseph Payne', 'Lucy Sheen', 'Ann Firbank', 'Magnus Samuelsson', 'Scarlett Maltman', 'Kevin Doyle', 'Jamal Ajala', 'James Eeles', 'Alastair Parker', 'Vernon Dobtcheff', 'Richard Cunningham', 'Donnie Baxter', 'Julianna Kurokawa', 'Tim Samuels', 'Dermot Daly', 'Ian Alexander', 'Michele Moran'], 'genres': ['Drama', 'Action', 'Adventure', 'Fantasy', 'Mystery', 'Sci-Fi & Fantasy'], 'labels': [], 'collections': [], 'guids': ['imdb://tt11654982', 'tmdb://3063820', 'tvdb://8544480'], 'markers': [{'id': 64866, 'type': 'credits', 'start_time_offset': 3259948, 'end_time_offset': 3508832, 'first': True, 'final': True}], 'parent_guids': ['tvdb://1934108'], 'grandparent_guids': ['imdb://tt5180504', 'tmdb://71912', 'tvdb://362696'], 'full_title': 'The Witcher - Kaer Morhen', 'children_count': 0, 'live': 0, 'id': '', 'container': 'mkv', 'bitrate': '2923', 'height': '720', 'width': '1280', 'aspect_ratio': '1.78', 'video_codec': 'h264', 'video_resolution': '720', 'video_full_resolution': '720p', 'video_framerate': '24p', 'video_profile': 'main', 'audio_codec': 'eac3', 'audio_channels': '6', 'audio_channel_layout': '5.1(side)', 'audio_profile': '', 'optimized_version': 0, 'channel_call_sign': '', 'channel_identifier': '', 'channel_thumb': '', 'file': '/mnt/Media/tv/The Witcher (2019) {imdb-tt5180504}/Season 02/The Witcher (2019) - S02E02 - Kaer Morhen [Release Sources (Streaming Service)_5_4 Release Sources (Streaming Service)_5_5 WEBDL-720p][EAC3 Atmos 5.1][x264]-NTb.mkv', 'file_size': '1283635646', 'indexes': 1, 'selected': 1, 'type': '', 'video_codec_level': '31', 'video_bitrate': '2153', 'video_bit_depth': '8', 'video_chroma_subsampling': '4:2:0', 'video_color_primaries': '', 'video_color_range': '', 'video_color_space': '', 'video_color_trc': '', 'video_dynamic_range': 'SDR', 'video_frame_rate': '24.000', 'video_ref_frames': '3', 'video_height': '720', 'video_width': '1280', 'video_language': '', 'video_language_code': '', 'video_scan_type': 'progressive', 'audio_bitrate': '768', 'audio_bitrate_mode': '', 'audio_sample_rate': '48000', 'audio_language': 'English', 'audio_language_code': 'eng', 'subtitle_codec': '', 'subtitle_container': '', 'subtitle_format': '', 'subtitle_forced': 0, 'subtitle_location': '', 'subtitle_language': '', 'subtitle_language_code': '', 'row_id': 2, 'user_id': 57946, 'username': 'townsmcp', 'friendly_name': 'townsmcp', 'user_thumb': 'https://plex.tv/users/1db170134f1f7ec7/avatar?c=1661526794', 'email': 'james.townsend79@outlook.com', 'is_active': 1, 'is_admin': 1, 'is_home_user': 1, 'is_allow_sync': 1, 'is_restricted': 0, 'do_notify': 1, 'keep_history': 1, 'deleted_user': 0, 'allow_guest': 0, 'shared_libraries': ['2', '8', '1'], 'last_seen': None, 'ip_address': '192.168.1.1', 'ip_address_public': '192.168.1.1', 'device': 'iPhone', 'platform': 'iOS', 'platform_name': 'ios', 'platform_version': '16.5.1', 'product': 'Plex for iOS', 'product_version': '8.23', 'profile': 'iOS', 'player': 'iPhone', 'machine_id': '4DC65023-238A-4E66-A92C-99C3876D12DF', 'state': 'playing', 'local': 0, 'relayed': 0, 'secure': 1, 'session_id': '4DC65023-238A-4E66-A92C-99C3876D12DF', 'bandwidth': '3853', 'location': 'wan', 'transcode_key': '', 'transcode_throttled': 0, 'transcode_progress': 0, 'transcode_speed': '', 'transcode_audio_channels': '', 'transcode_audio_codec': '', 'transcode_video_codec': '', 'transcode_width': '', 'transcode_height': '', 'transcode_container': '', 'transcode_protocol': '', 'transcode_min_offset_available': 0, 'transcode_max_offset_available': 0, 'transcode_hw_requested': 0, 'transcode_hw_decode': '', 'transcode_hw_decode_title': '', 'transcode_hw_encode': '', 'transcode_hw_encode_title': '', 'transcode_hw_full_pipeline': 0, 'audio_decision': 'direct play', 'video_decision': 'direct play', 'subtitle_decision': '', 'throttled': '0', 'transcode_hw_decoding': 0, 'transcode_hw_encoding': 0, 'stream_container': 'mkv', 'stream_bitrate': '2923', 'stream_aspect_ratio': '1.78', 'stream_video_framerate': '24p', 'stream_video_resolution': '720', 'stream_duration': '3508832', 'stream_container_decision': 'direct play', 'optimized_version_title': '', 'synced_version': 0, 'live_uuid': '', 'bif_thumb': '/library/parts/58103/indexes/sd/1468332', 'subtitles': 0, 'transcode_decision': 'direct play', 'container_decision': 'direct play', 'stream_video_full_resolution': '720p', 'stream_video_bitrate': '2153', 'stream_video_bit_depth': '8', 'stream_video_chroma_subsampling': '4:2:0', 'stream_video_codec': 'h264', 'stream_video_codec_level': '31', 'stream_video_color_primaries': '', 'stream_video_color_range': '', 'stream_video_color_space': '', 'stream_video_color_trc': '', 'stream_video_dynamic_range': 'SDR', 'stream_video_height': '720', 'stream_video_width': '1280', 'stream_video_ref_frames': '3', 'stream_video_language': '', 'stream_video_language_code': '', 'stream_video_scan_type': 'progressive', 'stream_video_decision': 'direct play', 'stream_audio_bitrate': '768', 'stream_audio_bitrate_mode': '', 'stream_audio_channels': '6', 'stream_audio_channel_layout': '5.1(side)', 'stream_audio_codec': 'eac3', 'stream_audio_sample_rate': '48000', 'stream_audio_channel_layout_': '5.1(side)', 'stream_audio_language': 'English', 'stream_audio_language_code': 'eng', 'stream_audio_decision': 'direct play', 'stream_subtitle_codec': '', 'stream_subtitle_container': '', 'stream_subtitle_format': '', 'stream_subtitle_forced': 0, 'stream_subtitle_location': '', 'stream_subtitle_language': '', 'stream_subtitle_language_code': '', 'stream_subtitle_decision': '', 'stream_subtitle_transient': 0}], 'stream_count_direct_play': 1, 'stream_count_direct_stream': 0, 'stream_count_transcode': 0, 'total_bandwidth': 3853, 'lan_bandwidth': 0, 'wan_bandwidth': 3853}
DEBUG:Count: 1
2023-07-25 12:33:07,375 - [INFO]: Updating Plex Status voice channel with new status: Online
INFO:Updating Plex Status voice channel with new status: Online
2023-07-25 12:33:07,587 - [INFO]: Updating Streams voice channel with new stream count: 1
INFO:Updating Streams voice channel with new stream count: 1
2023-07-25 12:33:07,995 - [INFO]: Updating Bandwidth voice channel with new bandwidth: 3.8 Mbps
INFO:Updating Bandwidth voice channel with new bandwidth: 3.8 Mbps
2023-07-25 12:33:08,246 - [INFO]: Updating Local Bandwidth voice channel with new bandwidth: 0.0 bps
INFO:Updating Local Bandwidth voice channel with new bandwidth: 0.0 bps
2023-07-25 12:33:08,487 - [INFO]: Updating Remote Bandwidth voice channel with new bandwidth: 3.8 Mbps
INFO:Updating Remote Bandwidth voice channel with new bandwidth: 3.8 Mbps
nwithan8 commented 1 year ago

@townsmcp The stream number issue has been fixed in the latest release, thanks for reporting the issue!

townsmcp commented 1 year ago

@nwithan8 I have updated to the new release but still get the same issue:

https://github.com/nwithan8/tauticord/assets/14061617/cf19487a-1e15-4d66-b7ad-ab611e1bf9d3 Also, not sure if it means anything, but I dont have any custom emojis. Also, in the log I just noticed this rate limiting (dont know if it has been there before today):

INFO:Updating Streams voice channel with new stream count: 1
[2023-07-27 08:25:56] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1133052505597677689 responded with 429. Retrying in 230.07 seconds.
WARNING:We are being rate limited. PATCH https://discord.com/api/v10/channels/1133052505597677689 responded with 429. Retrying in 230.07 seconds.
nwithan8 commented 1 year ago

@nwithan8 I have updated to the new release but still get the same issue:

https://github.com/nwithan8/tauticord/assets/14061617/cf19487a-1e15-4d66-b7ad-ab611e1bf9d3 Also, not sure if it means anything, but I dont have any custom emojis. Also, in the log I just noticed this rate limiting (dont know if it has been there before today):

INFO:Updating Streams voice channel with new stream count: 1
[2023-07-27 08:25:56] [WARNING ] discord.http: We are being rate limited. PATCH https://discord.com/api/v10/channels/1133052505597677689 responded with 429. Retrying in 230.07 seconds.
WARNING:We are being rate limited. PATCH https://discord.com/api/v10/channels/1133052505597677689 responded with 429. Retrying in 230.07 seconds.

The last "fix" was half-implemented, hopefully the new version I just pushed out (v3.10.5) will address it for Nitro and non-Nitro users (it did in testing).

Discord will sometimes rate-limit you if the bot is doing too much too quickly. Unfortunate side-effect of how many channels and data the bot is doing every few seconds. The Docker container and bot are built to automatically restart if it gets hit with a rate limit.

townsmcp commented 1 year ago

@nwithan8 thank you. I don’t have Nitro but that update did work to kill the stream