iamkroot / trakt-scrobbler

Scrobbler for trakt.tv that supports VLC, Plex, MPC-HC, and MPV.
https://github.com/iamkroot/trakt-scrobbler/wiki
GNU General Public License v2.0
464 stars 30 forks source link

[BUG] Log spam when failing to connect to Plex #314

Closed BrutuZ closed 2 months ago

BrutuZ commented 2 months ago

Describe the bug

Log is indefinitely spammed with two connection error warnings every ~14 seconds, bloating and rotating the file every couple of hours or so without even playing anything.

What should Happen

Graceful handling of unavailable connection, similar to how the MPC-HC monitor does it, only printing a single INFO-level line.

Desktop (please complete the following information):

To Reproduce

Steps to reproduce the behavior:

  1. Just setup both players in the config.yaml
    version: "1.0"
    players:
    monitored:
    - mpc-hc
    - plex
  2. Start trakt-scrobbler without either MPC or Plex running
  3. Watch the log fill

Log file

Click to see log contents

``` 2024-09-12 20:05:37,931 - DEBUG - MainThread - notifier - Notifications enabled for categories: exception, misc, scrobble.start, scrobble.stop, trakt 2024-09-12 20:05:37,935 - INFO - notify_loop - notifier - Starting notif loop 2024-09-12 20:05:37,935 - DEBUG - MainThread - notifier - Notif actions enabled for categories: 2024-09-12 20:05:38,197 - DEBUG - MainThread - mediainfo_remap - Read 12 remap rules from remap_rules.toml 2024-09-12 20:05:38,201 - INFO - MainThread - scrobbler - Started scrobbler thread. 2024-09-12 20:05:38,218 - INFO - MainThread - monitor - Started monitor for plex 2024-09-12 20:05:38,219 - DEBUG - MainThread - monitor - Autoloaded mpc-hc port = 13579 2024-09-12 20:05:38,220 - INFO - MainThread - monitor - Started monitor for mpc-hc 2024-09-12 20:05:42,318 - INFO - mpc-hc - monitor - Unable to connect to mpc-hc. Ensure that the web interface is running. 2024-09-12 20:05:42,319 - ERROR - plex - utils - Failed to connect: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: /status/sessions (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) 2024-09-12 20:05:42,320 - DEBUG - plex - utils - Request: get {'url': 'http://localhost:32400/status/sessions'} 2024-09-12 20:05:56,402 - ERROR - plex - utils - Failed to connect: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: /status/sessions (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) 2024-09-12 20:05:56,402 - DEBUG - plex - utils - Request: get {'url': 'http://localhost:32400/status/sessions'} 2024-09-12 20:06:10,487 - ERROR - plex - utils - Failed to connect: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: /status/sessions (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) 2024-09-12 20:06:10,488 - DEBUG - plex - utils - Request: get {'url': 'http://localhost:32400/status/sessions'} 2024-09-12 20:06:24,549 - ERROR - plex - utils - Failed to connect: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: /status/sessions (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) 2024-09-12 20:06:24,551 - DEBUG - plex - utils - Request: get {'url': 'http://localhost:32400/status/sessions'} 2024-09-12 20:06:38,626 - ERROR - plex - utils - Failed to connect: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: /status/sessions (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) 2024-09-12 20:06:38,627 - DEBUG - plex - utils - Request: get {'url': 'http://localhost:32400/status/sessions'} 2024-09-12 20:06:52,700 - ERROR - plex - utils - Failed to connect: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: /status/sessions (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) 2024-09-12 20:06:52,700 - DEBUG - plex - utils - Request: get {'url': 'http://localhost:32400/status/sessions'} (...) ```