feature/hls: Add HLS playback support, and refactors documentation for better usability and maintainability. (#1)
All checks were successful
git-sync-with-mirror / git-sync (push) Successful in 32s
CI / test (push) Successful in 46s

## 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

Reviewed-on: #1
Co-authored-by: Astounds <kirito@disroot.org>
Co-committed-by: Astounds <kirito@disroot.org>
This commit was merged in pull request #1.
This commit is contained in:
2026-04-20 01:22:55 -04:00
committed by heckyel
parent 62a028968e
commit a0f315be51
46 changed files with 4109 additions and 687 deletions

View File

@@ -1,76 +1,108 @@
## Basic init yt-local for openrc
# Basic init yt-local for openrc
1. Write `/etc/init.d/ytlocal` file.
## Prerequisites
```
#!/sbin/openrc-run
# Distributed under the terms of the GNU General Public License v3 or later
name="yt-local"
pidfile="/var/run/ytlocal.pid"
command="/usr/sbin/ytlocal"
- System with OpenRC installed and configured.
- Administrative privileges (doas or sudo).
- `ytlocal` script located at `/usr/sbin/ytlocal` and application files in an accessible directory.
depend() {
use net
}
## Service Installation
start_pre() {
if [ ! -f /usr/sbin/ytlocal ] ; then
eerror "Please create script file of ytlocal in '/usr/sbin/ytlocal'"
return 1
else
return 0
fi
}
1. **Create the OpenRC service script** `/etc/init.d/ytlocal`:
start() {
ebegin "Starting yt-local"
start-stop-daemon --start --exec "${command}" --pidfile "${pidfile}"
eend $?
}
```sh
#!/sbin/openrc-run
# Distributed under the terms of the GNU General Public License v3 or later
name="yt-local"
pidfile="/var/run/ytlocal.pid"
command="/usr/sbin/ytlocal"
reload() {
ebegin "Reloading ${name}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}
depend() {
use net
}
stop() {
ebegin "Stopping ${name}"
start-stop-daemon --quiet --stop --exec "${command}" --pidfile "${pidfile}"
eend $?
}
```
start_pre() {
if [ ! -f /usr/sbin/ytlocal ]; then
eerror "Please create script file of ytlocal in '/usr/sbin/ytlocal'"
return 1
else
return 0
fi
}
after, modified execute permissions:
start() {
ebegin "Starting yt-local"
start-stop-daemon --start --exec "${command}" --pidfile "${pidfile}"
eend $?
}
$ doas chmod a+x /etc/init.d/ytlocal
reload() {
ebegin "Reloading ${name}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}
stop() {
ebegin "Stopping ${name}"
start-stop-daemon --quiet --stop --exec "${command}" --pidfile "${pidfile}"
eend $?
}
```
2. Write `/usr/sbin/ytlocal` and configure path.
> [!NOTE]
> Ensure the script is executable:
>
> ```sh
> doas chmod a+x /etc/init.d/ytlocal
> ```
```
#!/usr/bin/env bash
2. **Create the executable script** `/usr/sbin/ytlocal`:
cd /home/your-path/ytlocal/ # change me
source venv/bin/activate
python server.py > /dev/null 2>&1 &
echo $! > /var/run/ytlocal.pid
```
```bash
#!/usr/bin/env bash
after, modified execute permissions:
# Change the working directory according to your installation path
# Example: if installed in /usr/local/ytlocal, use:
cd /home/your-path/ytlocal/ # <-- MODIFY TO YOUR PATH
source venv/bin/activate
python server.py > /dev/null 2>&1 &
echo $! > /var/run/ytlocal.pid
```
$ doas chmod a+x /usr/sbin/ytlocal
> [!WARNING]
> Run this script only as root or via `doas`, as it writes to `/var/run` and uses network privileges.
> [!TIP]
> To store the PID in a different location, adjust the `pidfile` variable in the service script.
3. OpenRC check
> [!IMPORTANT]
> Verify that the virtual environment (`venv`) is correctly set up and that `python` points to the appropriate version.
- status: `doas rc-service ytlocal status`
- start: `doas rc-service ytlocal start`
- restart: `doas rc-service ytlocal restart`
- stop: `doas rc-service ytlocal stop`
> [!CAUTION]
> Do not stop the process manually; use OpenRC commands (`rc-service ytlocal stop`) to avoid race conditions.
- enable: `doas rc-update add ytlocal default`
- disable: `doas rc-update del ytlocal`
> [!NOTE]
> When run with administrative privileges, the configuration is saved in `/root/.yt-local`, which is rootonly.
When yt-local is run with administrator privileges,
the configuration file is stored in /root/.yt-local
## Service Management
- **Status**: `doas rc-service ytlocal status`
- **Start**: `doas rc-service ytlocal start`
- **Restart**: `doas rc-service ytlocal restart`
- **Stop**: `doas rc-service ytlocal stop`
- **Enable at boot**: `doas rc-update add ytlocal default`
- **Disable**: `doas rc-update del ytlocal`
## PostInstallation Verification
- Confirm the process is running: `doas rc-service ytlocal status`
- Inspect logs for issues: `doas tail -f /var/log/ytlocal.log` (if logging is configured).
## Troubleshooting Common Issues
- **Service fails to start**: verify script permissions, correct `command=` path, and that the virtualenv exists.
- **Port conflict**: adjust the servers port configuration before launching.
- **Import errors**: ensure all dependencies are installed in the virtual environment.
[!IMPORTANT]
Keep the service script updated when modifying startup logic or adding new dependencies.