changed my mind - reverting my playlist changes to previous status quo (just making the PlaylistParser's contract more explicit)

this doesn't mean the previous revision was pointless - it still fixed one CUE related bug which I forgot to mention...
This commit is contained in:
Paweł Bara 2011-02-03 22:21:15 +00:00
parent a361dc128d
commit ed4b7abde0
3 changed files with 8 additions and 11 deletions

View File

@ -183,15 +183,7 @@ void SongLoader::LoadPlaylistAndEmit(ParserBase* parser, const QString& filename
void SongLoader::LoadPlaylist(ParserBase* parser, const QString& filename) {
QFile file(filename);
file.open(QIODevice::ReadOnly);
SongList all_songs = parser->Load(&file, filename, QFileInfo(filename).path());
songs_.clear();
foreach(const Song& song, all_songs) {
if(song.is_valid()) {
songs_ << song;
}
}
songs_ = parser->Load(&file, filename, QFileInfo(filename).path());
}
static bool CompareSongs(const Song& left, const Song& right) {

View File

@ -37,6 +37,13 @@ public:
virtual bool TryMagic(const QByteArray& data) const = 0;
// Loads all songs from playlist found at path 'playlist_path' in directory 'dir'.
// The 'device' argument is an opened and ready to read from represantation of
// this playlist.
// This method might not return all of the songs found in the playlist. 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 = "", const QDir& dir = QDir()) const = 0;
virtual void Save(const SongList& songs, QIODevice* device, const QDir& dir = QDir()) const = 0;

View File

@ -49,8 +49,6 @@ SongList PLSParser::Load(QIODevice *device, const QString& playlist_path, const
} else {
songs[n].InitFromFile(songs[n].filename(), -1);
}
// force validity
songs[n].set_valid(true);
} else if (key.startsWith("title")) {
songs[n].set_title(value);
} else if (key.startsWith("length")) {