Пример #1
0
void HlsParser::Parser(std::shared_ptr<std::vector<unsigned char>> pDatabuf,std::string url)
{
	m_masterurl = url;
	M3uParser m3u(pDatabuf);
	m3u.Parser();
	m3utype type = m3u.getCurrentType();
	GenerateStreamInfo(m3u.getTagContainer(),m3u);
	if (type != PLAYLIST)
	{
		GenerateSelectTrackChunkList(0, 1, 0);
	}
	//else
	//{
	//	//只有playlist
	//	m_videoplaylist = CreateSinglePlaylist(m3u.getTagContainer(), url);
	//}
	
}
void Playlist_persistence_Test::initTestCase()
{
    // Init playlist and persistence process.
    this->playlist         = new Playlist("base_path", "playlist");
    this->playlist_persist = new Playlist_persistence();

    // Create a test playlist file.
    QString m3u(PLAYLIST_M3U);
    m3u.replace("<DATA_DIR>",   QDir(DATA_DIR).absolutePath());
    m3u.replace("<URI_PREFIX>", URI_PREFIX);
    QFile m3u_file(QDir(DATA_DIR).filePath(PLAYLIST_M3U_FILE));
    if (m3u_file.open(QIODevice::WriteOnly | QIODevice::Text) == true)
    {
         QTextStream m3u_stream(&m3u_file);
         m3u_stream << m3u.toUtf8();
         m3u_file.close();
    }
}
Пример #3
0
void RetroArchTools::on_dir2m3u_genbutton_clicked()
{
    d2m3udata_current.extension = ui->dir2m3u_extbox->text();
    d2m3udata_current.outpath = ui->m3u_outbox->text();
    d2m3udata_current.rompath = ui->dir2m3u_rombox->text();
    d2m3udata_current.name = ui->dir2m3u_name->text();
    if (!inputExists(d2m3udata_current.name))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the name of the multi-disk game."));
        return;
    }
    if (!inputExists(d2m3udata_current.extension) || d2m3udata_current.extension == ".")
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the rom extension."));
        return;
    }
    if (!inputExists(d2m3udata_current.outpath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the output path for the m3u."));
        return;
    }
    if (!inputExists(d2m3udata_current.rompath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please select the folder containing the rom/images used to create the m3u file."));
        return;
    }
    if (!fileExists(d2m3udata_current.outpath) || isFile(d2m3udata_current.outpath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Cannot find output directory!"));
        return;
    }
    if (!fileExists(d2m3udata_current.rompath) || isFile(d2m3udata_current.rompath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Cannot find rom directory!"));
        return;
    }
    if (d2m3udata_current.extension[0] != '.')
    {
        QMessageBox::warning(this,tr("Error!"),tr("File extension must begin with a '.'"));
        return;
    }
    QString m3ufile = QDir(d2m3udata_current.outpath).filePath(d2m3udata_current.name + ".m3u");
    QFile m3u(m3ufile);
    QDir d2m3u_romdir(d2m3udata_current.rompath);
    QStringList filters;
    filters << "*" + d2m3udata_current.extension;
    QFileInfoList *d2m3u_roms = new QFileInfoList(d2m3u_romdir.entryInfoList(filters));
    if (m3u.open(QFile::WriteOnly | QFile::Truncate))
    {
        QTextStream m3u_out(&m3u);
        for(const auto &romfile : *d2m3u_roms)
        {
            m3u_out << romfile.fileName() + "\n";
        }
        m3u.close();
    }
    else
    {
        QMessageBox::warning(this,tr("Error!"),tr("Error writing to m3u (check the file isn't being used somewhere)"));
        return;
    }
    delete d2m3u_roms;
    QMessageBox::information(this,tr("Finished!"),"m3u file created at " + m3ufile);
}