Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Fix AlertListener on IPv6-aware hosts and prevent YoutubeDL from making the plugin hang #196

Closed
wants to merge 11 commits into from

Conversation

zdimension
Copy link
Collaborator

@zdimension zdimension commented Nov 6, 2023

Description

  • on many Linux machines, localhost resolves to ::1. The websocket module used here expects an AF_INET address, so it expectedly crashes when passed an IPv6 address such as ::1. The default URL used for reaching Plex is modified to 127.0.0.1 to prevent this.
  • no code was present to handle YoutubeDL raising an exception. If such a case were to happen previously, the whole thread would crash; in practice this means that if any movie in the library can't be downloaded for any reason, the worker thread trying to download it will crash and stop processing any more content. In the worst case (e.g. mine) you can end up with all threads hung. Refreshing metadata or restarting the plugin doesn't change anything, the problem is logical and deterministic. Errors are now handled properly and printed to the plugin logs, and the process can continue.
  • also, a typo in the YoutubeDL call is fixed (outmpl -> outtmpl)

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@CLAassistant
Copy link

CLAassistant commented Nov 6, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@ReenigneArcher ReenigneArcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

There's a simpler way to use the plugin logger.

Can you think of some way to force/test this exception situation?

Contents/Code/youtube_dl_helper.py Outdated Show resolved Hide resolved
Contents/Code/youtube_dl_helper.py Show resolved Hide resolved
Contents/Code/youtube_dl_helper.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #196 (b7ecf58) into nightly (15099a5) will increase coverage by 0.24%.
The diff coverage is 90.90%.

❗ Current head b7ecf58 differs from pull request most recent head 85dc094. Consider uploading reports for the commit 85dc094 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           nightly     #196      +/-   ##
===========================================
+ Coverage    68.97%   69.22%   +0.24%     
===========================================
  Files           10       10              
  Lines          735      744       +9     
===========================================
+ Hits           507      515       +8     
- Misses         228      229       +1     
Flag Coverage Δ
Linux 69.22% <90.90%> (+0.24%) ⬆️
Windows 27.82% <36.36%> (-37.90%) ⬇️
macOS 27.82% <36.36%> (-41.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
Contents/Code/plex_api_helper.py 53.28% <100.00%> (ø)
Contents/Code/youtube_dl_helper.py 86.00% <90.00%> (+0.63%) ⬆️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

youtube-dl logs are going to system/container log AlertListener does not work with some hosts on Linux
3 participants