From b6334ce41cdb99dde71d638a7c2e02c49fb40109 Mon Sep 17 00:00:00 2001 From: tcely Date: Mon, 10 Feb 2025 08:18:22 -0500 Subject: [PATCH] Add `timestamp` to mappings Return `field` instead of '' so that a missing mapping returns itself. --- tubesync/sync/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 2daeb094..f406e5e0 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -664,6 +664,11 @@ class Media(models.Model): Source.SOURCE_TYPE_YOUTUBE_CHANNEL_ID: 'upload_date', Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: 'upload_date', }, + 'timestamp': { + Source.SOURCE_TYPE_YOUTUBE_CHANNEL: 'timestamp', + Source.SOURCE_TYPE_YOUTUBE_CHANNEL_ID: 'timestamp', + Source.SOURCE_TYPE_YOUTUBE_PLAYLIST: 'timestamp', + }, 'title': { Source.SOURCE_TYPE_YOUTUBE_CHANNEL: 'title', Source.SOURCE_TYPE_YOUTUBE_CHANNEL_ID: 'title', @@ -944,7 +949,7 @@ class Media(models.Model): def get_metadata_field(self, field): fields = self.METADATA_FIELDS.get(field, {}) - return fields.get(self.source.source_type, '') + return fields.get(self.source.source_type, field) def iter_formats(self): for fmt in self.formats: