Exemplo n.º 1
0
void playlist_clear(struct playlist *pl)
{
    while (pl->first)
        playlist_remove(pl, pl->first);
    assert(!pl->current);
    pl->current_was_replaced = false;
}
Exemplo n.º 2
0
void command_pldelete(const struct command * const command)
{
	if(playlist_remove(command->playlist))
	{
		sock_send_str(command->sockfd, "Removed playlist.\n");
	}
	else
	{
		sock_send_str(command->sockfd, "Couldn't remove playlist.\n");
	}
}
Exemplo n.º 3
0
gboolean handle_event_when_idle(G_GNUC_UNUSED gpointer data)
{
    GFile * file = g_queue_pop_head(&event_queue);
    gchar * uri = g_file_get_uri(file);
    g_object_unref(file);
    if(uri)
    {
        gint pos = locate(uri);
        GHashTable * meta = db_get_noadd(uri);
        gboolean has_meta = g_hash_table_size(meta);
        if(pos > -1)
        {
            if(!has_meta)
                playlist_remove(pos);
            db_schedule_update(uri);
            g_free(uri);
        }
        else if(has_meta)
            playlist_append(uri);
    }
    return !g_queue_is_empty(&event_queue);
}
Exemplo n.º 4
0
Arquivo: fifo.c Projeto: hsgg/quark
static void
fifo_execute (const char *command)
{
    if (!g_ascii_strncasecmp (command, "quit", 4))
        main_quit ();
    else if (!g_ascii_strncasecmp (command, "play", 4))
        music_play ();
    else if (!g_ascii_strncasecmp (command, "pause", 5))
        if (music_playing)
            music_pause ();
        else
            music_play ();
    else if (!g_ascii_strncasecmp (command, "stop", 4))
        music_stop ();
    else if (!g_ascii_strncasecmp (command, "next", 4)) {
        playlist_advance (1, TRUE);
    }
    else if (!g_ascii_strncasecmp (command, "prev", 4)) {
        playlist_advance (-1, TRUE);
    }
    else if (!g_ascii_strncasecmp (command, "append", 6)) {
        if (strlen (command) > 7) {
            gchar *u;
            const gchar *path;

            path = (command + 7);
            if (!(u = g_filename_to_utf8 (path, -1, NULL, NULL, NULL))) {
                g_warning (_("Skipping '%s'. Could not convert to UTF-8. "
                             "See the README for a possible solution."), path);
            } else {
                playlist_append_single (u);
                g_free (u);
            }
        }
    }
    else if (!g_ascii_strncasecmp (command, "track", 5)) {
        if (strlen (command) > 6) {
            int i = atoi (command + 6);
            playlist_seek (i - 1); /* first track is '1' */
        }
    }
    else if (!g_ascii_strncasecmp (command, "remove", 6)) {
        if (strlen (command) > 7) {
            int i = atoi (command + 7);
            playlist_remove (i - 1); /* first track is '1' */
        }
    }
    else if (!g_ascii_strncasecmp (command, "clear", 5)) {
        playlist_clear ();
    }
    else if (!g_ascii_strncasecmp (command, "move", 4)) {
        if (strlen (command) > 5) {
            char *p;
            int i = strtol (command + 5, &p, 10);
            if (strlen (command) > (unsigned)(p - command)) {
                int before = atoi (p);
                playlist_move (i - 1, before - 1); /* first track is '1' */
            }
        }
    }
    else if (!g_ascii_strncasecmp (command, "loop", 4)) {
        main_set_loop_at_end(!main_loop_at_end);
    }
    else if (!g_ascii_strncasecmp (command, "random", 6)) {
        main_set_random_order(!main_random_order);
    }
    else if (!g_ascii_strncasecmp (command, "dump", 4)) {
        playlist_dump ();
    }
    else if (!g_ascii_strncasecmp (command, "connect", 7)) {
        if (strlen (command) > 8) {
            fifo_add_notify (command + 8);
        }
    }

}