Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Install Python ${{ matrix.python-version }}
Expand All @@ -101,8 +101,9 @@ jobs:
cp -v -p tubesync/tubesync/local_settings.py.example tubesync/tubesync/local_settings.py
cp -v -a -t "${Python3_ROOT_DIR}"/lib/python3.*/site-packages/background_task/ patches/background_task/*
cp -v -a -t "${Python3_ROOT_DIR}"/lib/python3.*/site-packages/yt_dlp/ patches/yt_dlp/*
cd tubesync && python3 -B manage.py collectstatic --no-input --link
- name: Run Django tests
run: cd tubesync && python3 manage.py test --verbosity=2
run: cd tubesync && python3 -B -W default manage.py test --verbosity=2

containerise:
if: ${{ !cancelled() && 'success' == needs.info.result }}
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ verify_ssl = true
autopep8 = "*"

[packages]
django = "<5.2"
django = "*"
django-sass-processor = {extras = ["management-command"], version = "*"}
pillow = "*"
whitenoise = "*"
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ services:

## Optional authentication

Available in `v1.0` (or `:latest`)and later. If you want to enable a basic username and
Available in `v1.0` (or `:latest`) and later. If you want to enable a basic username and
password to be required to access the TubeSync dashboard you can set them with the
following environment variables:

Expand Down Expand Up @@ -188,6 +188,14 @@ $ docker pull ghcr.io/meeb/tubesync:v[number]

Back-end updates such as database migrations should be automatic.

> [!IMPORTANT]
> `MariaDB` was not automatically upgraded for `UUID` column types.
> To see what changes are needed, you can run:
> ```bash
> docker exec -it tubesync python3 /app/manage.py fix-mariadb --dry-run --uuid-columns
> ```
> Removing the `--dry-run` will attempt to execute those statements using the configured database connection.


# Moving, backing up, etc.

Expand Down Expand Up @@ -349,7 +357,7 @@ and you can probably break things by playing in the admin. If you still want to
it you can run:

```bash
$ docker exec -ti tubesync python3 /app/manage.py createsuperuser
$ docker exec -it tubesync python3 /app/manage.py createsuperuser
```

And follow the instructions to create an initial Django superuser, once created, you
Expand Down Expand Up @@ -415,7 +423,7 @@ following this rough guide, you are on your own and should be knowledgeable abou
installing and running WSGI-based Python web applications before attempting this.

1. Clone or download this repo
2. Make sure you're running a modern version of Python (>=3.9) and have Pipenv
2. Make sure you're running a modern version of Python (>=3.10) and have Pipenv
installed
3. Set up the environment with `pipenv install`
4. Copy `tubesync/tubesync/local_settings.py.example` to
Expand Down
5 changes: 2 additions & 3 deletions tubesync/common/timestamp.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import datetime


posix_epoch = datetime.datetime.utcfromtimestamp(0)
utc_tz = datetime.timezone.utc
posix_epoch = datetime.datetime.fromtimestamp(0, utc_tz)


def add_epoch(seconds):
Expand All @@ -13,10 +13,9 @@ def add_epoch(seconds):

def subtract_epoch(arg_dt, /):
assert isinstance(arg_dt, datetime.datetime)
epoch = posix_epoch.astimezone(utc_tz)
utc_dt = arg_dt.astimezone(utc_tz)

return utc_dt - epoch
return utc_dt - posix_epoch

def datetime_to_timestamp(arg_dt, /, *, integer=True):
timestamp = subtract_epoch(arg_dt).total_seconds()
Expand Down
11 changes: 9 additions & 2 deletions tubesync/sync/forms.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@

from django import forms
from django import forms, VERSION as DJANGO_VERSION
from django.utils.translation import gettext_lazy as _


if DJANGO_VERSION[0:3] < (5, 0, 0):
_assume_scheme = dict()
else:
# Silence RemovedInDjango60Warning
_assume_scheme = dict(assume_scheme='http')

class ValidateSourceForm(forms.Form):

source_type = forms.CharField(
Expand All @@ -12,7 +18,8 @@ class ValidateSourceForm(forms.Form):
)
source_url = forms.URLField(
label=_('Source URL'),
required=True
required=True,
**_assume_scheme,
)


Expand Down
4 changes: 3 additions & 1 deletion tubesync/sync/management/commands/fix-mariadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def SQLTable(arg_table):
needle = arg_table
if needle.startswith('new__'):
needle = arg_table[len('new__'):]
db.connection.ensure_connection()
valid_table_name = (
needle in new_tables and
arg_table in db_tables(include_views=False)
Expand Down Expand Up @@ -122,6 +123,7 @@ def handle(self, *args, **options):
+ f': {db.connection.vendor}'
)

db.connection.ensure_connection()
db_is_mariadb = (
hasattr(db.connection, 'mysql_is_mariadb') and
db.connection.is_usable() and
Expand Down Expand Up @@ -220,7 +222,7 @@ def handle(self, *args, **options):
at_31, err_31, out_31 = check_migration_status( '0031_metadata_metadataformat' )
at_31s, err_31s, out_31s = check_migration_status( '0031_squashed_metadata_metadataformat' )
after_31, err_31a, out_31a = check_migration_status(
'0030_alter_source_source_vcodec',
'0031_metadata_metadataformat',
needle='Undo Rename table for metadata to sync_media_metadata',
)

Expand Down
14 changes: 0 additions & 14 deletions tubesync/sync/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@
from .choices import Val, YouTube_SourceType


def is_relative_to(self, *other):
"""Return True if the path is relative to another path or False.
"""
try:
self.relative_to(*other)
return True
except ValueError:
return False

# patch Path for Python 3.8
if not hasattr(Path, 'is_relative_to'):
Path.is_relative_to = is_relative_to


@receiver(pre_save, sender=Source)
def source_pre_save(sender, instance, **kwargs):
# Triggered before a source is saved, if the schedule has been updated recreate
Expand Down
8 changes: 6 additions & 2 deletions tubesync/tubesync/settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django import VERSION as DJANGO_VERSION
from pathlib import Path
from common.utils import getenv

Expand All @@ -7,7 +8,7 @@
DOWNLOADS_BASE_DIR = BASE_DIR


VERSION = '0.15.1'
VERSION = '0.15.2'
SECRET_KEY = ''
DEBUG = False
ALLOWED_HOSTS = []
Expand Down Expand Up @@ -99,7 +100,10 @@
LANGUAGE_CODE = 'en-us'
TIME_ZONE = getenv('TZ', 'UTC')
USE_I18N = True
USE_L10N = True
# Removed in Django 5.0, set to True by default in Django 4.0
# https://docs.djangoproject.com/en/4.1/releases/4.0/#localization
if DJANGO_VERSION[0:3] < (4, 0, 0):
USE_L10N = True
USE_TZ = True


Expand Down