feature/hls: Add HLS playback support, and refactors documentation for better usability and maintainability. #1

Merged
heckyel merged 15 commits from feature/hls into master 2026-04-20 01:22:56 -04:00
Owner

Overview

This PR introduces HLS playback support, improves the player experience, and refactors documentation for better usability and maintainability.

Key Features

HLS Playback Support

  • Add HLS integration via new JavaScript assets:
    • hls.min.js
    • plyr.hls.start.js
    • watch.hls.js
  • Separate DASH and HLS logic:
    • plyr-start.jsplyr.dash.start.js
    • watch.jswatch.dash.js
  • Update templates (embed.html, watch.html) for conditional player loading

Native Storyboard Preview

  • Add native_player_storyboard setting in settings.py
  • Implement hover thumbnail preview for native player modes
  • Add storyboard-preview.js

UI and Player Adjustments

  • Update templates and styles (custom_plyr.css)
  • Modify backend modules to support new player modes:
    • watch.py, channel.py, util.py, and related components

Internationalization

  • Update translation files:
    • messages.po
    • messages.pot

Testing and CI

  • Add and update tests:
    • test_shorts.py
    • test_util.py
  • Minor CI and release script improvements

Documentation

OpenRC Service Guide Rewrite

  • Restructure docs/basic-script-openrc/README.md into:
    • Prerequisites
    • Installation
    • Service Management
    • Verification
    • Troubleshooting
  • Add admonition blocks:
    • [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION]
  • Fix log inspection command:
    doas tail -f /var/log/ytlocal.log
    
  • Add path placeholders and clarify permission requirements
  • Remove legacy and duplicate content
## Overview This PR introduces HLS playback support, improves the player experience, and refactors documentation for better usability and maintainability. ## Key Features ### HLS Playback Support - Add HLS integration via new JavaScript assets: - `hls.min.js` - `plyr.hls.start.js` - `watch.hls.js` - Separate DASH and HLS logic: - `plyr-start.js` → `plyr.dash.start.js` - `watch.js` → `watch.dash.js` - Update templates (`embed.html`, `watch.html`) for conditional player loading ### Native Storyboard Preview - Add `native_player_storyboard` setting in `settings.py` - Implement hover thumbnail preview for native player modes - Add `storyboard-preview.js` ### UI and Player Adjustments - Update templates and styles (`custom_plyr.css`) - Modify backend modules to support new player modes: - `watch.py`, `channel.py`, `util.py`, and related components ### Internationalization - Update translation files: - `messages.po` - `messages.pot` ### Testing and CI - Add and update tests: - `test_shorts.py` - `test_util.py` - Minor CI and release script improvements ## Documentation ### OpenRC Service Guide Rewrite - Restructure `docs/basic-script-openrc/README.md` into: - Prerequisites - Installation - Service Management - Verification - Troubleshooting - Add admonition blocks: - `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, `[!CAUTION]` - Fix log inspection command: ```bash doas tail -f /var/log/ytlocal.log ```` * Add path placeholders and clarify permission requirements * Remove legacy and duplicate content
heckyel added 12 commits 2026-04-19 23:59:00 -04:00
- Add continuation_token_cache to store ctokens between page requests
- Use cached ctoken for page 2+ instead of generating fresh tokens
- Switch shorts/streams to Next/Previous buttons (no page numbers)
- Show "N+ videos" indicator when more pages are available
- Fix UnboundLocalError when page_call was undefined for shorts/streams

The issue was that YouTube's InnerTube API requires continuation tokens
for pagination on shorts/streams tabs, but the code was generating a new
ctoken each time, always returning the same 30 videos.
- Auto-select "Original" audio track by default in both native and Plyr HLS players
- Fix native HLS audio selector to use numeric indices instead of string matching
- Robustly detect "original" track by checking both `name` and `lang` attributes
- Fix audio track change handler to correctly switch between available tracks
fix(playlists): make playlist parsing robust against filename and formatting issues
All checks were successful
CI / test (push) Successful in 53s
3795d9e4ff
- Use glob lookup to find playlist files even with trailing spaces in filenames
- Sanitize lines (strip whitespace) before JSON parsing to ignore trailing spaces/empty lines
- Handle JSONDecodeError gracefully to prevent 500 errors from corrupt entries
- Return empty list on FileNotFoundError in read_playlist instead of crashing
- Extract _find_playlist_path and _parse_playlist_lines helpers for reuse
feat(channels): fix pagination for "Sorted by newest - no shorts"
Some checks failed
CI / test (push) Has been cancelled
5577e9e1f2
Replace UU-uploads playlist workaround (proto field 104) with direct
requests to the channel Videos tab API (tab="videos"), aligning with
Invidious content-type handling. This restores proper continuation
tokens and stable pagination (~30 videos per page).

Update display logic:
- Show channel total upload count as an upper-bound while continuation
  tokens exist.
- On final page, display exact fetched video count.
- Ensure page number never falls below current page (fix page reset to "1").

Maintain separate handling:
- Shorts and streams tabs continue using tab-specific continuation tokens.

Add test:
- TestChannelCtokenV5::test_include_shorts_false_adds_filter

Fixes issue where channels with many Shorts (e.g., Celine Dept) showed
only a few videos and broken pagination under "no shorts" sorting.
fix(settings): add AST compatibility for Python 3.12+
All checks were successful
CI / test (push) Successful in 1m5s
155bd4df49
- Use `ast.Constant` as primary node for Python 3.8+
- Maintain backward compatibility with `ast.Num`, `ast.Str`, and `ast.NameConstant`
- Prevent crashes on Python 3.12 where legacy nodes were removed
- Add safe handling via `try/except AttributeError`
Core changes:

* enforce HTTPS URLs and remove shell usage in generate_release.py
* replace os.system calls with subprocess across the codebase
* validate external inputs (playlist names, video IDs)

Improvements and fixes:

* settings.py: fix typo (node.lineno → line_number); use isinstance() over type()
* youtube/get_app_version: improve git detection using subprocess.DEVNULL
* youtube/util.py: add cleanup helpers; use shutil.which for binary resolution

YouTube modules:

* watch.py: detect and flag HLS streams; remove unused audio_track_sources
* comments.py: return early when comments are disabled; add error handling
* local_playlist.py: validate playlist names to prevent path traversal
* subscriptions.py: replace asserts with proper error handling; validate video IDs

Cleanup:

* remove unused imports across modules (playlist, search, channel)
* reorganize package imports in youtube/**init**.py
* simplify test imports and fix cleanup_func in tests

Tests:

* tests/test_shorts.py: simplify imports
* tests/test_util.py: fix cleanup_func definition
docs: update README.md
All checks were successful
CI / test (push) Successful in 1m1s
b320127f16
feat: add native player storyboard preview option
All checks were successful
CI / test (push) Successful in 45s
3fe256ce29
- Introduced `native_player_storyboard` setting with default disabled.
- Updated templates to conditionally load the storyboard preview script only for native players.
- Added descriptive comments for the new setting and template blocks.
docs: improve service guide and clarity
All checks were successful
CI / test (push) Successful in 1m35s
CI / test (pull_request) Successful in 1m41s
bd008ebf91
Restructure README, add admonitions, fix log command,
and refine script comments and safety notes.
heckyel changed title from feature/hls: Add HLS playback support, improves the player experience, and refactors documentation for better usability and maintainability. to WIP: feature/hls: Add HLS playback support, improves the player experience, and refactors documentation for better usability and maintainability. 2026-04-20 00:00:58 -04:00
heckyel changed title from WIP: feature/hls: Add HLS playback support, improves the player experience, and refactors documentation for better usability and maintainability. to feature/hls: Add HLS playback support, improves the player experience, and refactors documentation for better usability and maintainability. 2026-04-20 00:01:09 -04:00
heckyel changed title from feature/hls: Add HLS playback support, improves the player experience, and refactors documentation for better usability and maintainability. to feature/hls: Add HLS playback support, and refactors documentation for better usability and maintainability. 2026-04-20 00:01:55 -04:00
heckyel added 1 commit 2026-04-20 00:11:27 -04:00
chore(release): update to v0.5.0
All checks were successful
CI / test (push) Successful in 47s
CI / test (pull_request) Successful in 47s
13bdab41db
Bump version in `version.py` to v0.5.0
heckyel added 1 commit 2026-04-20 01:02:19 -04:00
refactor: convert download dropdown to valid W3C table
All checks were successful
CI / test (push) Successful in 46s
CI / test (pull_request) Successful in 45s
7a3c92820c
- Replace ul/li structure with semantic table (thead/tbody)
- Add 6 columns: Ext, Video, Audio, Size, Codecs, Link
- Show "N/A" for missing codec data
- Add 0.5rem spacing between dropdown and description
heckyel added 1 commit 2026-04-20 01:20:29 -04:00
refactor: improve download dropdown UX and styling
All checks were successful
CI / test (pull_request) Successful in 46s
CI / test (push) Successful in 1m35s
caa37e55fa
- Use lightweight fade‑in hover
heckyel merged commit a0f315be51 into master 2026-04-20 01:22:56 -04:00
heckyel deleted branch feature/hls 2026-04-20 01:22:57 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Reference: heckyel/yt-local#1