Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins.afreeca: Enhance quality fetching #5953

Merged

Conversation

B4TT3RY
Copy link
Contributor

@B4TT3RY B4TT3RY commented Apr 19, 2024

The QUALITY variable is currently different from AfreecaTV.

And AfreecaTV currently has some support for 1440p.

Broadcasts that support 1440p have slightly different quality names than 1080p broadcasts, so we've modified them to give you flexibility in importing them.

1080p:

sd: 360p, hd: 540p, hd4k: 720p, original: 1080p

$ streamlink --loglevel debug https://play.afreecatv.com/cotton1217
NoTagError: `git describe --long --dirty --always --tags` could not find a tag
[cli][debug] OS:         Linux-6.5.13-1-pve-x86_64-with-glibc2.39
[cli][debug] Python:     3.11.8
[cli][debug] OpenSSL:    OpenSSL 3.2.1 30 Jan 2024
[cli][debug] Streamlink: 0.0.0+unknown
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.2.2
[cli][debug]  exceptiongroup: 1.2.1
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 5.2.1
[cli][debug]  pycountry: 23.12.11
[cli][debug]  pycryptodome: 3.20.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.25.0
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  typing-extensions: 4.11.0
[cli][debug]  urllib3: 2.2.1
[cli][debug]  websocket-client: 1.7.0
[cli][debug] Arguments:
[cli][debug]  url=https://play.afreecatv.com/cotton1217
[cli][debug]  --loglevel=debug
[plugins.afreeca][debug] Restored cookies: _au, _au3rd
[cli][info] Found matching plugin afreeca for URL https://play.afreecatv.com/cotton1217
Available streams: sd (worst), hd, hd4k, original (best)

1440p:

sd: 360p, hd: 540p, hd4k: 720p, hd8k: 1080p, original: 1440p

$ streamlink --loglevel debug https://play.afreecatv.com/b13246
NoTagError: `git describe --long --dirty --always --tags` could not find a tag
[cli][debug] OS:         Linux-6.5.13-1-pve-x86_64-with-glibc2.39
[cli][debug] Python:     3.11.8
[cli][debug] OpenSSL:    OpenSSL 3.2.1 30 Jan 2024
[cli][debug] Streamlink: 0.0.0+unknown
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.2.2
[cli][debug]  exceptiongroup: 1.2.1
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 5.2.1
[cli][debug]  pycountry: 23.12.11
[cli][debug]  pycryptodome: 3.20.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.25.0
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  typing-extensions: 4.11.0
[cli][debug]  urllib3: 2.2.1
[cli][debug]  websocket-client: 1.7.0
[cli][debug] Arguments:
[cli][debug]  url=https://play.afreecatv.com/b13246
[cli][debug]  --loglevel=debug
[plugins.afreeca][debug] Restored cookies: _au, _au3rd
[cli][info] Found matching plugin afreeca for URL https://play.afreecatv.com/b13246
Available streams: sd (worst), hd, hd4k, hd8k, original (best)

Copy link
Member

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

The stream qualities can be simplified a lot by using the label data from the VIEWPRESET list items instead. Then you don't need the awkward QUALITY_WEIGHTS class attribute and the stream_weight() classmethod can be removed, too.

Keep excluding the name == "auto" case, but yield label, .... If you prefer bps instead of label, then you can use that as quality name too by appending the k suffix. Your choice. The sd, hd and original names however should go.

@bastimeyer bastimeyer added the plugin enhancement A new feature for a working Plugin label Apr 19, 2024
@B4TT3RY
Copy link
Contributor Author

B4TT3RY commented Apr 20, 2024

I don't know if this is the right way to do it. 🤔

$ streamlink --loglevel debug https://play.afreecatv.com/ecvhao
NoTagError: `git describe --long --dirty --always --tags` could not find a tag
[cli][debug] OS:         Linux-6.5.13-1-pve-x86_64-with-glibc2.39
[cli][debug] Python:     3.11.8
[cli][debug] OpenSSL:    OpenSSL 3.2.1 30 Jan 2024
[cli][debug] Streamlink: 0.0.0+unknown
[cli][debug] Dependencies:
[cli][debug]  certifi: 2024.2.2
[cli][debug]  exceptiongroup: 1.2.1
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 5.2.1
[cli][debug]  pycountry: 23.12.11
[cli][debug]  pycryptodome: 3.20.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.25.0
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  typing-extensions: 4.11.0
[cli][debug]  urllib3: 2.2.1
[cli][debug]  websocket-client: 1.7.0
[cli][debug] Arguments:
[cli][debug]  url=https://play.afreecatv.com/ecvhao
[cli][debug]  --loglevel=debug
[plugins.afreeca][debug] Restored cookies: _au, _au3rd
[cli][info] Found matching plugin afreeca for URL https://play.afreecatv.com/ecvhao
Available streams: 360p (worst), 540p, 720p, 1080p (best)

src/streamlink/plugins/afreeca.py Outdated Show resolved Hide resolved
src/streamlink/plugins/afreeca.py Outdated Show resolved Hide resolved
@bastimeyer bastimeyer force-pushed the plugins/afreeca/enhance-quality-fetching branch from 7bcc04d to 5b16ae5 Compare April 20, 2024 15:23
@bastimeyer bastimeyer merged commit 3c8e2dc into streamlink:master Apr 20, 2024
23 checks passed
@bastimeyer
Copy link
Member

Thanks for the PRs.

I've rebased both of your PRs and fixed the merge conflicts for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin enhancement A new feature for a working Plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants