Skip to content

Commit fd02b14

Browse files
committed
prioritize spotify in mediaplayer
1 parent 862e751 commit fd02b14

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"text_rot_int": 1000,
1111
"image_signal": 4,
1212
"length_factor": 1,
13-
"player_name": ["firefox", "chrome", "chromium", "thorium", "spotify"],
13+
"player_name": ["spotify", "firefox", "chrome", "chromium", "thorium"],
1414
"convert_to_jpeg": false,
1515
"album_art_placeholder": "no",
1616
"lyrics_providers": ["Lrclib", "Musixmatch", "NetEase", "Megalobiz"],

src/mediaplayer

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ def get_active_player(manager, requested_players):
8484
)
8585
if result.returncode == 0:
8686
all_players = result.stdout.strip().split('\n')
87-
for player in all_players:
88-
if player and any(player.startswith(rp) for rp in requested_players):
89-
available_players.append(player)
87+
# Iterate over requested_players to maintain priority order
88+
for rp in requested_players:
89+
for player in all_players:
90+
if player and player.startswith(rp):
91+
if player not in available_players:
92+
available_players.append(player)
9093

9194
if not available_players:
9295
return None

0 commit comments

Comments
 (0)