Skip to content

Commit

Permalink
Merge branch 'main' of github.com:meeb/tubesync
Browse files Browse the repository at this point in the history
  • Loading branch information
meeb committed Jan 22, 2025
2 parents b38c7d7 + f133bda commit 4a24fd1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 9 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Notable libraries and software used:
* [django-sass](https://github.com/coderedcorp/django-sass/)
* The container bundles with `s6-init` and `nginx`

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

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

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

### What architectures does the container support?

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

Others may be made available, if there is demand.

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

Expand Down
11 changes: 8 additions & 3 deletions tubesync/sync/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,15 @@ class ValidateSourceView(FormView):
Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: ('https://www.youtube.com/playlist?list='
'PL590L5WQmH8dpP0RyH5pCfIaDEdt9nk7r')
}
_youtube_domains = frozenset({
'youtube.com',
'm.youtube.com',
'www.youtube.com',
})
validation_urls = {
Source.SOURCE_TYPE_YOUTUBE_CHANNEL: {
'scheme': 'https',
'domains': ('m.youtube.com', 'www.youtube.com'),
'domains': _youtube_domains,
'path_regex': '^\/(c\/)?([^\/]+)(\/videos)?$',
'path_must_not_match': ('/playlist', '/c/playlist'),
'qs_args': [],
Expand All @@ -205,7 +210,7 @@ class ValidateSourceView(FormView):
},
Source.SOURCE_TYPE_YOUTUBE_CHANNEL_ID: {
'scheme': 'https',
'domains': ('m.youtube.com', 'www.youtube.com'),
'domains': _youtube_domains,
'path_regex': '^\/channel\/([^\/]+)(\/videos)?$',
'path_must_not_match': ('/playlist', '/c/playlist'),
'qs_args': [],
Expand All @@ -214,7 +219,7 @@ class ValidateSourceView(FormView):
},
Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: {
'scheme': 'https',
'domains': ('m.youtube.com', 'www.youtube.com'),
'domains': _youtube_domains,
'path_regex': '^\/(playlist|watch)$',
'path_must_not_match': (),
'qs_args': ('list',),
Expand Down
6 changes: 2 additions & 4 deletions tubesync/tubesync/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from urllib.parse import urljoin
from django.core.wsgi import get_wsgi_application


Expand All @@ -16,10 +15,9 @@ def application(environ, start_response):
else:
raise Exception(f'DJANGO_URL_PREFIX must end with a /, '
f'got: {DJANGO_URL_PREFIX}')
if script_name:
static_url = urljoin(script_name, 'static/')
if script_name is not None:
environ['SCRIPT_NAME'] = script_name
path_info = environ['PATH_INFO']
if path_info.startswith(script_name) and not path_info.startswith(static_url):
if path_info.startswith(script_name):
environ['PATH_INFO'] = path_info[len(script_name) - 1:]
return _application(environ, start_response)
38 changes: 38 additions & 0 deletions tubesync/upgrade_yt-dlp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

warning_message() {
cat <<EOM
Please report any issues that you have encountered before updating yt-dlp.
This is a tool to assist developers with debugging YouTube issues.
It should not be used as an alternative to updating container images!
EOM
} 1>&2

pip3() {
local pip_runner pip_whl run_whl

# pipenv
pip_runner='/usr/lib/python3/dist-packages/pipenv/patched/pip/__pip-runner__.py'
test -s "${pip_runner}" || pip_runner=''

# python3-pip-whl
pip_whl="$(ls -1r /usr/share/python-wheels/pip-*-py3-none-any.whl | head -n 1)"
run_whl="${pip_whl}/pip"

python3 "${pip_runner:-"${run_whl}"}" "$@"
}

warning_message
test -n "${TUBESYNC_DEBUG}" || exit 1

# Use the flag added in 23.0.1, if possible.
# https://github.com/pypa/pip/pull/11780
break_system_packages='--break-system-packages'
pip_version="$(pip3 --version | awk '$1 = "pip" { print $2; exit; }')"
if [[ "${pip_version}" < "23.0.1" ]]; then
break_system_packages=''
fi

pip3 install --upgrade ${break_system_packages} yt-dlp

0 comments on commit 4a24fd1

Please sign in to comment.