1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-09 15:47:38 +02:00
This commit is contained in:
Hugo Lindström
2013-06-10 14:46:58 +02:00
parent df7550d73b
commit 71651f62b1

View File

@@ -77,9 +77,11 @@ M3uLoader::getTags( const QFileInfo& info )
TagLib::FileRef f( encodedName ); TagLib::FileRef f( encodedName );
if( f.isNull() ) if( f.isNull() )
return; return;
TagLib::Tag *tag = f.tag(); TagLib::Tag *tag = f.tag();
if( !tag ) if( !tag )
return; return;
QString artist = TStringToQString( tag->artist() ).trimmed(); QString artist = TStringToQString( tag->artist() ).trimmed();
QString album = TStringToQString( tag->album() ).trimmed(); QString album = TStringToQString( tag->album() ).trimmed();
QString track = TStringToQString( tag->title() ).trimmed(); QString track = TStringToQString( tag->title() ).trimmed();
@@ -103,6 +105,7 @@ M3uLoader::getTags( const QFileInfo& info )
} }
} }
void void
M3uLoader::parseLine( const QString& line, const QFile& file ) M3uLoader::parseLine( const QString& line, const QFile& file )
{ {
@@ -114,7 +117,7 @@ M3uLoader::parseLine( const QString& line, const QFile& file )
} }
else else
{ {
QUrl fileUrl = QUrl::fromUserInput( QString( QFileInfo(file).canonicalPath() + "/" + line.simplified() ) ); QUrl fileUrl = QUrl::fromUserInput( QString( QFileInfo( file ).canonicalPath() + "/" + line.simplified() ) );
QFileInfo tmpFile( fileUrl.toLocalFile() ); QFileInfo tmpFile( fileUrl.toLocalFile() );
if ( tmpFile.exists() ) if ( tmpFile.exists() )
{ {
@@ -123,6 +126,7 @@ M3uLoader::parseLine( const QString& line, const QFile& file )
} }
} }
void void
M3uLoader::parseM3u( const QString& fileLink ) M3uLoader::parseM3u( const QString& fileLink )
{ {
@@ -145,7 +149,7 @@ M3uLoader::parseM3u( const QString& fileLink )
QString line = stream.readLine().trimmed(); QString line = stream.readLine().trimmed();
/// Fallback solution for, (drums) itunes! /// Fallback solution for, (drums) itunes!
singleLine.append(line); singleLine.append( line );
/// If anyone wants to take on the regex for parsing EXT, go ahead /// If anyone wants to take on the regex for parsing EXT, go ahead
/// But the notion that users does not tag by a common rule. that seems hard /// But the notion that users does not tag by a common rule. that seems hard
@@ -161,7 +165,7 @@ M3uLoader::parseM3u( const QString& fileLink )
{ {
if ( !singleLine.isEmpty() ) if ( !singleLine.isEmpty() )
{ {
QStringList m3uList = singleLine.split("\r"); QStringList m3uList = singleLine.split( "\r" );
foreach( const QString& line, m3uList ) foreach( const QString& line, m3uList )
parseLine( line, file ); parseLine( line, file );
} }
@@ -190,6 +194,7 @@ M3uLoader::parseM3u( const QString& fileLink )
m_tracks.clear(); m_tracks.clear();
} }
void void
M3uLoader::playlistCreated() M3uLoader::playlistCreated()
{ {