summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2021-11-15 15:01:00 -0500
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-04-05 16:52:06 -0400
commita93bf72318c96c4fee369744f06283211e898c17 (patch)
tree14e703e5e354190815d27889321505e44d9d369e
parent520141a872fe64cd2eb894033142826a96b0beb0 (diff)
Prevent empty dates from not tagging years
-rwxr-xr-xjamos12
1 files changed, 9 insertions, 3 deletions
diff --git a/jamos b/jamos
index 2e6350e..30b2d32 100755
--- a/jamos
+++ b/jamos
@@ -61,9 +61,15 @@ def write_metadata_to_song_file(file, metadata):
def format_youtube_date(date):
- fmt = "%Y%m%d"
- d = datetime.datetime.strptime(date, fmt)
- return d.year
+ default = "Unknown Year"
+ try:
+ fmt = "%Y%m%d"
+ d = datetime.datetime.strptime(date, fmt)
+ return d.year
+ except Exception as ex:
+ print(ex)
+
+ return default
def sort_stuff():