Merge branch '740-skipped-track-position' into 'develop'

Fix #740: Do not consider tracks as duplicates during import if they have different positions

Closes #740

See merge request funkwhale/funkwhale!695
merge-requests/757/head
Eliot Berriot 2019-03-27 12:58:29 +01:00
commit 583a6ddf08
3 zmienionych plików z 23 dodań i 1 usunięć

Wyświetl plik

@ -503,7 +503,9 @@ def _get_track(data):
# get / create track
track_title = data["title"]
track_number = data.get("track_number", 1)
query = Q(title__iexact=track_title, artist=artist, album=album)
query = Q(
title__iexact=track_title, artist=artist, album=album, position=track_number
)
if track_mbid:
query |= Q(mbid=track_mbid)
if track_fid:

Wyświetl plik

@ -156,6 +156,25 @@ def test_can_create_track_from_file_metadata_distinct_release_mbid(factories):
assert new_track != track
def test_can_create_track_from_file_metadata_distinct_position(factories):
"""Cf https://dev.funkwhale.audio/funkwhale/funkwhale/issues/740"""
artist = factories["music.Artist"]()
album = factories["music.Album"](artist=artist)
track = factories["music.Track"](album=album, artist=artist)
metadata = {
"artist": artist.name,
"album": album.title,
"title": track.title,
"track_number": track.position + 1,
"musicbrainz_artistid": artist.mbid,
"musicbrainz_albumid": album.mbid,
}
new_track = tasks.get_track_from_import_metadata(metadata)
assert new_track != track
def test_can_create_track_from_file_metadata_federation(factories, mocker, r_mock):
metadata = {
"artist": "Artist",

Wyświetl plik

@ -0,0 +1 @@
Do not consider tracks as duplicates during import if they have different positions (#740)