Пример #1
0
void Management::listenSocket(socket_ptr sock){
	try{
		while(true){
			string data = getData(sock);
			if (data == "NULL")
				break;
			manipulateData(data,sock);
		}
	}catch (std::exception& e){
		std::cerr << "Exception: listenSocket: " << e.what() << "\n";
	}
}
Пример #2
0
void MainWindow::getPlaylist()
{
    num++; //FIXME

    if(playlistPath.size())
    {
        QString fileName = QString("playlist%1.txt").arg(num); //FIXME filename : filename must can found.
        file = new QFile(fileName);

        if (!file->open(QIODevice::WriteOnly)) {
            QMessageBox::information(this, tr("FTP"),
                                     tr("Unable to write the file %1: %2.")
                                     .arg(fileName).arg(file->errorString()));
            delete file;
        }

        ftp->get(playlistPath.at(0) + "/playlist.txt",file);

        playlistMap[playlistPath.at(0)] = fileName;
        playlistPath.removeFirst();
    }
    else
    {
        QMapIterator<QString, QString> i(playlistMap);
        while(i.hasNext()) {
            i.next();
            qDebug()<< i.key() << ": " << i.value() << endl;
            manipulateData(i.key(), i.value()); //key : ftp playlistPath, value : downloaded playlist.txt fileName
        }

        //check playlist.txt file list
        //if has playlist remove directory files and download playlist file
        //manipulateData (delete playlist.txt and other files if playlist.txt directory)
        makeTableData();
    }
}