mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
Don't load xspf tracks that have no title or artist, we needs them.
Show a warning when failing to load tracks from an XSPF.
This commit is contained in:
@@ -99,6 +99,7 @@ XSPFLoader::gotBody()
|
|||||||
if ( m_title.isEmpty() )
|
if ( m_title.isEmpty() )
|
||||||
m_title = tr( "New Playlist" );
|
m_title = tr( "New Playlist" );
|
||||||
|
|
||||||
|
bool shownError = false;
|
||||||
for ( unsigned int i = 0; i < tracklist.length(); i++ )
|
for ( unsigned int i = 0; i < tracklist.length(); i++ )
|
||||||
{
|
{
|
||||||
QDomNode e = tracklist.at( i );
|
QDomNode e = tracklist.at( i );
|
||||||
@@ -118,6 +119,14 @@ XSPFLoader::gotBody()
|
|||||||
track = n.text();
|
track = n.text();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( artist.isEmpty() || track.isEmpty() ) {
|
||||||
|
if( !shownError ) {
|
||||||
|
QMessageBox::warning( 0, tr( "Failed to save tracks" ), tr( "Some tracks in the playlist do not contain an artist and a title. They will be ignored." ), QMessageBox::Ok );
|
||||||
|
shownError = true;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
plentry_ptr p( new PlaylistEntry );
|
plentry_ptr p( new PlaylistEntry );
|
||||||
p->setGuid( uuid() );
|
p->setGuid( uuid() );
|
||||||
|
Reference in New Issue
Block a user