Commit 4252ae34 authored by Agate's avatar Agate 💬
Browse files

Merge branch '1246-rescan-update-genre-tags' into 'develop'

Allow genre tags to be updated when rescanning files in-place

See merge request funkwhale/funkwhale!1225
parents 968e66eb 48453256
...@@ -937,6 +937,8 @@ def update_track_metadata(audio_metadata, track): ...@@ -937,6 +937,8 @@ def update_track_metadata(audio_metadata, track):
if obj_updated_fields: if obj_updated_fields:
obj.save(update_fields=obj_updated_fields) obj.save(update_fields=obj_updated_fields)
tags_models.set_tags(track, *new_data.get("tags", []))
if track.album and "album" in new_data and new_data["album"].get("cover_data"): if track.album and "album" in new_data and new_data["album"].get("cover_data"):
common_utils.attach_file( common_utils.attach_file(
track.album, "attachment_cover", new_data["album"].get("cover_data") track.album, "attachment_cover", new_data["album"].get("cover_data")
......
...@@ -1364,6 +1364,7 @@ def test_update_track_metadata(factories): ...@@ -1364,6 +1364,7 @@ def test_update_track_metadata(factories):
"license": "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/", "license": "Dummy license: http://creativecommons.org/licenses/by-sa/4.0/",
"copyright": "Someone", "copyright": "Someone",
"comment": "hello there", "comment": "hello there",
"genre": "classical",
} }
tasks.update_track_metadata(metadata.FakeMetadata(data), track) tasks.update_track_metadata(metadata.FakeMetadata(data), track)
...@@ -1382,6 +1383,9 @@ def test_update_track_metadata(factories): ...@@ -1382,6 +1383,9 @@ def test_update_track_metadata(factories):
assert str(track.artist.mbid) == data["musicbrainz_artistid"] assert str(track.artist.mbid) == data["musicbrainz_artistid"]
assert track.album.artist.name == "Edvard Grieg" assert track.album.artist.name == "Edvard Grieg"
assert str(track.album.artist.mbid) == "013c8e5b-d72a-4cd3-8dee-6c64d6125823" assert str(track.album.artist.mbid) == "013c8e5b-d72a-4cd3-8dee-6c64d6125823"
assert sorted(track.tagged_items.values_list("tag__name", flat=True)) == [
"classical"
]
def test_fs_import_not_pending(factories): def test_fs_import_not_pending(factories):
......
Allow genre tags to be updated when rescanning files in-place (#1246)
...@@ -145,6 +145,7 @@ Funkwhale will pick up the new title. The following fields can be updated this w ...@@ -145,6 +145,7 @@ Funkwhale will pick up the new title. The following fields can be updated this w
- Track title - Track title
- Track position and disc number - Track position and disc number
- Track license and copyright - Track license and copyright
- Track genre
- Album cover - Album cover
- Album title - Album title
- Album mbid - Album mbid
......
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