fixed real ugly bug
This commit is contained in:
parent
838c2b5875
commit
9b9f3ec8f4
@ -331,6 +331,9 @@ class Album(MainObject):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if self.song_collection.empty:
|
||||||
|
return
|
||||||
|
|
||||||
tracksort_map: Dict[int, Song] = {
|
tracksort_map: Dict[int, Song] = {
|
||||||
song.tracksort: song for song in self.song_collection if song.tracksort is not None
|
song.tracksort: song for song in self.song_collection if song.tracksort is not None
|
||||||
}
|
}
|
||||||
@ -343,7 +346,22 @@ class Album(MainObject):
|
|||||||
I ONLY modify the `Collection._data` attribute directly,
|
I ONLY modify the `Collection._data` attribute directly,
|
||||||
to bypass the mapping of the attributes, because I will add the item in the next step
|
to bypass the mapping of the attributes, because I will add the item in the next step
|
||||||
"""
|
"""
|
||||||
self.song_collection._data.remove(song)
|
|
||||||
|
"""
|
||||||
|
but for some reason, neither
|
||||||
|
`self.song_collection._data.index(song)`
|
||||||
|
`self.song_collection._data.remove(song)`
|
||||||
|
get the right object.
|
||||||
|
|
||||||
|
I have NO FUCKING CLUE why xD
|
||||||
|
But I just implemented it myself.
|
||||||
|
"""
|
||||||
|
for old_index, temp_song in enumerate(self.song_collection._data):
|
||||||
|
if song is temp_song:
|
||||||
|
break
|
||||||
|
|
||||||
|
# the list can't be empty
|
||||||
|
del self.song_collection._data[old_index]
|
||||||
self.song_collection._data.insert(index, song)
|
self.song_collection._data.insert(index, song)
|
||||||
|
|
||||||
# fill in the empty tracksort attributes
|
# fill in the empty tracksort attributes
|
||||||
|
@ -890,6 +890,9 @@ class Musify(Page):
|
|||||||
|
|
||||||
album.update_tracksort()
|
album.update_tracksort()
|
||||||
|
|
||||||
|
print(album.song_collection)
|
||||||
|
print()
|
||||||
|
|
||||||
return album
|
return album
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user