Skip to content

Commit f002609

Browse files
Walk all plugins to find the necessary actions
1 parent fdfd001 commit f002609

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

.github/workflows/linuxbuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
./configure
2626
make
2727
- name: Upload artifact
28-
uses: actions/upload-artifact@v2
28+
uses: actions/upload-artifact@v4
2929
with:
3030
name: mpris-linux-x86_64
3131
path: .libs/mpris.so

src/mpris.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,25 @@ static int onConnect() {
7575
}
7676

7777
DB_plugin_t *hotkeysPlugin = mprisData.deadbeef->plug_get_for_id ("hotkeys");
78-
79-
if (hotkeysPlugin != NULL) {
80-
debug("hotkeys plugin detected...\n");
81-
82-
DB_plugin_action_t *dbaction;
83-
84-
for (dbaction = hotkeysPlugin->get_actions (NULL); dbaction; dbaction = dbaction->next) {
78+
DB_plugin_t **plugins = mprisData.deadbeef->plug_get_list();
79+
for (int i = 0; plugins[i]; i++) {
80+
for (DB_plugin_action_t *dbaction = plugins[i]->get_actions(NULL); dbaction; dbaction = dbaction->next) {
8581
if (strcmp(dbaction->name, "prev_or_restart") == 0) {
8682
debug("prev_or_restart command detected... previous or restart support enabled\n");
8783
mprisData.prevOrRestart = dbaction;
8884
break;
8985
}
90-
}
86+
}
9187

92-
if (mprisData.prevOrRestart == NULL) {
93-
debug("prev_or_restart command not detected... previous or restart support disabled\n");
94-
}
95-
} else {
96-
debug("hotkeys plugin not detected... previous or restart support disabled\n");
97-
}
88+
if (mprisData.prevOrRestart != NULL) {
89+
break;
90+
}
91+
}
92+
93+
94+
if (mprisData.prevOrRestart == NULL) {
95+
debug("prev_or_restart command not detected... previous or restart support disabled\n");
96+
}
9897

9998
return 0;
10099
}

0 commit comments

Comments
 (0)