mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-24 14:06:36 +00:00
Merge branch 'meeb:main' into patch-14
This commit is contained in:
commit
bfd9bdf8f2
@ -5,7 +5,6 @@ from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db.models import signals
|
||||
from common.logger import log
|
||||
from sync.models import Source, Media, MediaServer
|
||||
from sync.signals import media_post_delete
|
||||
from sync.tasks import schedule_media_servers_update
|
||||
|
||||
|
||||
|
@ -13,21 +13,28 @@ class Command(BaseCommand):
|
||||
|
||||
help = 'Resets all tasks'
|
||||
|
||||
@atomic(durable=True)
|
||||
def handle(self, *args, **options):
|
||||
log.info('Resettings all tasks...')
|
||||
# Delete all tasks
|
||||
Task.objects.all().delete()
|
||||
# Iter all tasks
|
||||
for source in Source.objects.all():
|
||||
# Recreate the initial indexing task
|
||||
log.info(f'Resetting tasks for source: {source}')
|
||||
verbose_name = _('Index media from source "{}"')
|
||||
index_source_task(
|
||||
str(source.pk),
|
||||
repeat=source.index_schedule,
|
||||
verbose_name=verbose_name.format(source.name)
|
||||
)
|
||||
# This also chains down to call each Media objects .save() as well
|
||||
source.save()
|
||||
with atomic(durable=True):
|
||||
# Delete all tasks
|
||||
Task.objects.all().delete()
|
||||
# Iter all sources, creating new tasks
|
||||
for source in Source.objects.all():
|
||||
verbose_name = _('Check download directory exists for source "{}"')
|
||||
check_source_directory_exists(
|
||||
str(source.pk),
|
||||
verbose_name=verbose_name.format(source.name),
|
||||
)
|
||||
# Recreate the initial indexing task
|
||||
log.info(f'Resetting tasks for source: {source}')
|
||||
verbose_name = _('Index media from source "{}"')
|
||||
index_source_task(
|
||||
str(source.pk),
|
||||
repeat=source.index_schedule,
|
||||
verbose_name=verbose_name.format(source.name),
|
||||
)
|
||||
with atomic(durable=True):
|
||||
for source in Source.objects.all():
|
||||
# This also chains down to call each Media objects .save() as well
|
||||
source.save()
|
||||
log.info('Done')
|
||||
|
@ -221,7 +221,7 @@ def media_post_save(sender, instance, created, **kwargs):
|
||||
else:
|
||||
# Downloaded media might need to be renamed
|
||||
# Check settings before any rename tasks are scheduled
|
||||
rename_sources_setting = settings.RENAME_SOURCES or list()
|
||||
rename_sources_setting = getattr(settings, 'RENAME_SOURCES') or list()
|
||||
create_rename_task = (
|
||||
(
|
||||
media.source.directory and
|
||||
|
@ -746,7 +746,7 @@ def rename_all_media_for_source(source_id):
|
||||
f'source exists with ID: {source_id}')
|
||||
raise InvalidTaskError(_('no such source')) from e
|
||||
# Check that the settings allow renaming
|
||||
rename_sources_setting = getattr(settings, 'RENAME_SOURCES', list())
|
||||
rename_sources_setting = getattr(settings, 'RENAME_SOURCES') or list()
|
||||
create_rename_tasks = (
|
||||
(
|
||||
source.directory and
|
||||
|
@ -99,6 +99,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h2 class="truncate">Warnings</h2>
|
||||
<div class="collection-item">
|
||||
An upcoming release, after <b>2025-006-01</b>, will introduce automated file renaming.<br>
|
||||
To prevent this change from taking effect, you can set an environment variable before that date.<br>
|
||||
See the <a href="https://github.com/meeb/tubesync#warnings" rel="external noreferrer">GitHub README</a>
|
||||
for more details or ask questions using
|
||||
issue <a href="https://github.com/meeb/tubesync/issues/785" rel="external noreferrer">#785</a>.<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h2 class="truncate">Runtime information</h2>
|
||||
|
@ -931,6 +931,11 @@ class ResetTasks(FormView):
|
||||
Task.objects.all().delete()
|
||||
# Iter all tasks
|
||||
for source in Source.objects.all():
|
||||
verbose_name = _('Check download directory exists for source "{}"')
|
||||
check_source_directory_exists(
|
||||
str(source.pk),
|
||||
verbose_name=verbose_name.format(source.name),
|
||||
)
|
||||
# Recreate the initial indexing task
|
||||
verbose_name = _('Index media from source "{}"')
|
||||
index_source_task(
|
||||
|
@ -14,6 +14,7 @@ from tempfile import TemporaryDirectory
|
||||
from urllib.parse import urlsplit, parse_qs
|
||||
|
||||
from django.conf import settings
|
||||
from .choices import Val, FileExtension
|
||||
from .hooks import postprocessor_hook, progress_hook
|
||||
from .utils import mkdir_p
|
||||
import yt_dlp
|
||||
@ -301,6 +302,15 @@ def download_media(
|
||||
).options.sponsorblock_mark
|
||||
pp_opts.sponsorblock_remove.update(sponsor_categories or {})
|
||||
|
||||
# Enable audio extraction for audio-only extensions
|
||||
audio_exts = set(Val(
|
||||
FileExtension.M4A,
|
||||
FileExtension.OGG,
|
||||
))
|
||||
if extension in audio_exts:
|
||||
pp_opts.extractaudio = True
|
||||
pp_opts.nopostoverwrites = False
|
||||
|
||||
ytopts = {
|
||||
'format': media_format,
|
||||
'merge_output_format': extension,
|
||||
|
@ -7,7 +7,7 @@ CONFIG_BASE_DIR = BASE_DIR
|
||||
DOWNLOADS_BASE_DIR = BASE_DIR
|
||||
|
||||
|
||||
VERSION = '0.13.7'
|
||||
VERSION = '0.14.1'
|
||||
SECRET_KEY = ''
|
||||
DEBUG = False
|
||||
ALLOWED_HOSTS = []
|
||||
|
Loading…
Reference in New Issue
Block a user