diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..86533f7
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/tubesync.iml b/.idea/tubesync.iml
new file mode 100644
index 0000000..ef6a1af
--- /dev/null
+++ b/.idea/tubesync.iml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tubesync/sync/migrations/0021_add_lightweight_metadata.py b/tubesync/sync/migrations/0021_add_lightweight_metadata.py
new file mode 100644
index 0000000..615def1
--- /dev/null
+++ b/tubesync/sync/migrations/0021_add_lightweight_metadata.py
@@ -0,0 +1,22 @@
+# Generated by pac
+
+from django.db import migrations, models
+from sync.models import Source
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ('sync', '0020_auto_20231024_1825'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='source',
+ name='lightweight_metadata',
+ field=models.CharField(max_length=20,
+ default=Source.LIGHTWEIGHT_METADATA_TYPE_RAW,
+ choices=Source.LIGHTWEIGHT_METADATA_TYPE_CHOICES,
+ help_text='Lightweight metadata',
+ verbose_name='lightweight metadata'),
+ ),
+ ]
diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py
index a5b8d68..c34333d 100644
--- a/tubesync/sync/models.py
+++ b/tubesync/sync/models.py
@@ -387,6 +387,24 @@ class Source(models.Model):
]
)
+ LIGHTWEIGHT_METADATA_TYPE_RAW = 'RAW'
+ LIGHTWEIGHT_METADATA_TYPE_UNNECESSARY = 'UNNECESSARY'
+ LIGHTWEIGHT_METADATA_TYPE_FEATHER = 'FEATHER'
+ LIGHTWEIGHT_METADATA_TYPES = (LIGHTWEIGHT_METADATA_TYPE_RAW, LIGHTWEIGHT_METADATA_TYPE_UNNECESSARY, LIGHTWEIGHT_METADATA_TYPE_FEATHER)
+ LIGHTWEIGHT_METADATA_TYPE_CHOICES = (
+ (LIGHTWEIGHT_METADATA_TYPE_RAW, _("(LARGE) Save raw metadata")),
+ (LIGHTWEIGHT_METADATA_TYPE_UNNECESSARY, _("(MEDIUM) Treeshake unnecessary metadata json keys")),
+ (LIGHTWEIGHT_METADATA_TYPE_FEATHER, _("(TINY) if the capacity is large, Treeshake it event if it is in use")),
+ )
+
+ lightweight_metadata = models.CharField(
+ _('lightweight metadata'),
+ max_length=20,
+ default=LIGHTWEIGHT_METADATA_TYPE_RAW,
+ choices=LIGHTWEIGHT_METADATA_TYPE_CHOICES,
+ help_text=_('Lightweight metadata')
+ )
+
def __str__(self):
return self.name
@@ -550,7 +568,7 @@ class Source(models.Model):
if not self.filter_text:
return True
return bool(re.search(self.filter_text, media_item_title))
-
+
def index_media(self):
'''
Index the media source returning a list of media metadata as dicts.
@@ -869,7 +887,7 @@ class Media(models.Model):
def get_best_video_format(self):
return get_best_video_format(self)
-
+
def get_format_str(self):
'''
Returns a youtube-dl compatible format string for the best matches
@@ -894,7 +912,7 @@ class Media(models.Model):
else:
return False
return False
-
+
def get_display_format(self, format_str):
'''
Returns a tuple used in the format component of the output filename. This
@@ -1185,7 +1203,7 @@ class Media(models.Model):
filename = self.filename
prefix, ext = os.path.splitext(filename)
return f'{prefix}.nfo'
-
+
@property
def nfopath(self):
return self.source.directory_path / self.nfoname
@@ -1198,7 +1216,7 @@ class Media(models.Model):
filename = self.filename
prefix, ext = os.path.splitext(filename)
return f'{prefix}.info.json'
-
+
@property
def jsonpath(self):
return self.source.directory_path / self.jsonname
diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py
index 5ecfd5e..9125653 100644
--- a/tubesync/sync/tasks.py
+++ b/tubesync/sync/tasks.py
@@ -236,6 +236,12 @@ def download_media_metadata(media_id):
return
source = media.source
metadata = media.index_metadata()
+ if source.lightweight_metadata == Source.LIGHTWEIGHT_METADATA_TYPE_FEATHER:
+ del metadata["formats"]
+ del metadata["thumbnails"]
+ del metadata["automatic_captions"]
+ del metadata["requested_formats"]
+ del metadata["heatmap"]
media.metadata = json.dumps(metadata, default=json_serial)
upload_date = media.upload_date
# Media must have a valid upload date
diff --git a/tubesync/sync/templates/sync/media-item.html b/tubesync/sync/templates/sync/media-item.html
index 4f0e524..55d8565 100644
--- a/tubesync/sync/templates/sync/media-item.html
+++ b/tubesync/sync/templates/sync/media-item.html
@@ -132,6 +132,8 @@
Can download? {% if media.can_download %} {% else %} {% endif %}
{% endif %}
+
+ {% if media.source.lightweight_metadata == "RAW" %}
Available formats
Available formats
@@ -155,7 +157,10 @@
Video: {% if video_format %}{{ video_format }} {% if video_exact %}(exact match){% else %}(fallback){% endif %}{% else %}no match{% endif %}
+ {% endif %}
+ {{ media.source.lightweight_metadata }}
+ {{ media.source }}
{% if media.downloaded %}
diff --git a/tubesync/sync/templates/sync/source.html b/tubesync/sync/templates/sync/source.html
index c5812b2..842758c 100644
--- a/tubesync/sync/templates/sync/source.html
+++ b/tubesync/sync/templates/sync/source.html
@@ -186,7 +186,17 @@
{{ _("Subs langs?") }}: {{source.sub_langs}}
{% endif %}
-
+
+ {% if source.lightweight_metadata %}
+
+ {{ _("Auto-generated subtitles?") }}:
+ {{ _("Auto-generated subtitles?") }}:
+
+
+ {{ _("Subs langs?") }}:
+ {{ _("Subs langs?") }}: {{source.sub_langs}}
+
+ {% endif %}
diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py
index 0b808eb..464c96a 100644
--- a/tubesync/sync/views.py
+++ b/tubesync/sync/views.py
@@ -300,7 +300,7 @@ class EditSourceMixin:
'source_acodec', 'prefer_60fps', 'prefer_hdr', 'fallback', 'copy_thumbnails',
'write_nfo', 'write_json', 'embed_metadata', 'embed_thumbnail',
'enable_sponsorblock', 'sponsorblock_categories', 'write_subtitles',
- 'auto_subtitles', 'sub_langs')
+ 'auto_subtitles', 'sub_langs', 'lightweight_metadata')
errors = {
'invalid_media_format': _('Invalid media format, the media format contains '
'errors or is empty. Check the table at the end of '