diff --git a/tubesync/common/static/images/favicon-sources/tubesync-016.png b/tubesync/common/static/images/favicon-sources/tubesync-016.png new file mode 100644 index 0000000..3f95ce1 Binary files /dev/null and b/tubesync/common/static/images/favicon-sources/tubesync-016.png differ diff --git a/tubesync/common/static/images/favicon-sources/tubesync-024.png b/tubesync/common/static/images/favicon-sources/tubesync-024.png new file mode 100644 index 0000000..3019f7a Binary files /dev/null and b/tubesync/common/static/images/favicon-sources/tubesync-024.png differ diff --git a/tubesync/common/static/images/favicon-sources/tubesync-032.png b/tubesync/common/static/images/favicon-sources/tubesync-032.png new file mode 100644 index 0000000..2ad15cf Binary files /dev/null and b/tubesync/common/static/images/favicon-sources/tubesync-032.png differ diff --git a/tubesync/common/static/images/favicon-sources/tubesync-048.png b/tubesync/common/static/images/favicon-sources/tubesync-048.png new file mode 100644 index 0000000..6a8217a Binary files /dev/null and b/tubesync/common/static/images/favicon-sources/tubesync-048.png differ diff --git a/tubesync/common/static/images/favicon-sources/tubesync-064.png b/tubesync/common/static/images/favicon-sources/tubesync-064.png new file mode 100644 index 0000000..61aa895 Binary files /dev/null and b/tubesync/common/static/images/favicon-sources/tubesync-064.png differ diff --git a/tubesync/common/static/images/favicon-sources/tubesync-096.png b/tubesync/common/static/images/favicon-sources/tubesync-096.png new file mode 100644 index 0000000..6623932 Binary files /dev/null and b/tubesync/common/static/images/favicon-sources/tubesync-096.png differ diff --git a/tubesync/common/static/images/favicon-sources/tubesync-128.png b/tubesync/common/static/images/favicon-sources/tubesync-128.png new file mode 100644 index 0000000..18cb5d9 Binary files /dev/null and b/tubesync/common/static/images/favicon-sources/tubesync-128.png differ diff --git a/tubesync/common/static/images/favicon.ico b/tubesync/common/static/images/favicon.ico index 04e6460..cf2e89a 100644 Binary files a/tubesync/common/static/images/favicon.ico and b/tubesync/common/static/images/favicon.ico differ diff --git a/tubesync/common/static/images/tubesync.png b/tubesync/common/static/images/tubesync.png new file mode 100644 index 0000000..6191fa8 Binary files /dev/null and b/tubesync/common/static/images/tubesync.png differ diff --git a/tubesync/common/templates/tubesync-coloured.svg b/tubesync/common/templates/tubesync-coloured.svg new file mode 100644 index 0000000..ea87b83 --- /dev/null +++ b/tubesync/common/templates/tubesync-coloured.svg @@ -0,0 +1,83 @@ + + diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 27e116c..bf9a7f0 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -5,6 +5,7 @@ from datetime import datetime from pathlib import Path from django.conf import settings from django.db import models +from django.core.files.storage import FileSystemStorage from django.utils.text import slugify from django.utils.translation import gettext_lazy as _ from common.errors import NoFormatException @@ -15,6 +16,9 @@ from .matching import (get_best_combined_format, get_best_audio_format, get_best_video_format) +media_file_storage = FileSystemStorage(location=settings.DOWNLOAD_ROOT) + + class Source(models.Model): ''' A Source is a source of media. Currently, this is either a YouTube channel @@ -295,10 +299,11 @@ class Source(models.Model): @property def directory_path(self): + download_dir = Path(media_file_storage.location) if self.source_resolution == self.SOURCE_RESOLUTION_AUDIO: - return settings.SYNC_AUDIO_ROOT / self.directory + return download_dir / settings.DOWNLOAD_AUDIO_DIR / self.directory else: - return settings.SYNC_VIDEO_ROOT / self.directory + return download_dir / settings.DOWNLOAD_VIDEO_DIR / self.directory def make_directory(self): return os.makedirs(self.directory_path, exist_ok=True) @@ -483,6 +488,7 @@ class Media(models.Model): max_length=200, blank=True, null=True, + storage=media_file_storage, help_text=_('Media file') ) downloaded = models.BooleanField( @@ -656,26 +662,29 @@ class Media(models.Model): @property def filename(self): + if self.media_file: + return os.path.basename(self.media_file.name) upload_date = self.upload_date dateobj = upload_date if upload_date else self.created datestr = dateobj.strftime('%Y-%m-%d') - source_name = slugify(self.source.name) - name = slugify(self.name.replace('&', 'and').replace('+', 'and'))[:50] - key = self.key.strip() - fmt = self.source.source_resolution.lower() - if self.source.is_audio(): - codecs = self.source.source_acodec.lower() + source_name = slugify(self.source.name).replace('_', '-') + name = slugify(self.name.replace('&', 'and').replace('+', 'and')) + name = name.replace('_', '-')[:80] + key = self.key.strip().replace('_', '-')[:20] + fmt = [] + if self.source.is_audio: + fmt.append(self.source.source_acodec.lower()) else: - codecs = [] - vcodec = self.source.source_vcodec.lower() - acodec = self.source.source_acodec.lower() - if vcodec: - codecs.append(vcodec) - if acodec: - codecs.append(acodec) - codecs = '-'.join(codecs) + fmt.append(self.source.source_resolution.lower()) + fmt.append(self.source.source_vcodec.lower()) + fmt.append(self.source.source_acodec.lower()) + if self.source.prefer_60fps: + fmt.append('60fps') + if self.source.prefer_hdr: + fmt.append('hdr') + fmt = '-'.join(fmt) ext = self.source.extension - return f'{datestr}_{source_name}_{name}_{key}-{fmt}-{codecs}.{ext}' + return f'{datestr}_{source_name}_{name}_{key}_{fmt}.{ext}' @property def filepath(self): diff --git a/tubesync/sync/templates/sync/media-item.html b/tubesync/sync/templates/sync/media-item.html index 836a6e9..48c04d0 100644 --- a/tubesync/sync/templates/sync/media-item.html +++ b/tubesync/sync/templates/sync/media-item.html @@ -32,9 +32,13 @@