aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/converter
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-05-30 20:28:36 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2018-05-30 20:28:36 +0000
commitc8134e1cf570aa2dc1d213e93769b3a290fb58f2 (patch)
treec26295debb015bc3e3043455f99163073e002be5 /src/plugins/General/converter
parent4ab1964bb6cd90ef26e6d6060427038b88e0c37f (diff)
downloadqmmp-c8134e1cf570aa2dc1d213e93769b3a290fb58f2.tar.gz
qmmp-c8134e1cf570aa2dc1d213e93769b3a290fb58f2.tar.bz2
qmmp-c8134e1cf570aa2dc1d213e93769b3a290fb58f2.zip
enabled all remaining plugins
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7982 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/converter')
-rw-r--r--src/plugins/General/converter/converter.cpp42
-rw-r--r--src/plugins/General/converter/converterdialog.cpp14
2 files changed, 28 insertions, 28 deletions
diff --git a/src/plugins/General/converter/converter.cpp b/src/plugins/General/converter/converter.cpp
index f11a28ca5..d5e39c8a0 100644
--- a/src/plugins/General/converter/converter.cpp
+++ b/src/plugins/General/converter/converter.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2011-2017 by Ilya Kotov *
+ * Copyright (C) 2011-2018 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -80,14 +80,14 @@ bool Converter::prepare(const QString &url, int row, const QVariantMap &preset)
DecoderFactory *factory = 0;
- if(!source->url().contains("://"))
- factory = Decoder::findByFilePath(source->url());
+ if(!source->path().contains("://"))
+ factory = Decoder::findByFilePath(source->path());
if(!factory)
factory = Decoder::findByMime(source->contentType());
- if(!factory && source->ioDevice() && source->url().contains("://")) //ignore content of local files
+ if(!factory && source->ioDevice() && source->path().contains("://")) //ignore content of local files
factory = Decoder::findByContent(source->ioDevice());
- if(!factory && source->url().contains("://"))
- factory = Decoder::findByProtocol(source->url().section("://",0,0));
+ if(!factory && source->path().contains("://"))
+ factory = Decoder::findByProtocol(source->path().section("://",0,0));
if(!factory)
{
qWarning("Converter: unsupported file format");
@@ -97,7 +97,7 @@ bool Converter::prepare(const QString &url, int row, const QVariantMap &preset)
qDebug("Converter: selected decoder: %s",qPrintable(factory->properties().shortName));
if(factory->properties().noInput && source->ioDevice())
source->ioDevice()->close();
- Decoder *decoder = factory->create(source->url(), source->ioDevice());
+ Decoder *decoder = factory->create(source->path(), source->ioDevice());
if(!decoder->initialize())
{
qWarning("Converter: invalid file format");
@@ -132,11 +132,11 @@ void Converter::run()
}
AudioParameters ap = m_decoder->audioParameters();
- QString url = m_input->url();
+ QString path = m_input->path();
QString out_path = m_preset["out_dir"].toString();
QString pattern = m_preset["file_name"].toString();
- QList <FileInfo *> list = MetaDataManager::instance()->createPlayList(url);
+ QList<TrackInfo *> list = MetaDataManager::instance()->createPlayList(path);
if(list.isEmpty() || out_path.isEmpty() || pattern.isEmpty())
{
@@ -145,10 +145,13 @@ void Converter::run()
return;
}
- QMap<Qmmp::MetaData, QString> metadata = list[0]->metaData();
+ TrackInfo info = *list.first();
+ qDeleteAll(list);
+ list.clear();
MetaDataFormatter formatter(pattern);
- QString name = formatter.format(list[0]->metaData(), list[0]->length());
+
+ QString name = formatter.format(list.first());
QString full_path = out_path + "/" + name + "." + m_preset["ext"].toString();
if(QFile::exists(full_path))
@@ -175,9 +178,6 @@ void Converter::run()
qDebug("Converter: starting task '%s'", qPrintable(m_preset["name"].toString()));
emit message(m_row, tr("Converting"));
- qDeleteAll(list);
- list.clear();
-
char wave_header[] = { 0x52, 0x49, 0x46, 0x46, //"RIFF"
0x00, 0x00, 0x00, 0x00, //(file size) - 8
0x57, 0x41, 0x56, 0x45, //WAVE
@@ -256,13 +256,13 @@ void Converter::run()
TagLib::FileRef file(qPrintable(full_path));
if(file.tag())
{
- file.tag()->setTitle(QStringToTString(metadata[Qmmp::TITLE]));
- file.tag()->setArtist(QStringToTString(metadata[Qmmp::ARTIST]));
- file.tag()->setAlbum(QStringToTString(metadata[Qmmp::ALBUM]));
- file.tag()->setGenre(QStringToTString(metadata[Qmmp::GENRE]));
- file.tag()->setComment(QStringToTString(metadata[Qmmp::COMMENT]));
- file.tag()->setYear(metadata[Qmmp::YEAR].toUInt());
- file.tag()->setTrack(metadata[Qmmp::TRACK].toUInt());
+ file.tag()->setTitle(QStringToTString(info.value(Qmmp::TITLE)));
+ file.tag()->setArtist(QStringToTString(info.value(Qmmp::ARTIST)));
+ file.tag()->setAlbum(QStringToTString(info.value(Qmmp::ALBUM)));
+ file.tag()->setGenre(QStringToTString(info.value(Qmmp::GENRE)));
+ file.tag()->setComment(QStringToTString(info.value(Qmmp::COMMENT)));
+ file.tag()->setYear(info.value(Qmmp::YEAR).toUInt());
+ file.tag()->setTrack(info.value(Qmmp::TRACK).toUInt());
if(full_path.endsWith(".mp3", Qt::CaseInsensitive))
{
diff --git a/src/plugins/General/converter/converterdialog.cpp b/src/plugins/General/converter/converterdialog.cpp
index 2325b125b..eb4f39e1f 100644
--- a/src/plugins/General/converter/converterdialog.cpp
+++ b/src/plugins/General/converter/converterdialog.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2011-2017 by Ilya Kotov *
+ * Copyright (C) 2011-2018 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -47,20 +47,20 @@ ConverterDialog::ConverterDialog(QList <PlayListTrack *> tracks, QWidget *paren
foreach(PlayListTrack *track, tracks)
{
//skip streams
- if(track->length() == 0 || track->url().contains("://"))
+ if(track->duration() == 0 || track->path().contains("://"))
continue;
//skip duplicates
- if(paths.contains(track->url()))
+ if(paths.contains(track->path()))
continue;
//skip unsupported files
- if(!MetaDataManager::instance()->supports(track->url()))
+ if(!MetaDataManager::instance()->supports(track->path()))
continue;
- paths.append(track->url());
+ paths.append(track->path());
QString name = formatter.format(track);
QTableWidgetItem *item = new QTableWidgetItem(name);
- item->setData(Qt::UserRole, track->url());
- item->setData(Qt::ToolTipRole, track->url());
+ item->setData(Qt::UserRole, track->path());
+ item->setData(Qt::ToolTipRole, track->path());
m_ui.tableWidget->insertRow(m_ui.tableWidget->rowCount());
m_ui.tableWidget->setItem(m_ui.tableWidget->rowCount() - 1, 0, item);
QProgressBar *progressBar = new QProgressBar(this);