Commit 83fa3764 authored by EorlBruder's avatar EorlBruder
Browse files

Refactor the setting of year after code review

parent 38885965
Pipeline #14720 passed with stage
in 52 seconds
......@@ -61,11 +61,10 @@ def extract_filename_params(track_data, format):
filename_params["album"] = filename_params.get("album_title", None)
filename_params["artist"] = filename_params.get("artist_name", None)
filename_params["extension"] = format
filename_params["year"] = (
filename_params.get("album_release_date", None)[:4]
if filename_params.get("album_release_date", None)
else None
)
try:
filename_params["year"] = filename_params["album_release_date"][:4]
except (KeyError, TypeError):
filename_params["year"] = None
return {
k: utils.sanitize_recursive(v) for k, v in filename_params.items()
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment