A few small fixes (#432)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 21 Jul 2022 23:56:39 +0000 (01:56 +0200)
committerGitHub <noreply@github.com>
Thu, 21 Jul 2022 23:56:39 +0000 (01:56 +0200)
* fix artist splitter

do not split artist on &

* fix repeat

* fix add to queue when shuffle is enabled

* typos

music_assistant/helpers/tags.py
music_assistant/models/player_queue.py

index fa4547fa5b85aef3bb22ef7ad8d8f2cb4db43a0c..3063c2f54e6fbf1cadefdb7ab45d5f3f5b6bc67a 100644 (file)
@@ -13,7 +13,10 @@ from music_assistant.models.errors import InvalidDataError
 
 FALLBACK_ARTIST = "Various Artists"
 
-SPLITTERS = (";", ",", "Featuring", " Feat. ", " Feat ", "feat.", " & ", "/ ")
+# allowed splitters for titles and artists strings
+# NOTE: do not use '&' or '/' as splitter here as it will cause issues with artists
+# actually having that in the name
+SPLITTERS = (";", ",", "Featuring", " Feat. ", " Feat ", "feat.")
 
 
 def split_items(org_str: str) -> Tuple[str]:
index be9c2b2cc015b855fa3ab1e8e2550197bf7fce93..0ee41734555685fae6fc449efc99bba7af8ea856 100644 (file)
@@ -618,14 +618,17 @@ class PlayerQueue:
             if cur_index is None:
                 played_items = []
                 next_items = self.items + queue_items
-                cur_item = []
+                cur_items = []
             else:
                 played_items = self.items[:cur_index] if cur_index is not None else []
                 next_items = self.items[cur_index + 1 :] + queue_items
-                cur_item = [self.get_item(cur_index)]
+                if cur_item := self.get_item(cur_index):
+                    cur_items = [cur_item]
+                else:
+                    cur_items = []
             # do the shuffle
             next_items = random.sample(next_items, len(next_items))
-            queue_items = played_items + cur_item + next_items
+            queue_items = played_items + cur_items + next_items
         else:
             queue_items = self._items + queue_items
         await self.update_items(queue_items)
@@ -647,16 +650,10 @@ class PlayerQueue:
             self.signal_update()
             if self.player.state == PlayerState.IDLE:
 
-                # handle end of queue
-                if self._current_index is not None and self._current_index >= (
-                    len(self._items) - 1
-                ):
-                    self._current_index += 1
-                    self._current_item_elapsed_time = 0
-
                 # handle case where stream stopped on purpose and we need to restart it
-                elif self.signal_next:
+                if self.signal_next:
                     self.signal_next = False
+                    self._current_item_elapsed_time = 0
                     self.mass.create_task(self.resume())
 
         self.update_state()