@@ -66,7 +66,9 @@ SongList AsxIniParser::Load(QIODevice *device, const QString &playlist_path, con
|
||||
|
||||
}
|
||||
|
||||
void AsxIniParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
void AsxIniParser::Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
Q_UNUSED(playlist_name)
|
||||
|
||||
QTextStream s(device);
|
||||
s << "[Reference]" << Qt::endl;
|
||||
|
||||
@@ -52,7 +52,7 @@ class AsxIniParser : public ParserBase {
|
||||
bool TryMagic(const QByteArray &data) const override;
|
||||
|
||||
SongList Load(QIODevice *device, const QString &playlist_path = QLatin1String(""), const QDir &dir = QDir(), const bool collection_lookup = true) const override;
|
||||
void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
};
|
||||
|
||||
#endif // ASXINIPARSER_H
|
||||
|
||||
@@ -133,8 +133,9 @@ return_song:
|
||||
|
||||
}
|
||||
|
||||
void ASXParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
void ASXParser::Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
Q_UNUSED(playlist_name)
|
||||
Q_UNUSED(dir)
|
||||
Q_UNUSED(path_type)
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class ASXParser : public XMLParser {
|
||||
bool TryMagic(const QByteArray &data) const override;
|
||||
|
||||
SongList Load(QIODevice *device, const QString &playlist_path = QLatin1String(""), const QDir &dir = QDir(), const bool collection_lookup = true) const override;
|
||||
void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
|
||||
private:
|
||||
Song ParseTrack(QXmlStreamReader *reader, const QDir &dir, const bool collection_lookup) const;
|
||||
|
||||
@@ -378,8 +378,9 @@ qint64 CueParser::IndexToMarker(const QString &index) {
|
||||
|
||||
}
|
||||
|
||||
void CueParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
void CueParser::Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
Q_UNUSED(playlist_name);
|
||||
Q_UNUSED(songs);
|
||||
Q_UNUSED(device);
|
||||
Q_UNUSED(dir);
|
||||
|
||||
@@ -57,7 +57,7 @@ class CueParser : public ParserBase {
|
||||
bool TryMagic(const QByteArray &data) const override;
|
||||
|
||||
SongList Load(QIODevice *device, const QString &playlist_path = QLatin1String(""), const QDir &dir = QDir(), const bool collection_lookup = true) const override;
|
||||
void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
|
||||
static QString FindCueFilename(const QString &filename);
|
||||
|
||||
|
||||
@@ -125,7 +125,9 @@ bool M3UParser::ParseMetadata(const QString &line, M3UParser::Metadata *metadata
|
||||
|
||||
}
|
||||
|
||||
void M3UParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
void M3UParser::Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
Q_UNUSED(playlist_name)
|
||||
|
||||
device->write("#EXTM3U\n");
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class M3UParser : public ParserBase {
|
||||
bool TryMagic(const QByteArray &data) const override;
|
||||
|
||||
SongList Load(QIODevice *device, const QString &playlist_path = QLatin1String(""), const QDir &dir = QDir(), const bool collection_lookup = true) const override;
|
||||
void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
|
||||
private:
|
||||
enum class M3UType {
|
||||
|
||||
@@ -60,7 +60,7 @@ class ParserBase : public QObject {
|
||||
// Any playlist parser may decide to leave out some entries if it finds them incomplete or invalid.
|
||||
// This means that the final resulting SongList should be considered valid (at least from the parser's point of view).
|
||||
virtual SongList Load(QIODevice *device, const QString &playlist_path = QLatin1String(""), const QDir &dir = QDir(), const bool collection_lookup = true) const = 0;
|
||||
virtual void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const = 0;
|
||||
virtual void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void Error(const QString &error) const;
|
||||
|
||||
@@ -214,7 +214,7 @@ SongList PlaylistParser::LoadFromDevice(QIODevice *device, const QString &path_h
|
||||
|
||||
}
|
||||
|
||||
void PlaylistParser::Save(const SongList &songs, const QString &filename, const PlaylistSettings::PathType path_type) const {
|
||||
void PlaylistParser::Save(const QString &playlist_name, const SongList &songs, const QString &filename, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
QFileInfo fileinfo(filename);
|
||||
QDir dir(fileinfo.path());
|
||||
@@ -248,7 +248,7 @@ void PlaylistParser::Save(const SongList &songs, const QString &filename, const
|
||||
return;
|
||||
}
|
||||
|
||||
parser->Save(songs, &file, dir, path_type);
|
||||
parser->Save(playlist_name, songs, &file, dir, path_type);
|
||||
|
||||
file.close();
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class PlaylistParser : public QObject {
|
||||
|
||||
SongList LoadFromFile(const QString &filename) const;
|
||||
SongList LoadFromDevice(QIODevice *device, const QString &path_hint = QString(), const QDir &dir_hint = QDir()) const;
|
||||
void Save(const SongList &songs, const QString &filename, const PlaylistSettings::PathType) const;
|
||||
void Save(const QString &playlist_name, const SongList &songs, const QString &filename, const PlaylistSettings::PathType) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void Error(const QString &error) const;
|
||||
|
||||
@@ -83,7 +83,9 @@ SongList PLSParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
|
||||
}
|
||||
|
||||
void PLSParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
void PLSParser::Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
Q_UNUSED(playlist_name)
|
||||
|
||||
QTextStream s(device);
|
||||
s << "[playlist]" << Qt::endl;
|
||||
|
||||
@@ -53,7 +53,7 @@ class PLSParser : public ParserBase {
|
||||
bool TryMagic(const QByteArray &data) const override;
|
||||
|
||||
SongList Load(QIODevice *device, const QString &playlist_path = QLatin1String(""), const QDir &dir = QDir(), const bool collection_lookup = true) const override;
|
||||
void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
};
|
||||
|
||||
#endif // PLSPARSER_H
|
||||
|
||||
@@ -98,7 +98,9 @@ void WplParser::ParseSeq(const QDir &dir, QXmlStreamReader *reader, SongList *so
|
||||
|
||||
}
|
||||
|
||||
void WplParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
void WplParser::Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
Q_UNUSED(playlist_name)
|
||||
|
||||
QXmlStreamWriter writer(device);
|
||||
writer.setAutoFormatting(true);
|
||||
|
||||
@@ -56,7 +56,7 @@ class WplParser : public XMLParser {
|
||||
bool TryMagic(const QByteArray &data) const override;
|
||||
|
||||
SongList Load(QIODevice *device, const QString &playlist_path, const QDir &dir, const bool collection_lookup = true) const override;
|
||||
void Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
|
||||
private:
|
||||
void ParseSeq(const QDir &dir, QXmlStreamReader *reader, SongList *songs, const bool collection_lookup) const;
|
||||
|
||||
@@ -140,7 +140,7 @@ return_song:
|
||||
|
||||
}
|
||||
|
||||
void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
void XSPFParser::Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettings::PathType path_type) const {
|
||||
|
||||
QXmlStreamWriter writer(device);
|
||||
writer.setAutoFormatting(true);
|
||||
@@ -150,6 +150,8 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
|
||||
writer.writeAttribute("version"_L1, "1"_L1);
|
||||
writer.writeDefaultNamespace("http://xspf.org/ns/0/"_L1);
|
||||
|
||||
writer.writeTextElement("title"_L1, playlist_name);
|
||||
|
||||
Settings s;
|
||||
s.beginGroup(PlaylistSettings::kSettingsGroup);
|
||||
bool write_metadata = s.value(PlaylistSettings::kWriteMetadata, true).toBool();
|
||||
|
||||
@@ -53,7 +53,7 @@ class XSPFParser : public XMLParser {
|
||||
bool TryMagic(const QByteArray &data) const override;
|
||||
|
||||
SongList Load(QIODevice *device, const QString &playlist_path = QLatin1String(""), const QDir &dir = QDir(), const bool collection_lookup = true) const override;
|
||||
void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
void Save(const QString &playlist_name, const SongList &songs, QIODevice *device, const QDir &dir = QDir(), const PlaylistSettings::PathType path_type = PlaylistSettings::PathType::Automatic) const override;
|
||||
|
||||
private:
|
||||
Song ParseTrack(QXmlStreamReader *reader, const QDir &dir, const bool collection_lookup) const;
|
||||
|
||||
Reference in New Issue
Block a user