mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-24 14:06:36 +00:00
Merge branch 'meeb:main' into patch-2
This commit is contained in:
commit
2222a146b6
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@ -144,7 +144,7 @@ jobs:
|
|||||||
done
|
done
|
||||||
} >> "${GITHUB_STEP_SUMMARY}"
|
} >> "${GITHUB_STEP_SUMMARY}"
|
||||||
uvx --no-config --no-managed-python --no-progress --isolated \
|
uvx --no-config --no-managed-python --no-progress --isolated \
|
||||||
ruff check --exit-zero \
|
ruff check \
|
||||||
--target-version "${target_version}" \
|
--target-version "${target_version}" \
|
||||||
--output-format github \
|
--output-format github \
|
||||||
--ignore "${ignore_csv_list}"
|
--ignore "${ignore_csv_list}"
|
||||||
|
1
Pipfile
1
Pipfile
@ -24,5 +24,4 @@ yt-dlp = {extras = ["default", "curl-cffi"], version = "*"}
|
|||||||
emoji = "*"
|
emoji = "*"
|
||||||
brotli = "*"
|
brotli = "*"
|
||||||
html5lib = "*"
|
html5lib = "*"
|
||||||
yt-dlp-get-pot = "*"
|
|
||||||
bgutil-ytdlp-pot-provider = "*"
|
bgutil-ytdlp-pot-provider = "*"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from pathlib import Path
|
||||||
from ..choices import Val, YouTube_SourceType # noqa
|
from ..choices import Val, YouTube_SourceType # noqa
|
||||||
|
|
||||||
|
|
||||||
@ -10,3 +11,11 @@ def _nfo_element(nfo, label, text, /, *, attrs={}, tail='\n', char=' ', indent=2
|
|||||||
element.tail = tail + (char * indent)
|
element.tail = tail + (char * indent)
|
||||||
return element
|
return element
|
||||||
|
|
||||||
|
def directory_and_stem(arg_path, /, all_suffixes=False):
|
||||||
|
filepath = Path(arg_path)
|
||||||
|
stem = Path(filepath.stem)
|
||||||
|
while all_suffixes and stem.suffixes and '' != stem.suffix:
|
||||||
|
stem = Path(stem.stem)
|
||||||
|
stem = str(stem)
|
||||||
|
return (filepath.parent, stem,)
|
||||||
|
|
||||||
|
@ -25,8 +25,7 @@ from ..youtube import (
|
|||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
seconds_to_timestr, parse_media_format, filter_response,
|
seconds_to_timestr, parse_media_format, filter_response,
|
||||||
write_text_file, mkdir_p, directory_and_stem, glob_quote,
|
write_text_file, mkdir_p, glob_quote, multi_key_sort,
|
||||||
multi_key_sort,
|
|
||||||
)
|
)
|
||||||
from ..matching import (
|
from ..matching import (
|
||||||
get_best_combined_format,
|
get_best_combined_format,
|
||||||
@ -39,7 +38,7 @@ from ..choices import (
|
|||||||
from ._migrations import (
|
from ._migrations import (
|
||||||
media_file_storage, get_media_thumb_path, get_media_file_path,
|
media_file_storage, get_media_thumb_path, get_media_file_path,
|
||||||
)
|
)
|
||||||
from ._private import _srctype_dict, _nfo_element
|
from ._private import _srctype_dict, _nfo_element, directory_and_stem
|
||||||
from .media__tasks import (
|
from .media__tasks import (
|
||||||
download_checklist, download_finished, wait_for_premiere,
|
download_checklist, download_finished, wait_for_premiere,
|
||||||
)
|
)
|
||||||
@ -1193,7 +1192,7 @@ class Media(models.Model):
|
|||||||
other_path.replace(new_file_path)
|
other_path.replace(new_file_path)
|
||||||
|
|
||||||
for fuzzy_path in fuzzy_paths:
|
for fuzzy_path in fuzzy_paths:
|
||||||
(fuzzy_prefix_path, fuzzy_stem) = directory_and_stem(fuzzy_path)
|
(fuzzy_prefix_path, fuzzy_stem) = directory_and_stem(fuzzy_path, True)
|
||||||
old_file_str = fuzzy_path.name
|
old_file_str = fuzzy_path.name
|
||||||
new_file_str = new_stem + old_file_str[len(fuzzy_stem):]
|
new_file_str = new_stem + old_file_str[len(fuzzy_stem):]
|
||||||
new_file_path = Path(new_prefix_path / new_file_str)
|
new_file_path = Path(new_prefix_path / new_file_str)
|
||||||
|
@ -35,7 +35,7 @@ from common.utils import ( django_queryset_generator as qs_gen,
|
|||||||
from .choices import Val, TaskQueue
|
from .choices import Val, TaskQueue
|
||||||
from .models import Source, Media, MediaServer
|
from .models import Source, Media, MediaServer
|
||||||
from .utils import ( get_remote_image, resize_image_to_height,
|
from .utils import ( get_remote_image, resize_image_to_height,
|
||||||
write_text_file, filter_response, )
|
write_text_file, filter_response, seconds_to_timestr, )
|
||||||
from .youtube import YouTubeError
|
from .youtube import YouTubeError
|
||||||
|
|
||||||
db_vendor = db.connection.vendor
|
db_vendor = db.connection.vendor
|
||||||
@ -256,8 +256,11 @@ def wait_for_errors(model, /, *, task_name=None):
|
|||||||
)
|
)
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
update_task_status(task, 'paused (429)')
|
update_task_status(task, 'paused (429)')
|
||||||
log.info(f'waiting for errors: 429 ({tqs.count()}): {model}')
|
|
||||||
time.sleep(10 * tqs.count())
|
delay = 10 * tqs.count()
|
||||||
|
time_str = seconds_to_timestr(delay)
|
||||||
|
log.info(f'waiting for errors: 429 ({time_str}): {model}')
|
||||||
|
time.sleep(delay)
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
update_task_status(task, None)
|
update_task_status(task, None)
|
||||||
|
|
||||||
|
@ -121,7 +121,8 @@
|
|||||||
{% if media_file_path == media.filepath %}
|
{% if media_file_path == media.filepath %}
|
||||||
<span class="green-text"> (matched)</span>
|
<span class="green-text"> (matched)</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td> </tr>
|
</td>
|
||||||
|
</tr>
|
||||||
<tr title="Size of the file on disk">
|
<tr title="Size of the file on disk">
|
||||||
<td class="hide-on-small-only">File size</td>
|
<td class="hide-on-small-only">File size</td>
|
||||||
<td><span class="hide-on-med-and-up">File size<br></span><strong>{{ media.downloaded_filesize|bytesformat }}</strong></td>
|
<td><span class="hide-on-med-and-up">File size<br></span><strong>{{ media.downloaded_filesize|bytesformat }}</strong></td>
|
||||||
|
@ -130,15 +130,6 @@ def file_is_editable(filepath):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def directory_and_stem(arg_path):
|
|
||||||
filepath = Path(arg_path)
|
|
||||||
stem = Path(filepath.stem)
|
|
||||||
while stem.suffixes and '' != stem.suffix:
|
|
||||||
stem = Path(stem.stem)
|
|
||||||
stem = str(stem)
|
|
||||||
return (filepath.parent, stem,)
|
|
||||||
|
|
||||||
|
|
||||||
def mkdir_p(arg_path, mode=0o777):
|
def mkdir_p(arg_path, mode=0o777):
|
||||||
'''
|
'''
|
||||||
Reminder: mode only affects the last directory
|
Reminder: mode only affects the last directory
|
||||||
|
@ -845,9 +845,11 @@ class TasksView(ListView):
|
|||||||
data = super().get_context_data(*args, **kwargs)
|
data = super().get_context_data(*args, **kwargs)
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
qs = Task.objects.all()
|
qs = Task.objects.all()
|
||||||
errors_qs = qs.filter(attempts__gt=0, locked_by__isnull=True)
|
|
||||||
running_qs = qs.filter(locked_by__isnull=False)
|
running_qs = qs.filter(locked_by__isnull=False)
|
||||||
scheduled_qs = qs.filter(locked_by__isnull=True)
|
scheduled_qs = qs.filter(locked_by__isnull=True)
|
||||||
|
errors_qs = scheduled_qs.filter(
|
||||||
|
attempts__gt=0
|
||||||
|
).exclude(last_error__exact='')
|
||||||
|
|
||||||
# Add to context data from ListView
|
# Add to context data from ListView
|
||||||
data['message'] = self.message
|
data['message'] = self.message
|
||||||
|
@ -8,7 +8,7 @@ CONFIG_BASE_DIR = BASE_DIR
|
|||||||
DOWNLOADS_BASE_DIR = BASE_DIR
|
DOWNLOADS_BASE_DIR = BASE_DIR
|
||||||
|
|
||||||
|
|
||||||
VERSION = '0.15.3'
|
VERSION = '0.15.4'
|
||||||
SECRET_KEY = ''
|
SECRET_KEY = ''
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
ALLOWED_HOSTS = []
|
ALLOWED_HOSTS = []
|
||||||
|
Loading…
Reference in New Issue
Block a user