Example #1
0
int playPlaylistById(FILE * fp, int id, int stopOnError) {
	if(id == -1) {
		return playPlaylist(fp, id, stopOnError);
	}

	checkSongId(id);

	return playPlaylist(fp, playlist.idToPosition[id], stopOnError);
}
Example #2
0
    void Player::play(const Alternative<String, const PlayList* > & item,
                      const XBMCAddon::xbmcgui::ListItem* listitem, bool windowed, int startpos)
    {
      XBMC_TRACE;

      if (&item == &defaultPlayParameter)
        playCurrent(windowed);
      else if (item.which() == XBMCAddon::first)
        playStream(item.former(), listitem, windowed);
      else // item is a PlayListItem
        playPlaylist(item.later(),windowed,startpos);
    }
Example #3
0
    void Player::play(const Alternative<String, const PlayList* > & item,
                      const XBMCAddon::xbmcgui::ListItem* listitem, bool windowed, int startpos)
    {
      TRACE;

      if (Alternative<String, const PlayList*>::isNullReference(item))
        playCurrent(windowed);
      else if (item.which() == XBMCAddon::first)
        playStream(item.former(), listitem, windowed);
      else // item is a PlayListItem
        playPlaylist(item.later(),windowed,startpos);
    }
Example #4
0
int handlePlay(FILE * fp, unsigned int * permission, int argArrayLength, 
		char ** argArray) 
{
        int song = -1;
        char * test;

        if(argArrayLength==2) {
                song = strtol(argArray[1],&test,10);
                if(*test!='\0') {
                        commandError(fp, ACK_ERROR_ARG,
					 "need a positive integer", NULL);
                        return -1;
                }
        }
        return playPlaylist(fp,song,0);
}
ClientResponse* SpotifyPlaylistContainer::processTask(PlaylistTask* task) {
	switch (task->getCommand()) {
	case CommandList:
		return listPlaylists(task);
		break;
	case CommandPlayPlaylist:
		return playPlaylist(task);
		break;
	case CommandPlayTrack:
		return playTrack(task);
		break;
	case CommandListTracks:
		return listTracks(task);
		break;
	}
	return nullptr;
}
Example #6
0
void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current,
		unsigned time) 
{
	char * ptrptr;
	char * temp;
	int song;

	if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) {
		ERROR("error parsing state file \"%s\"\n",playlist_stateFile);
		exit(EXIT_FAILURE);
	}
	while(strcmp(buffer,PLAYLIST_STATE_FILE_PLAYLIST_END)) {
		song = atoi(strtok_r(buffer,":",&ptrptr));
		if(!(temp = strtok_r(NULL,"",&ptrptr))) {
			ERROR("error parsing state file \"%s\"\n",
					playlist_stateFile);
			exit(EXIT_FAILURE);
		}
		if(addToPlaylist(stderr,temp)==0 && current==song) {
			if(state!=PLAYER_STATE_STOP) {
				playPlaylist(stderr,playlist.length-1,0);
			}
			if(state==PLAYER_STATE_PAUSE) {
				playerPause(stderr);
			}
			if(state!=PLAYER_STATE_STOP) {
				seekSongInPlaylist(stderr,playlist.length-1,
						time);
			}
		}
		if(!myFgets(buffer,PLAYLIST_BUFFER_SIZE,fp)) {
			ERROR("error parsing state file \"%s\"\n",
					playlist_stateFile);
			exit(EXIT_FAILURE);
		}
	}
}
void SoundCloudPlaylistWindow::loadBaseUi() {
    setWindowTitle(tr("Set"));
    setCentralWidget(new QWidget);
    
    m_view->setModel(m_model);
    m_view->setItemDelegate(m_delegate);
    m_view->setContextMenuPolicy(Qt::CustomContextMenu);
    
    m_thumbnail->setFixedSize(320, 320);
    m_thumbnail->setFallbackSource(QUrl::fromLocalFile("/usr/share/icons/hicolor/295x295/hildon/mediaplayer_default_album.png"));
    m_avatar->setFixedSize(60, 60);
    m_avatar->setFallbackSource(QUrl::fromLocalFile("/usr/share/icons/hicolor/64x64/hildon/general_default_avatar.png"));
    
    m_titleLabel->setWordWrap(true);
    m_dateLabel->setStyleSheet(QString("color: %1; font-size: 13pt").arg(palette().color(QPalette::Mid).name()));
    m_artistLabel->setStyleSheet("font-size: 13pt");
    m_noTracksLabel->hide();

    m_reloadAction->setEnabled(false);
    
    m_contextMenu->addAction(m_queueAction);
    m_contextMenu->addAction(m_downloadAction);
    m_contextMenu->addAction(m_shareAction);
    
    QWidget *scrollWidget = new QWidget(m_scrollArea);
    QGridLayout *grid = new QGridLayout(scrollWidget);
    grid->addWidget(m_thumbnail, 0, 0, 1, 2, Qt::AlignLeft);
    grid->addWidget(m_titleLabel, 1, 0, 1, 2);
    grid->addWidget(m_avatar, 2, 0, 2, 1, Qt::AlignLeft);
    grid->addWidget(m_artistLabel, 2, 1, Qt::AlignLeft | Qt::AlignTop);
    grid->addWidget(m_dateLabel, 3, 1, Qt::AlignLeft | Qt::AlignBottom);
    grid->addWidget(m_descriptionLabel, 4, 0, 1, 2);
    grid->setRowStretch(4, 1);
    grid->setColumnStretch(1, 1);
    grid->setContentsMargins(0, 0, 0, 0);
    m_scrollArea->setWidget(scrollWidget);
    m_scrollArea->setWidgetResizable(true);
    m_scrollArea->setFixedWidth(330);
    
    m_layout = new QHBoxLayout(centralWidget());
    m_layout->addWidget(m_scrollArea);
    m_layout->addWidget(m_view);
    m_layout->addWidget(m_noTracksLabel);
    m_layout->setStretch(1, 1);
    m_layout->setStretch(2, 1);
    m_layout->setContentsMargins(0, 0, 0, 0);

    menuBar()->addAction(m_reloadAction);
    menuBar()->addAction(m_queuePlaylistAction);
    menuBar()->addAction(m_nowPlayingAction);
    
    connect(m_model, SIGNAL(statusChanged(QSoundCloud::ResourcesRequest::Status)), this,
            SLOT(onModelStatusChanged(QSoundCloud::ResourcesRequest::Status)));
    connect(m_cache, SIGNAL(imageReady()), this, SLOT(onImageReady()));
    connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(showTrack(QModelIndex)));
    connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
    connect(m_thumbnail, SIGNAL(clicked()), this, SLOT(playPlaylist()));
    connect(m_delegate, SIGNAL(thumbnailClicked(QModelIndex)), this, SLOT(playTrack(QModelIndex)));
    connect(m_reloadAction, SIGNAL(triggered()), m_model, SLOT(reload()));
    connect(m_queuePlaylistAction, SIGNAL(triggered()), this, SLOT(queuePlaylist()));
    connect(m_avatar, SIGNAL(clicked()), this, SLOT(showArtist()));
    connect(m_descriptionLabel, SIGNAL(anchorClicked(QUrl)), this, SLOT(showResource(QUrl)));
    connect(m_queueAction, SIGNAL(triggered()), this, SLOT(queueTrack()));
    connect(m_downloadAction, SIGNAL(triggered()), this, SLOT(downloadTrack()));
    connect(m_shareAction, SIGNAL(triggered()), this, SLOT(shareTrack()));
    
    if (!SoundCloud::instance()->userId().isEmpty()) {
        m_favouriteAction = new QAction(this);
        m_contextMenu->addAction(m_favouriteAction);
        connect(m_favouriteAction, SIGNAL(triggered()), this, SLOT(setTrackFavourite()));
    }
}
Example #8
0
// Playlist
void *display_loop(void * unused)  {
	while (1) {
		plasmaWave();

		plasmaSea();

		plasmaBall();

		testBlur();

		uart_putstr("plasmaTest()\n");
		plasmaTest();
		uart_putstr("spirale()\n");
		spirale();

		playPlaylist("anims/playlist.apl");

		playAnimFile("anim1.prn");
		uart_putstr("colorSnakle()\n");
		colorSnake();
		uart_putstr("colorMatrix()\n");
		colorMatrix();
		//uart_putstr("flashLight()\n");
		//flashLight();
		uart_putstr("plasmaSnake()\n");
		plasmaSnake();
		//uart_putstr("funkyBeat()\n");
		//funkyBeat();
		//uart_putstr("symetricRoutes()\n");
		//symetricRoutes();

		uart_putstr("plasmaSnake()\n");
		plasmaSnake();
	    	//uart_putstr("shiftTest()\n");
		//shiftTest();
		uart_putstr("fadeTest()\n");
		fadeTest();
	    	//uart_putstr("symetricRoutes()\n");
		//symetricRoutes();
		//uart_putstr("cubes()\n");
		//cubes();
		//uart_putstr("brightnesTest()\n");
		//brightnesTest();
		uart_putstr("movingArrows()\n");
		movingArrows();
		uart_putstr("plasmaSnake()\n");
		plasmaSnake();
		uart_putstr("upgoingRandom()\n");
		upgoingRandom();
		uart_putstr("planeBall()\n");
		planeBall();
		uart_putstr("wobbeln()\n");
		wobbeln();
		uart_putstr("plasmaSnake()\n");
		plasmaSnake();
		//uart_putstr("snake()\n");
		//snake();
		uart_putstr("movingCubes()\n");
		movingCubes();
		uart_putstr("plasmaSnake()\n");
		plasmaSnake();
		uart_putstr("symetricRandom()\n");
		symetricRandom();
		uart_putstr("testAnim()\n");
		testAnim();
		//uart_putstr("fnordLicht()\n");
		//fnordLicht();

	}
	return 0;
}
Example #9
0
void Cli::cliArgs(char *argv[])
{
    int c;
    QStringList args;
    opterr = 0;

    while ((c = getopt(argc, argv, "aplndvx")) != -1)
    {
        switch (c)
        {
            //Play
            case 'p':
                pFlag = true;
                break;
            
            //Play Playlist
            case 'a':
                aFlag = true;
                break;
                
            //List playlists
            case 'l':
                lFlag = true;
                xFlag = true;
                break;
            
            //New Playlist
            case 'n':
                nFlag = true;
                xFlag = true;
                break;
            
            //Delete Playlist
            case 'd':
                dFlag = true;
                xFlag = true;
                break;
            
            //Display version info
            case 'v':
                xFlag = true;
                std::cout << "KaJammer Music Player " << KAJAMMER_VER << "\n";
                exit(1);
                break;
            
            //Don't bring up main window, no Xorg mode.
            case 'x':
                xFlag = true;
                break;
            
            //Command not recognized
            default:
                xFlag = true;
                std::cout << "Usage: kajammer [options...] [arguments...]\n";
                std::cout << "\t" << "Where options include:\n";
                std::cout << "\t" << "-p\t" << "play\t\t" << "[Files]\n";
                std::cout << "\t" << "-a\t" << "play playlist\t" << "Playlist name\n";
                std::cout << "\t" << "-n\t" << "new playlist\t" << "[Name] [Files]\n";
                std::cout << "\t" << "-d\t" << "delete playlist\t" << "[Playlists]\n";
                std::cout << "\t" << "-l\t" << "list playlists\n";
                std::cout << "\t" << "-x\t" << "no X mode\n";
                break;
        }
    }
    
    //If no flags used, assume -p, File Managers do this
    if(!pFlag && !nFlag && !dFlag && !lFlag && !aFlag) {
        args = getArgList(argv, 1);
        play(args);
    }
    
    if(pFlag) {
        args = getArgList(argv, 2);
        play(args);
    }
    
    if(aFlag) {
        QString name = argv[2];
        playPlaylist(name);
    }
    
    if(nFlag) {
        args = appendFilePath(getArgList(argv, 3));
        newPlaylist(argv[2], args);
    }
    
    if(dFlag) {
        args = getArgList(argv, 2);
        delPlaylist(args);
    }
    
    if(lFlag) {
        listPlaylists();
    }
}