Compare commits
1 Commits
b320127f16
...
v0.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
| a0f315be51 |
@@ -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 root‑only.
|
||||
|
||||
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`
|
||||
|
||||
## Post‑Installation 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 server’s 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.
|
||||
|
||||
11
settings.py
11
settings.py
@@ -261,6 +261,17 @@ For security reasons, enabling this is not recommended.''',
|
||||
'category': 'interface',
|
||||
}),
|
||||
|
||||
('native_player_storyboard', {
|
||||
'type': bool,
|
||||
'default': False,
|
||||
'label': 'Storyboard preview (native)',
|
||||
'comment': '''Show thumbnail preview on hover (native player modes).
|
||||
Positioning is heuristic; may misalign in Firefox/Safari.
|
||||
Works best on Chromium browsers.
|
||||
No effect in Plyr.''',
|
||||
'category': 'interface',
|
||||
}),
|
||||
|
||||
('use_video_download', {
|
||||
'type': int,
|
||||
'default': 0,
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
--thumb-background: #222222;
|
||||
--link: #00B0FF;
|
||||
--link-visited: #40C4FF;
|
||||
--border-color: #333333;
|
||||
--thead-background: #0a0a0b;
|
||||
--border-bg: #222222;
|
||||
--border-bg-settings: #000000;
|
||||
--border-bg-license: #000000;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
--thumb-background: #35404D;
|
||||
--link: #22AAFF;
|
||||
--link-visited: #7755FF;
|
||||
--border-color: #4A5568;
|
||||
--thead-background: #1a2530;
|
||||
--border-bg: #FFFFFF;
|
||||
--border-bg-settings: #FFFFFF;
|
||||
--border-bg-license: #FFFFFF;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
--thumb-background: #F5F5F5;
|
||||
--link: #212121;
|
||||
--link-visited: #808080;
|
||||
--border-color: #CCCCCC;
|
||||
--thead-background: #d0d0d0;
|
||||
--border-bg: #212121;
|
||||
--border-bg-settings: #91918C;
|
||||
--border-bg-license: #91918C;
|
||||
|
||||
@@ -307,18 +307,122 @@ figure.sc-video {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
.v-download { grid-area: v-download; }
|
||||
.v-download > ul.download-dropdown-content {
|
||||
background: var(--secondary-background);
|
||||
padding-left: 0px;
|
||||
.v-download {
|
||||
grid-area: v-download;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.v-download > ul.download-dropdown-content > li.download-format {
|
||||
list-style: none;
|
||||
.v-download details {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.v-download > summary {
|
||||
cursor: pointer;
|
||||
padding: 0.4rem 0;
|
||||
padding-left: 1rem;
|
||||
}
|
||||
.v-download > ul.download-dropdown-content > li.download-format a.download-link {
|
||||
.v-download > summary.download-dropdown-label {
|
||||
cursor: pointer;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
padding-bottom: 6px;
|
||||
padding-left: .75em;
|
||||
padding-right: .75em;
|
||||
padding-top: 6px;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
background-color: var(--buttom);
|
||||
border: 1px solid var(--button-border);
|
||||
color: var(--buttom-text);
|
||||
border-radius: 5px;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.v-download > summary.download-dropdown-label:hover {
|
||||
background-color: var(--buttom-hover);
|
||||
}
|
||||
.v-download > .download-table-container {
|
||||
background: var(--secondary-background);
|
||||
max-height: 65vh;
|
||||
overflow-y: auto;
|
||||
border: 1px solid var(--button-border);
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
}
|
||||
.download-table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.download-table thead {
|
||||
background: var(--thead-background);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
.download-table th,
|
||||
.download-table td {
|
||||
padding: 0.7rem 0.9rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid var(--button-border);
|
||||
}
|
||||
.download-table th {
|
||||
font-weight: 600;
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.8px;
|
||||
}
|
||||
.download-table tbody tr {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.download-table tbody tr:hover {
|
||||
background: var(--primary-background);
|
||||
}
|
||||
.download-table a.download-link {
|
||||
display: inline-block;
|
||||
padding: 0.4rem 0.85rem;
|
||||
background: rgba(0,0,0,0.12);
|
||||
color: var(--buttom-text);
|
||||
text-decoration: none;
|
||||
border-radius: 5px;
|
||||
font-weight: 500;
|
||||
font-size: 0.85rem;
|
||||
transition: background 0.2s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.download-table a.download-link:hover {
|
||||
background: rgba(0,0,0,0.28);
|
||||
color: var(--buttom-text);
|
||||
}
|
||||
.download-table tbody tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
.download-table td[data-label="Ext"] {
|
||||
font-family: monospace;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.download-table td[data-label="Link"] {
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.download-table td[data-label="Codecs"] {
|
||||
max-width: 180px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
font-family: monospace;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.download-table td[data-label="Size"] {
|
||||
font-family: monospace;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.download-table td[colspan="3"] {
|
||||
font-style: italic;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.v-description {
|
||||
|
||||
@@ -105,5 +105,10 @@
|
||||
{% if use_dash %}
|
||||
<script src="/youtube.com/static/js/av-merge.js"></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- Storyboard Preview Thumbnails (native players only; Plyr handles this internally) -->
|
||||
{% if settings.use_video_player != 2 and settings.native_player_storyboard %}
|
||||
<script src="/youtube.com/static/js/storyboard-preview.js"></script>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -102,22 +102,40 @@
|
||||
{% if settings.use_video_download != 0 %}
|
||||
<details class="v-download">
|
||||
<summary class="download-dropdown-label">{{ _('Download') }}</summary>
|
||||
<ul class="download-dropdown-content">
|
||||
{% for format in download_formats %}
|
||||
<li class="download-format">
|
||||
<a class="download-link" href="{{ format['url'] }}" download="{{ title }}.{{ format['ext'] }}">
|
||||
{{ format['ext'] }} {{ format['video_quality'] }} {{ format['audio_quality'] }} {{ format['file_size'] }} {{ format['codecs'] }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% for download in other_downloads %}
|
||||
<li class="download-format">
|
||||
<a href="{{ download['url'] }}" download>
|
||||
{{ download['ext'] }} {{ download['label'] }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="download-table-container">
|
||||
<table class="download-table" aria-label="Download formats">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">{{ _('Ext') }}</th>
|
||||
<th scope="col">{{ _('Video') }}</th>
|
||||
<th scope="col">{{ _('Audio') }}</th>
|
||||
<th scope="col">{{ _('Size') }}</th>
|
||||
<th scope="col">{{ _('Codecs') }}</th>
|
||||
<th scope="col">{{ _('Link') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for format in download_formats %}
|
||||
<tr>
|
||||
<td data-label="{{ _('Ext') }}">{{ format['ext'] }}</td>
|
||||
<td data-label="{{ _('Video') }}">{{ format['video_quality'] }}</td>
|
||||
<td data-label="{{ _('Audio') }}">{{ format['audio_quality'] }}</td>
|
||||
<td data-label="{{ _('Size') }}">{{ format['file_size'] }}</td>
|
||||
<td data-label="{{ _('Codecs') }}">{{ format['codecs'] }}</td>
|
||||
<td data-label="{{ _('Link') }}"><a class="download-link" href="{{ format['url'] }}" download="{{ title }}.{{ format['ext'] }}" aria-label="{{ _('Download') }} {{ format['ext'] }} {{ format['video_quality'] }} {{ format['audio_quality'] }}">{{ _('Download') }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for download in other_downloads %}
|
||||
<tr>
|
||||
<td data-label="{{ _('Ext') }}">{{ download['ext'] }}</td>
|
||||
<td data-label="{{ _('Video') }}" colspan="3">{{ download['label'] }}</td>
|
||||
<td data-label="{{ _('Codecs') }}">{{ download.get('codecs', 'N/A') }}</td>
|
||||
<td data-label="{{ _('Link') }}"><a class="download-link" href="{{ download['url'] }}" download aria-label="{{ _('Download') }} {{ download['label'] }}">{{ _('Download') }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
{% else %}
|
||||
<span class="v-download"></span>
|
||||
@@ -304,8 +322,8 @@
|
||||
<!-- /plyr -->
|
||||
{% endif %}
|
||||
|
||||
<!-- Storyboard Preview Thumbnails -->
|
||||
{% if settings.use_video_player != 2 %}
|
||||
<!-- Storyboard Preview Thumbnails (native players only; Plyr handles this internally) -->
|
||||
{% if settings.use_video_player != 2 and settings.native_player_storyboard %}
|
||||
<script src="/youtube.com/static/js/storyboard-preview.js"></script>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__version__ = 'v0.4.5'
|
||||
__version__ = 'v0.5.0'
|
||||
|
||||
Reference in New Issue
Block a user