[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok
From: Dan Meltzer <parallelgrapefruit () gmail ! com>
Date: 2009-02-18 22:14:06
Message-ID: 1234995246.341947.8858.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 928105 by dmeltzer:
Improve the collectionscanner by a factor of a lot.
Treating QXmlStreamReader::NoError as a non-recoverable error is probably going to \
make things not work that well. This was just one of those things that was way too \
easy a bug to find and fix for way too long, apparently. I'm not certain this fixes \
all the issues, but it scans a lot more of my collection now. Will backport to 2.0 \
branch after it gets some more testing.
CCBUG: 176154
M +1 -0 ChangeLog
M +17 -15 src/collection/sqlcollection/ScanManager.cpp
M +11 -3 src/collection/sqlcollection/ScanResultProcessor.cpp
--- trunk/extragear/multimedia/amarok/ChangeLog #928104:928105
@@ -90,6 +90,7 @@
success.
BUGFIXES:
+ * The collection scanner no longer sucks.
* A full rescan is no longer necessary after disconnecting/reconnecting an \
external harddrive
* Fix issue with files being deleted when Organize Collection is run
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/ScanManager.cpp \
#928104:928105 @@ -171,8 +171,9 @@
bool
ScanManager::isDirInCollection( QString path )
{
+ Q_ASSERT( !path.isEmpty() );
// In the database all directories have a trailing slash, so we must add that
- if ( !path.endsWith( '/' ) )
+ if( !path.endsWith( '/' ) )
path += '/';
const int deviceid = MountPointManager::instance()->getIdForUrl( path );
@@ -525,17 +526,18 @@
if( localname == "itemcount" )
{
+// debug() << "Got an itemcount with value: " << \
localname.toString();
The::statusBar()->incrementProgressTotalSteps( this, \
m_reader.attributes().value( "count" ).toString().toInt() ); }
else if( localname == "tags" )
{
- //debug() << "Parsing FILE:\n";
+// debug() << "Parsing FILE:\n";
QXmlStreamAttributes attrs = m_reader.attributes();
QList<QXmlStreamAttribute> list = attrs.toList();
- //foreach( QXmlStreamAttribute l, list )
- // debug() << " TAG: " << l.name().toString() << '\t' << \
l.value().toString() << '\n';
- //debug() << "End FILE";
+// foreach( QXmlStreamAttribute l, list )
+// debug() << " TAG: " << l.name().toString() << '\t' << \
l.value().toString() << '\n'; +// debug() << "End FILE";
QVariantMap data;
data.insert( Meta::Field::URL, attrs.value( "path" ).toString() \
); @@ -596,13 +598,13 @@
}
else if( localname == "folder" )
{
- //debug() << "Parsing FOLDER:\n";
+// debug() << "Parsing FOLDER:\n";
QXmlStreamAttributes attrs = m_reader.attributes();
QList<QXmlStreamAttribute> list = attrs.toList();
- //foreach( QXmlStreamAttribute l, list )
- // debug() << " ATTRIBUTE: " << l.name().toString() << '\t' \
<< l.value().toString() << '\n';
- //debug() << "End FOLDER";
+ foreach( QXmlStreamAttribute l, list )
+ debug() << " ATTRIBUTE: " << l.name().toString() << '\t' << \
l.value().toString() << '\n'; + debug() << "End FOLDER";
const QString folder = attrs.value( "path" ).toString();
const QFileInfo info( folder );
@@ -617,13 +619,13 @@
}
else if( localname == "image" )
{
- debug() << "Parsing IMAGE:\n";
+// debug() << "Parsing IMAGE:\n";
QXmlStreamAttributes attrs = m_reader.attributes();
QList<QXmlStreamAttribute> thisList = attrs.toList();
- //foreach( QXmlStreamAttribute l, thisList )
- // debug() << " ATTR: " << l.name().toString() << '\t' << \
l.value().toString() << '\n';
- //debug() << "End IMAGE";
+// foreach( QXmlStreamAttribute l, thisList )
+// debug() << " ATTR: " << l.name().toString() << '\t' << \
l.value().toString() << '\n'; +// debug() << "End IMAGE";
// Deserialize CoverBundle list
QStringList list = attrs.value( "list" ).toString().split( \
"AMAROK_MAGIC" ); @@ -640,7 +642,7 @@
}
}
}
- if( m_reader.error() != QXmlStreamReader::PrematureEndOfDocumentError )
+ if( m_reader.error() != QXmlStreamReader::PrematureEndOfDocumentError && \
m_reader.error() != QXmlStreamReader::NoError ) {
debug() << "do-while done with error: " << m_reader.error();
//the error cannot be PrematureEndOfDocumentError, so handle an \
unrecoverable error here @@ -651,7 +653,7 @@
m_reader.clear();
continue;
}
- } while( m_reader.error() == QXmlStreamReader::PrematureEndOfDocumentError );
+ } while( m_reader.error() == QXmlStreamReader::PrematureEndOfDocumentError && \
m_reader.error() != QXmlStreamReader::NoError );
if( m_abortRequested )
{
--- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/ScanResultProcessor.cpp \
#928104:928105 @@ -57,6 +57,7 @@
void
ScanResultProcessor::addDirectory( const QString &dir, uint mtime )
{
+ DEBUG_BLOCK
if( dir.isEmpty() )
{
debug() << "got directory with no path from the scanner, not adding";
@@ -158,6 +159,8 @@
void
ScanResultProcessor::processDirectory( const QList<QVariantMap > &data )
{
+ DEBUG_BLOCK
+
setupDatabase();
//using the following heuristics:
//if more than one album is in the dir, use the artist of each track as \
albumartist @@ -170,7 +173,10 @@
QString album;
bool multipleAlbums = false;
if( !data.isEmpty() )
+ {
album = data[0].value( Field::ALBUM ).toString();
+ debug() << "Album is: " << album;
+ }
foreach( const QVariantMap &row, data )
{
@@ -178,6 +184,7 @@
if( row.value( Field::ALBUM ).toString() != album )
multipleAlbums = true;
}
+ debug() << "Artists: " << artists;
if( multipleAlbums || album.isEmpty() || data.count() > 60 || artists.size() == \
1 ) {
foreach( const QVariantMap &row, data )
@@ -277,6 +284,7 @@
void
ScanResultProcessor::addTrack( const QVariantMap &trackData, int albumArtistId )
{
+// DEBUG_BLOCK
//amarok 1 stored all tracks of a compilation in different directories.
//when using its "Organize Collection" feature
//try to detect these cases
@@ -284,12 +292,12 @@
int album = 0;
QString path = trackData.value( Field::URL ).toString();
-
+
QFileInfo file( path );
-
+
QDir dir = file.dir();
dir.setFilter( QDir::Files );
-
+
//name filtering should be case-insensitive because we do not use \
QDir::CaseSensitive QStringList filters;
filters << "*.mp3" << "*.ogg" << "*.oga" << "*.flac" << "*.wma" << "*.m4a";
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic