Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Option to add/replace tracks from playlists in dpsop #54

@junkmechanic

Description

@junkmechanic

Hi. I have prepared this small patch to include this functionality over the current commit (master 3890ab3f83fea51e8ecd23922dbae228f594c672)

diff --git a/dspop/dspop b/dspop/dspop
index 3de87ac..45545b2 100755
--- a/dspop/dspop
+++ b/dspop/dspop
@@ -273,18 +273,30 @@ def menu_playlist(sc, idx):
     current_track = sc.status()
     items.extend(format_tracks(tracks, current_track))

+    while True:
+        choice = dmenu(items)
+        if choice is None:
+            return False
+        elif choice == 0:
+            sc.play(idx)
+            return False
+        elif choice == 1:
+            sc.add(idx)
+            return False
+        else:
+            menu_track(sc, idx, choice - 1)
+            # sc.play(idx, choice-1)
+            # return True
+
+def menu_track(sc, idx, track):
+    items = ["[ Add to queue ]", "[ Replace queue ]"]
     choice = dmenu(items)
     if choice is None:
-        return False
+        return
     elif choice == 0:
-        sc.play(idx)
-        return False
+        sc.add(idx, track)
     elif choice == 1:
-        sc.add(idx)
-        return False
-    else:
-        sc.play(idx, choice-1)
-        return True
+        sc.play(idx, track)

 def menu_offline(sc):
     while True:

I hope this is desirable to others as well.

The other way is to make this a setting for the user to choose between always adding or replacing a track (that way the extra prompt wouldnt show up).
This can be an option that the user can specify in (and hence this would open the door to provisioning) a config file. I can create a pull request if you want to delve into something like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions