diff --git a/tubesync/sync/models.py b/tubesync/sync/models.py index 671600b1..874bc7f7 100644 --- a/tubesync/sync/models.py +++ b/tubesync/sync/models.py @@ -370,6 +370,8 @@ class Source(models.Model): 'yyyymmdd': timezone.now().strftime('%Y%m%d'), 'yyyy_mm_dd': timezone.now().strftime('%Y-%m-%d'), 'yyyy': timezone.now().strftime('%Y'), + 'mm': timezone.now().strftime('%m'), + 'dd': timezone.now().strftime('%d'), 'source': self.slugname, 'source_full': self.name, 'title': 'some-media-title-name', @@ -805,6 +807,8 @@ class Media(models.Model): 'yyyymmdd': dateobj.strftime('%Y%m%d'), 'yyyy_mm_dd': dateobj.strftime('%Y-%m-%d'), 'yyyy': dateobj.strftime('%Y'), + 'mm': dateobj.strftime('%m'), + 'dd': dateobj.strftime('%d'), 'source': self.source.slugname, 'source_full': self.source.name, 'title': self.slugtitle, diff --git a/tubesync/common/templates/mediaformatvars.html b/tubesync/sync/templates/sync/_mediaformatvars.html similarity index 88% rename from tubesync/common/templates/mediaformatvars.html rename to tubesync/sync/templates/sync/_mediaformatvars.html index bbad0b4c..71c17706 100644 --- a/tubesync/common/templates/mediaformatvars.html +++ b/tubesync/sync/templates/sync/_mediaformatvars.html @@ -11,18 +11,28 @@ {yyyymmdd} Media publish date in YYYYMMDD - 20210101 + 20210131 {yyyy_mm_dd} Media publish date in YYYY-MM-DD - 2021-01-01 + 2021-01-31 {yyyy} Media publish year in YYYY 2021 + + {mm} + Media publish year in MM + 01 + + + {dd} + Media publish year in DD + 31 + {source} Lower case source name, max 80 chars diff --git a/tubesync/sync/templates/sync/source-add.html b/tubesync/sync/templates/sync/source-add.html index d0e7a7ab..fd3b1fbf 100644 --- a/tubesync/sync/templates/sync/source-add.html +++ b/tubesync/sync/templates/sync/source-add.html @@ -25,7 +25,7 @@
-{% include 'mediaformatvars.html' %} +{% include 'sync/_mediaformatvars.html' %}
{% endblock %} diff --git a/tubesync/sync/templates/sync/source-update.html b/tubesync/sync/templates/sync/source-update.html index ed0136fa..1adf652b 100644 --- a/tubesync/sync/templates/sync/source-update.html +++ b/tubesync/sync/templates/sync/source-update.html @@ -27,7 +27,7 @@
-{% include 'mediaformatvars.html' %} +{% include 'sync/_mediaformatvars.html' %}
{% endblock %} diff --git a/tubesync/sync/tests.py b/tubesync/sync/tests.py index f3f4d99f..c2a725e5 100644 --- a/tubesync/sync/tests.py +++ b/tubesync/sync/tests.py @@ -507,6 +507,12 @@ class FilepathTestCase(TestCase): self.source.media_format = 'test-{yyyy}' self.assertEqual(self.source.get_example_media_format(), 'test-' + timezone.now().strftime('%Y')) + self.source.media_format = 'test-{mm}' + self.assertEqual(self.source.get_example_media_format(), + 'test-' + timezone.now().strftime('%m')) + self.source.media_format = 'test-{dd}' + self.assertEqual(self.source.get_example_media_format(), + 'test-' + timezone.now().strftime('%d')) self.source.media_format = 'test-{source}' self.assertEqual(self.source.get_example_media_format(), 'test-' + self.source.slugname)