Skip to content

Commit 4a24fd1

Browse files
committed
Merge branch 'main' of github.com:meeb/tubesync
2 parents b38c7d7 + f133bda commit 4a24fd1

File tree

4 files changed

+55
-9
lines changed

4 files changed

+55
-9
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Notable libraries and software used:
325325
* [django-sass](https://github.com/coderedcorp/django-sass/)
326326
* The container bundles with `s6-init` and `nginx`
327327

328-
See the [Pipefile](https://github.com/meeb/tubesync/blob/main/Pipfile) for a full list.
328+
See the [Pipfile](https://github.com/meeb/tubesync/blob/main/Pipfile) for a full list.
329329

330330
### Can I get access to the full Django admin?
331331

@@ -353,7 +353,12 @@ etc.). Configuration of this is beyond the scope of this README.
353353

354354
### What architectures does the container support?
355355

356-
Just `amd64` for the moment. Others may be made available if there is demand.
356+
Only two are supported, for the moment:
357+
- `amd64` (most desktop PCs and servers)
358+
- `arm64`
359+
(modern ARM computers, such as the Rasperry Pi 3 or later)
360+
361+
Others may be made available, if there is demand.
357362

358363
### The pipenv install fails with "Locking failed"!
359364

tubesync/sync/views.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,15 @@ class ValidateSourceView(FormView):
193193
Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: ('https://www.youtube.com/playlist?list='
194194
'PL590L5WQmH8dpP0RyH5pCfIaDEdt9nk7r')
195195
}
196+
_youtube_domains = frozenset({
197+
'youtube.com',
198+
'm.youtube.com',
199+
'www.youtube.com',
200+
})
196201
validation_urls = {
197202
Source.SOURCE_TYPE_YOUTUBE_CHANNEL: {
198203
'scheme': 'https',
199-
'domains': ('m.youtube.com', 'www.youtube.com'),
204+
'domains': _youtube_domains,
200205
'path_regex': '^\/(c\/)?([^\/]+)(\/videos)?$',
201206
'path_must_not_match': ('/playlist', '/c/playlist'),
202207
'qs_args': [],
@@ -205,7 +210,7 @@ class ValidateSourceView(FormView):
205210
},
206211
Source.SOURCE_TYPE_YOUTUBE_CHANNEL_ID: {
207212
'scheme': 'https',
208-
'domains': ('m.youtube.com', 'www.youtube.com'),
213+
'domains': _youtube_domains,
209214
'path_regex': '^\/channel\/([^\/]+)(\/videos)?$',
210215
'path_must_not_match': ('/playlist', '/c/playlist'),
211216
'qs_args': [],
@@ -214,7 +219,7 @@ class ValidateSourceView(FormView):
214219
},
215220
Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: {
216221
'scheme': 'https',
217-
'domains': ('m.youtube.com', 'www.youtube.com'),
222+
'domains': _youtube_domains,
218223
'path_regex': '^\/(playlist|watch)$',
219224
'path_must_not_match': (),
220225
'qs_args': ('list',),

tubesync/tubesync/wsgi.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
from urllib.parse import urljoin
32
from django.core.wsgi import get_wsgi_application
43

54

@@ -16,10 +15,9 @@ def application(environ, start_response):
1615
else:
1716
raise Exception(f'DJANGO_URL_PREFIX must end with a /, '
1817
f'got: {DJANGO_URL_PREFIX}')
19-
if script_name:
20-
static_url = urljoin(script_name, 'static/')
18+
if script_name is not None:
2119
environ['SCRIPT_NAME'] = script_name
2220
path_info = environ['PATH_INFO']
23-
if path_info.startswith(script_name) and not path_info.startswith(static_url):
21+
if path_info.startswith(script_name):
2422
environ['PATH_INFO'] = path_info[len(script_name) - 1:]
2523
return _application(environ, start_response)

tubesync/upgrade_yt-dlp.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
warning_message() {
4+
cat <<EOM
5+
Please report any issues that you have encountered before updating yt-dlp.
6+
7+
This is a tool to assist developers with debugging YouTube issues.
8+
It should not be used as an alternative to updating container images!
9+
EOM
10+
} 1>&2
11+
12+
pip3() {
13+
local pip_runner pip_whl run_whl
14+
15+
# pipenv
16+
pip_runner='/usr/lib/python3/dist-packages/pipenv/patched/pip/__pip-runner__.py'
17+
test -s "${pip_runner}" || pip_runner=''
18+
19+
# python3-pip-whl
20+
pip_whl="$(ls -1r /usr/share/python-wheels/pip-*-py3-none-any.whl | head -n 1)"
21+
run_whl="${pip_whl}/pip"
22+
23+
python3 "${pip_runner:-"${run_whl}"}" "$@"
24+
}
25+
26+
warning_message
27+
test -n "${TUBESYNC_DEBUG}" || exit 1
28+
29+
# Use the flag added in 23.0.1, if possible.
30+
# https://github.com/pypa/pip/pull/11780
31+
break_system_packages='--break-system-packages'
32+
pip_version="$(pip3 --version | awk '$1 = "pip" { print $2; exit; }')"
33+
if [[ "${pip_version}" < "23.0.1" ]]; then
34+
break_system_packages=''
35+
fi
36+
37+
pip3 install --upgrade ${break_system_packages} yt-dlp
38+

0 commit comments

Comments
 (0)