示例#1
0
void Environment::addPlaylist(SoundFile* file)
{
	Playlist* list = new Playlist(file, this);
	if (!m_playlists.contains(list))
	{
		m_playlists.append(list);
		emit playlistAdded(list);
	}
}
示例#2
0
Playlists::PlaylistPtr
IpodPlaylistProvider::save( const Meta::TrackList &tracks, const QString &name )
{
    if( !isWritable() )
        return Playlists::PlaylistPtr();

    IpodPlaylist *playlist = new IpodPlaylist( tracks, name, m_coll );
    itdb_playlist_add( m_coll->m_itdb, playlist->itdbPlaylist(), -1 );
    Playlists::PlaylistPtr playlistPtr( playlist );
    m_playlists << playlistPtr;
    subscribeTo( playlistPtr );
    emit playlistAdded( playlistPtr );
    emit startWriteDatabaseTimer();
    return playlistPtr;
}
示例#3
0
void SpotWorker::emitLoggedInSignal(sp_session *session, sp_error error)
{
    if (SP_ERROR_OK != error) {
        fprintf(stderr, "SpotWorker: Login failed: %s\n",
                sp_error_message(error));
    }
    else{
        printf("SpotWorker: Successfully logged in\n");

        emit loggedIn(session, error);

        sp_playlistcontainer *playlists = sp_session_playlistcontainer(session);
        void * userdata = NULL;
        sp_playlistcontainer_add_callbacks(playlists,
                                           &pc_callbacks,
                                           userdata);

        int listCount = sp_playlistcontainer_num_playlists(playlists);
        printf("%d playlists discovered\n", sp_playlistcontainer_num_playlists(playlists));

        if(listCount > 0)
            emit playlistAdded(playlists);

        for (int i = 0; i < listCount && i < 10; ++i) {
            sp_playlist *pl = sp_playlistcontainer_playlist(playlists, i);

            //TODO: register playback callback
            //sp_playlist_add_callbacks(pl, &pl_callbacks, NULL);

            if (sp_playlist_is_loaded(pl)){
                DEBUG printf("Playlist found: %s (%i tracks)\n",
                             sp_playlist_name(pl), sp_playlist_num_tracks(pl));
            }
        }
	DEBUG {
	    if (listCount > 10)
		printf("...and %d more.\n", listCount-10);
	}
    }
}
示例#4
0
void SpotWorker::emitPlaylistAdded(sp_playlistcontainer *playlists)
{
    emit playlistAdded(playlists);
}