Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/audacious/dbus-server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,18 @@ static gboolean do_playlist_add(Obj * obj, Invoc * invoc, const char * list)
return true;
}

static gboolean do_playlist_save(Obj * obj, Invoc * invoc, const char * url)
{
bool success;
ENTER_MAIN_THREAD(url, &success)
auto mode =
aud_get_bool("metadata_on_play") ? Playlist::NoWait : Playlist::Wait;
success = CURRENT.save_to_file(url, mode);
LEAVE_MAIN_THREAD()
FINISH2(playlist_save, success);
return true;
}

Comment thread
jlindgren90 marked this conversation as resolved.
static gboolean do_playlist_enqueue_to_temp(Obj * obj, Invoc * invoc,
const char * url)
{
Expand Down Expand Up @@ -1045,6 +1057,7 @@ static const struct
{"handle-play-pause", (GCallback)do_play_pause},
{"handle-playing", (GCallback)do_playing},
{"handle-playlist-add", (GCallback)do_playlist_add},
{"handle-playlist-save", (GCallback)do_playlist_save},
{"handle-playlist-enqueue-to-temp", (GCallback)do_playlist_enqueue_to_temp},
{"handle-playlist-ins-url-string", (GCallback)do_playlist_ins_url_string},
{"handle-playqueue-add", (GCallback)do_playqueue_add},
Expand Down
1 change: 1 addition & 0 deletions src/audtool/audtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ void playlist_display (int, char * *);
void playlist_position (int, char * *);
void playlist_jump (int, char * *);
void playlist_add_url_string (int, char * *);
void playlist_save (int, char * *);
void playlist_delete (int, char * *);
void playlist_clear (int, char * *);
void playlist_repeat_status (int, char * *);
Expand Down
30 changes: 30 additions & 0 deletions src/audtool/handlers_playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,36 @@ void playlist_add_url_string (int argc, char * * argv)
g_free (uri);
}

void playlist_save (int argc, char * * argv)
{
char * uri;
gboolean success = FALSE;

if (argc < 2)
{
audtool_whine_args (argv[0], "<url>");
exit (1);
}

uri = construct_uri (argv[1]);

if (! uri)
exit (1);

obj_audacious_call_playlist_save_sync (dbus_proxy, uri, & success, NULL, NULL);

if (! success)
{
audtool_report ("Error saving %s:\nMake sure to use a supported "
"file extension and that the respective playlist "
"plugin is enabled.", uri);
g_free (uri);
exit (1);
}
else
g_free (uri);
}

void playlist_delete (int argc, char * * argv)
{
int pos = check_args_playlist_pos (argc, argv);
Expand Down
1 change: 1 addition & 0 deletions src/audtool/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const struct commandhandler handlers[] =
{"playlist-shuffle-toggle", playlist_shuffle_toggle, "toggle playlist shuffle", 0},
{"playlist-stop-after-status", playlist_stop_after_status, "query if stopping after current song", 0},
{"playlist-stop-after-toggle", playlist_stop_after_toggle, "toggle if stopping after current song", 0},
{"playlist-save", playlist_save, "save playlist to given file path", 1},

{"<sep>", NULL, "More playlist commands", 0},
{"number-of-playlists", number_of_playlists, "print number of playlists", 0},
Expand Down
6 changes: 6 additions & 0 deletions src/dbus/aud-dbus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@
<arg type="u" direction="in" name="pos"/>
</method>

<!-- Save the playlist to given file path -->
<method name="PlaylistSave">
<arg type="s" direction="in" name="url"/>
<arg type="b" direction="out" name="success"/>
</method>

<!-- Clear the playlist -->
<method name="Clear" />

Expand Down
Loading