Added repeat and shuffle commands
This commit is contained in:
@ -56,7 +56,9 @@ default_bindings = {">": "next_track",
|
|||||||
"i": "toggle_info",
|
"i": "toggle_info",
|
||||||
"down": "select_down",
|
"down": "select_down",
|
||||||
"up": "select_up",
|
"up": "select_up",
|
||||||
"enter": "select"
|
"enter": "select",
|
||||||
|
"x": "shuffle",
|
||||||
|
"r": "repeat"
|
||||||
}
|
}
|
||||||
|
|
||||||
if "keybindings" not in config.sections():
|
if "keybindings" not in config.sections():
|
||||||
@ -244,6 +246,15 @@ class Player:
|
|||||||
|
|
||||||
self.last_song = None
|
self.last_song = None
|
||||||
|
|
||||||
|
# Set repeat flag
|
||||||
|
current_status = self.client.status()
|
||||||
|
|
||||||
|
if "repeat" in current_status.keys():
|
||||||
|
self.repeat = current_status["repeat"]
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.repeat = 0
|
||||||
|
|
||||||
# Album art HTTP server
|
# Album art HTTP server
|
||||||
|
|
||||||
if art_config.get("http_base_url"):
|
if art_config.get("http_base_url"):
|
||||||
@ -788,6 +799,13 @@ class Player:
|
|||||||
self.update_needed = True
|
self.update_needed = True
|
||||||
self.last_song = None
|
self.last_song = None
|
||||||
|
|
||||||
|
elif action == "repeat":
|
||||||
|
self.repeat = int(not self.repeat)
|
||||||
|
self.client.repeat(self.repeat)
|
||||||
|
|
||||||
|
elif action == "shuffle":
|
||||||
|
self.client.shuffle()
|
||||||
|
|
||||||
|
|
||||||
key = self.stdscr.getch()
|
key = self.stdscr.getch()
|
||||||
|
|
||||||
@ -838,6 +856,14 @@ class Player:
|
|||||||
curses.color_pair(2)
|
curses.color_pair(2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Repeat string
|
||||||
|
if self.repeat:
|
||||||
|
repeat_string = "r"
|
||||||
|
self.art_win.addstr(
|
||||||
|
self.text_start + 3, 0,
|
||||||
|
repeat_string,
|
||||||
|
)
|
||||||
|
|
||||||
self.art_win.refresh()
|
self.art_win.refresh()
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user