From 3ad59898b4a47620be3e58fcdf6d75a7631d3afa Mon Sep 17 00:00:00 2001 From: gnome-mpv Date: Fri, 10 May 2024 17:11:12 -0500 Subject: [PATCH] player: Load scripts in directories Fixes #946. --- src/celluloid-player.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/celluloid-player.c b/src/celluloid-player.c index 5fb56989..37e82755 100644 --- a/src/celluloid-player.c +++ b/src/celluloid-player.c @@ -1006,28 +1006,20 @@ load_scripts(CelluloidPlayer *player) if(dir) { - const gchar *name; + const gchar *name = g_dir_read_name(dir); - do + while(name) { - gchar *full_path; - - name = g_dir_read_name(dir); - full_path = g_build_filename(path, name, NULL); + gchar *full_path = g_build_filename(path, name, NULL); + const gchar *cmd[] = {"load-script", full_path, NULL}; - if(g_file_test(full_path, G_FILE_TEST_IS_REGULAR)) - { - const gchar *cmd[] - = {"load-script", full_path, NULL}; + g_info("Loading script: %s", full_path); + celluloid_mpv_command(CELLULOID_MPV(player), cmd); - g_info("Loading script: %s", full_path); - celluloid_mpv_command - (CELLULOID_MPV(player), cmd); - } + name = g_dir_read_name(dir); g_free(full_path); } - while(name); g_dir_close(dir); }