Index: mythmusic/mythmusic/metadata.cpp
===================================================================
--- mythmusic/mythmusic/metadata.cpp	(revision 12834)
+++ mythmusic/mythmusic/metadata.cpp	(working copy)
@@ -169,113 +169,72 @@
     if (m_genre == "")
         m_genre = QObject::tr("Unknown Genre");
 
-    // Don't update the database if a song with the exact same
-    // metadata is already there
     MSqlQuery query(MSqlQuery::InitCon());
-    query.prepare("SELECT music_songs.filename "
-                  "FROM music_songs "
-                  "LEFT JOIN music_artists ON music_songs.artist_id=music_artists.artist_id "
-                  "LEFT JOIN music_albums ON music_songs.album_id=music_albums.album_id "
-                  "LEFT JOIN music_artists AS music_comp_artists ON music_albums.artist_id=music_comp_artists.artist_id "
-                  "LEFT JOIN music_genres ON music_songs.genre_id=music_genres.genre_id "
-                  "WHERE music_artists.artist_name = :ARTIST"
-                  " AND music_comp_artists.artist_name = :COMPILATION_ARTIST"
-                  " AND music_albums.album_name = :ALBUM"
-                  " AND music_songs.name = :TITLE"
-                  " AND music_genres.genre = :GENRE"
-                  " AND music_songs.year = :YEAR"
-                  " AND music_songs.track = :TRACKNUM"
-                  " AND music_songs.length = :LENGTH"
-                  " AND music_songs.format = :FORMAT ;");
 
-    query.bindValue(":ARTIST", m_artist.utf8());
-    query.bindValue(":COMPILATION_ARTIST", m_compilation_artist.utf8());
-    query.bindValue(":ALBUM", m_album.utf8());
-    query.bindValue(":TITLE", m_title.utf8());
-    query.bindValue(":GENRE", m_genre.utf8());
-    query.bindValue(":YEAR", m_year);
-    query.bindValue(":TRACKNUM", m_tracknum);
-    query.bindValue(":LENGTH", m_length);
-    query.bindValue(":FORMAT", m_format);
-
-    if (query.exec() && query.size() > 0 )
+    if (m_directoryid < 0)
     {
-        if (m_id > 0)
-        {
-            query.prepare("UPDATE music_songs SET "
-                "date_modified = :DATE_MOD WHERE filename = :FILENAME;");
-            query.bindValue(":DATE_MOD", QDateTime::currentDateTime());
-            query.bindValue(":FILENAME", sqlfilename.utf8());
-            if (!query.exec() || !query.isActive())
-            {
-                MythContext::DBError("update modification date", query);
-            }
-        }
-
-        return;
-    }
-
-    // Load the directory id
-    unsigned int directoryId;
-    query.prepare("SELECT directory_id FROM music_directories "
-                  "WHERE path = :DIRECTORY ;");
-    query.bindValue(":DIRECTORY", sqldir.utf8());
-
-    if (!query.exec() || !query.isActive())
-    {
-        MythContext::DBError("music select directory id", query);
-        return;
-    }
-    if (query.next())
-    {
-        directoryId = query.value(0).toInt();
-    }
-    else
-    {
-        query.prepare("INSERT INTO music_directories (path) VALUES (:DIRECTORY);");
+        // Load the directory id
+        query.prepare("SELECT directory_id FROM music_directories "
+                    "WHERE path = :DIRECTORY ;");
         query.bindValue(":DIRECTORY", sqldir.utf8());
 
-        if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+        if (!query.exec() || !query.isActive())
         {
-            MythContext::DBError("music insert directory", query);
+            MythContext::DBError("music select directory id", query);
             return;
         }
-        directoryId = query.lastInsertId().toInt();
+        if (query.next())
+        {
+            m_directoryid = query.value(0).toInt();
+        }
+        else
+        {
+            query.prepare("INSERT INTO music_directories (path) VALUES (:DIRECTORY);");
+            query.bindValue(":DIRECTORY", sqldir.utf8());
+
+            if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+            {
+                MythContext::DBError("music insert directory", query);
+                return;
+            }
+            m_directoryid = query.lastInsertId().toInt();
+        }
     }
 
-    // Load the artist id or insert it and get the id
-    unsigned int artistId;
-    query.prepare("SELECT artist_id FROM music_artists "
-                  "WHERE artist_name = :ARTIST ;");
-    query.bindValue(":ARTIST", m_artist.utf8());
-
-    if (!query.exec() || !query.isActive())
+    if (m_artistid < 0)
     {
-        MythContext::DBError("music select artist id", query);
-        return;
-    }
-    if (query.next())
-    {
-        artistId = query.value(0).toInt();
-    }
-    else
-    {
-        query.prepare("INSERT INTO music_artists (artist_name) VALUES (:ARTIST);");
+        // Load the artist id
+        query.prepare("SELECT artist_id FROM music_artists "
+                    "WHERE artist_name = :ARTIST ;");
         query.bindValue(":ARTIST", m_artist.utf8());
 
-        if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+        if (!query.exec() || !query.isActive())
         {
-            MythContext::DBError("music insert artist", query);
+            MythContext::DBError("music select artist id", query);
             return;
         }
-        artistId = query.lastInsertId().toInt();
+        if (query.next())
+        {
+            m_artistid = query.value(0).toInt();
+        }
+        else
+        {
+            query.prepare("INSERT INTO music_artists (artist_name) VALUES (:ARTIST);");
+            query.bindValue(":ARTIST", m_artist.utf8());
+
+            if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+            {
+                MythContext::DBError("music insert artist", query);
+                return;
+            }
+            m_artistid = query.lastInsertId().toInt();
+        }
     }
 
     // Compilation Artist
-    unsigned int compilationArtistId;
     if (m_artist == m_compilation_artist)
     {
-        compilationArtistId = artistId;
+        m_compartistid = m_artistid;
     }
     else
     {
@@ -289,7 +248,7 @@
         }
         if (query.next())
         {
-            compilationArtistId = query.value(0).toInt();
+            m_compartistid = query.value(0).toInt();
         }
         else
         {
@@ -301,67 +260,71 @@
                 MythContext::DBError("music insert compilation artist", query);
                 return;
             }
-            compilationArtistId = query.lastInsertId().toInt();
+            m_compartistid = query.lastInsertId().toInt();
         }
     }
 
     // Album
-    unsigned int albumId;
-    query.prepare("SELECT album_id FROM music_albums "
-                  "WHERE artist_id = :COMP_ARTIST_ID "
-                  " AND album_name = :ALBUM ;");
-    query.bindValue(":COMP_ARTIST_ID", compilationArtistId);
-    query.bindValue(":ALBUM", m_album.utf8());
-    if (!query.exec() || !query.isActive())
+    if (m_albumid < 0)
     {
-        MythContext::DBError("music select album id", query);
-        return;
-    }
-    if (query.next())
-    {
-        albumId = query.value(0).toInt();
-    }
-    else
-    {
-        query.prepare("INSERT INTO music_albums (artist_id, album_name, compilation, year) VALUES (:COMP_ARTIST_ID, :ALBUM, :COMPILATION, :YEAR);");
-        query.bindValue(":COMP_ARTIST_ID", compilationArtistId);
+        query.prepare("SELECT album_id FROM music_albums "
+                    "WHERE artist_id = :COMP_ARTIST_ID "
+                    " AND album_name = :ALBUM ;");
+        query.bindValue(":COMP_ARTIST_ID", m_compartistid);
         query.bindValue(":ALBUM", m_album.utf8());
-        query.bindValue(":COMPILATION", m_compilation);
-        query.bindValue(":YEAR", m_year);
-
-        if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+        if (!query.exec() || !query.isActive())
         {
-            MythContext::DBError("music insert album", query);
+            MythContext::DBError("music select album id", query);
             return;
         }
-        albumId = query.lastInsertId().toInt();
+        if (query.next())
+        {
+            m_albumid = query.value(0).toInt();
+        }
+        else
+        {
+            query.prepare("INSERT INTO music_albums (artist_id, album_name, compilation, year) VALUES (:COMP_ARTIST_ID, :ALBUM, :COMPILATION, :YEAR);");
+            query.bindValue(":COMP_ARTIST_ID", m_compartistid);
+            query.bindValue(":ALBUM", m_album.utf8());
+            query.bindValue(":COMPILATION", m_compilation);
+            query.bindValue(":YEAR", m_year);
+
+            if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+            {
+                MythContext::DBError("music insert album", query);
+                return;
+            }
+            m_albumid = query.lastInsertId().toInt();
+        }
     }
 
-    // Genres
-    unsigned int genreId;
-    query.prepare("SELECT genre_id FROM music_genres "
-                  "WHERE genre = :GENRE ;");
-    query.bindValue(":GENRE", m_genre.utf8());
-    if (!query.exec() || !query.isActive())
+    if (m_genreid < 0)
     {
-        MythContext::DBError("music select genre id", query);
-        return;
-    }
-    if (query.next())
-    {
-        genreId = query.value(0).toInt();
-    }
-    else
-    {
-        query.prepare("INSERT INTO music_genres (genre) VALUES (:GENRE);");
+        // Genres
+        query.prepare("SELECT genre_id FROM music_genres "
+                    "WHERE genre = :GENRE ;");
         query.bindValue(":GENRE", m_genre.utf8());
-
-        if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+        if (!query.exec() || !query.isActive())
         {
-            MythContext::DBError("music insert genre", query);
+            MythContext::DBError("music select genre id", query);
             return;
         }
-        genreId = query.lastInsertId().toInt();
+        if (query.next())
+        {
+            m_genreid = query.value(0).toInt();
+        }
+        else
+        {
+            query.prepare("INSERT INTO music_genres (genre) VALUES (:GENRE);");
+            query.bindValue(":GENRE", m_genre.utf8());
+
+            if (!query.exec() || !query.isActive() || query.numRowsAffected() <= 0)
+            {
+                MythContext::DBError("music insert genre", query);
+                return;
+            }
+            m_genreid = query.lastInsertId().toInt();
+        }
     }
 
     // We have all the id's now. We can insert it.
@@ -397,24 +360,12 @@
     }
 
     query.prepare(strQuery);
-    /*
-    query.prepare("INSERT INTO music_songs "
-                  "  (artist_id, album_id,     name,"
-                  "   genre_id,  year,         track,                length,"
-                  "   filename,  date_entered, date_modified,"
-                  "   format,    size,         bitrate) "
-                  "VALUES "
-                  "  (:ARTIST,   :ALBUM,       :TITLE,"
-                  "   :GENRE,    :YEAR,        :TRACKNUM,            :LENGTH,"
-                  "   :FILENAME, :DATE_ADD,  :DATE_MOD,"
-                  "   :FORMAT,   :FILESIZE,    :BITRATE)"
-                  );
-    */
-    query.bindValue(":DIRECTORY", directoryId);
-    query.bindValue(":ARTIST", artistId);
-    query.bindValue(":ALBUM", albumId);
+
+    query.bindValue(":DIRECTORY", m_directoryid);
+    query.bindValue(":ARTIST", m_artistid);
+    query.bindValue(":ALBUM", m_albumid);
     query.bindValue(":TITLE", m_title.utf8());
-    query.bindValue(":GENRE", genreId);
+    query.bindValue(":GENRE", m_genreid);
     query.bindValue(":YEAR", m_year);
     query.bindValue(":TRACKNUM", m_tracknum);
     query.bindValue(":LENGTH", m_length);
Index: mythmusic/mythmusic/metadata.h
===================================================================
--- mythmusic/mythmusic/metadata.h	(revision 12834)
+++ mythmusic/mythmusic/metadata.h	(working copy)
@@ -40,6 +40,11 @@
                 m_changed = false;
                 m_show = true;
                 m_format = lformat;
+
+                m_directoryid = -1;
+                m_artistid = -1;
+                m_albumid = -1;
+                m_genreid = -1;
             }
 
     Metadata(const Metadata &other)
@@ -89,9 +94,18 @@
     QString Genre() { return m_genre; }
     void setGenre(const QString &lgenre) { m_genre = lgenre; }
 
+    void setDirectoryId(int ldirectoryid) { m_directoryid = ldirectoryid; }
+    int getDirectoryId() { return m_directoryid; }
+    void setArtistId(int lartistid) { m_artistid = lartistid; }
+    int getArtistId() { return m_artistid; }
+    void setAlbumId(int lalbumid) { m_albumid = lalbumid; }
+    int getAlbumId() { return m_albumid; }
+    void setGenreId(int lgenreid) { m_genreid = lgenreid; }
+    int getGenreId() { return m_genreid; }
+
     int Year() { return m_year; }
     void setYear(int lyear) { m_year = lyear; }
- 
+
     int Track() { return m_tracknum; }
     void setTrack(int ltrack) { m_tracknum = ltrack; }
 
@@ -159,10 +173,15 @@
     int m_tracknum;
     int m_length;
     int m_rating;
+    int m_directoryid;
+    int m_artistid;
+    int m_compartistid;
+    int m_albumid;
+    int m_genreid;
     QString m_lastplay;
     int m_playcount;
     bool m_compilation;
-     
+
     unsigned int m_id;
     QString m_filename;
     bool    m_changed;
Index: mythmusic/mythmusic/filescanner.h
===================================================================
--- mythmusic/mythmusic/filescanner.h	(revision 12834)
+++ mythmusic/mythmusic/filescanner.h	(working copy)
@@ -13,6 +13,7 @@
 };
 
 typedef QMap <QString, MusicFileLocation> MusicLoadedMap;
+typedef QMap<QString, int> IdCache;
 
 class FileScanner
 {
@@ -24,12 +25,19 @@
 
     private:
         void BuildFileList(QString &directory, MusicLoadedMap &music_files, int parentid);
+        int  GetDirectoryId(const QString &directory, const int &parentid);
         bool HasFileChanged(const QString &filename, const QString &date_modified);
         void AddFileToDB(const QString &filename);
         void RemoveFileFromDB (const QString &directory, const QString &filename);
         void UpdateFileInDB(const QString &filename);
 
         QString         m_startdir;
+        IdCache         m_directoryid;
+        IdCache         m_artistid;
+        IdCache         m_genreid;
+        IdCache         m_albumid;
+
+        Decoder             *m_decoder;
 };
 
 #endif // _FILESCANNER_H_
Index: mythmusic/mythmusic/metaio.cpp
===================================================================
--- mythmusic/mythmusic/metaio.cpp	(revision 12834)
+++ mythmusic/mythmusic/metaio.cpp	(working copy)
@@ -43,6 +43,8 @@
 
     static QString regext = mFileExtension + "$";
     int part_num = 0;
+    filename.replace(QRegExp(QString("_")), QString(" "));
+    filename.replace(QRegExp(regext, FALSE), QString(""));
     QStringList fmt_list = QStringList::split("/", mFilenameFormat);
     QStringList::iterator fmt_it = fmt_list.begin();
 
@@ -54,8 +56,6 @@
     for(; fmt_it != fmt_list.end(); fmt_it++, part_num++)
     {
         QString part_str = filename.section( "/", part_num, part_num);
-        part_str.replace(QRegExp(QString("_")), QString(" "));
-        part_str.replace(QRegExp(regext, FALSE), QString(""));
 
         if ( *fmt_it == "GENRE" )
             genre = part_str;
Index: mythmusic/mythmusic/filescanner.cpp
===================================================================
--- mythmusic/mythmusic/filescanner.cpp	(revision 12834)
+++ mythmusic/mythmusic/filescanner.cpp	(working copy)
@@ -18,7 +18,47 @@
 
 FileScanner::FileScanner ()
 {
+    MSqlQuery query(MSqlQuery::InitCon());
 
+    // Cache the directory ids from the database
+    query.prepare("SELECT directory_id, LOWER(path) FROM music_directories");
+    if (query.exec() || query.isActive())
+    {
+        while(query.next())
+        {
+            m_directoryid[query.value(1).toString()] = query.value(0).toInt();
+        }
+    }
+
+    // Cache the genre ids from the database
+    query.prepare("SELECT genre_id, LOWER(genre) FROM music_genres");
+    if (query.exec() || query.isActive())
+    {
+        while(query.next())
+        {
+            m_genreid[query.value(1).toString()] = query.value(0).toInt();
+        }
+    }
+
+    // Cache the artist ids from the database
+    query.prepare("SELECT artist_id, LOWER(artist_name) FROM music_artists");
+    if (query.exec() || query.isActive())
+    {
+        while(query.next())
+        {
+            m_artistid[query.value(1).toString()] = query.value(0).toInt();
+        }
+    }
+
+    // Cache the album ids from the database
+    query.prepare("SELECT album_id, artist_id, LOWER(album_name) FROM music_albums");
+    if (query.exec() || query.isActive())
+    {
+        while(query.next())
+        {
+            m_albumid[query.value(1).toString() + "#" + query.value(2).toString()] = query.value(0).toInt();
+        }
+    }
 }
 
 FileScanner::~FileScanner ()
@@ -40,8 +80,6 @@
     QFileInfoListIterator it(*list);
     QFileInfo *fi;
 
-    MSqlQuery query(MSqlQuery::InitCon());
-
     /* Recursively traverse directory, calling QApplication::processEvents()
        every now and then to ensure the UI updates */
     int update_interval = 0;
@@ -55,43 +93,24 @@
         if (fi->isDir())
         {
 
-            QString directory(filename);
-            directory.remove(0, m_startdir.length());
-            // Load the directory id or insert it and get the id
-            query.prepare("SELECT directory_id FROM music_directories "
-                        "WHERE path = :DIRECTORY ;");
-            query.bindValue(":DIRECTORY", directory.utf8());
+            QString dir(filename);
+            dir.remove(0, m_startdir.length());
 
-            if (query.exec() || query.isActive())
-            {
-                if (query.size() == 0)
+            newparentid = m_directoryid[dir.utf8().lower()];
+
+            if (newparentid == 0) {
+                if ((m_directoryid[dir.utf8().lower()] = GetDirectoryId(dir, parentid)) > 0)
                 {
-                    query.prepare("INSERT INTO music_directories (path, parent_id) "
-                                  "VALUES (:DIRECTORY, :PARENTID);");
-                    query.bindValue(":DIRECTORY", directory.utf8());
-                    query.bindValue(":PARENTID", parentid);
-
-                    if (!query.exec() || !query.isActive()
-                    || query.numRowsAffected() <= 0)
-                    {
-                        MythContext::DBError("music insert directory", query);
-                        return;
-                    }
-                    newparentid = query.lastInsertId().toInt();
+                    newparentid = m_directoryid[dir.utf8().lower()];
                 }
                 else
                 {
-                    query.next();
-                    newparentid = query.value(0).toInt();
+                    VERBOSE(VB_IMPORTANT, QString("Failed to get directory id for path %1").arg(dir).arg(m_directoryid[dir.utf8().lower()]));
                 }
             }
-            else
-            {
-                MythContext::DBError("music select directory id", query);
-                return;
-            }
 
             BuildFileList(filename, music_files, newparentid);
+
             qApp->processEvents ();
         }
         else
@@ -101,16 +120,57 @@
                 qApp->processEvents();
                 update_interval = 0;
             }
+
             music_files[filename] = kFileSystem;
         }
     }
 }
 
+int FileScanner::GetDirectoryId(const QString &directory, const int &parentid)
+{
+    MSqlQuery query(MSqlQuery::InitCon());
+
+    // Load the directory id or insert it and get the id
+    query.prepare("SELECT directory_id FROM music_directories "
+                "WHERE path = :DIRECTORY ;");
+    query.bindValue(":DIRECTORY", directory.utf8());
+
+    if (query.exec() || query.isActive())
+    {
+        if (query.next())
+        {
+            return query.value(0).toInt();
+        }
+        else
+        {
+            query.prepare("INSERT INTO music_directories (path, parent_id) "
+                        "VALUES (:DIRECTORY, :PARENTID);");
+            query.bindValue(":DIRECTORY", directory.utf8());
+            query.bindValue(":PARENTID", parentid);
+
+            if (!query.exec() || !query.isActive()
+            || query.numRowsAffected() <= 0)
+            {
+                MythContext::DBError("music insert directory", query);
+                return -1;
+            }
+            return query.lastInsertId().toInt();
+        }
+    }
+    else
+    {
+        MythContext::DBError("music select directory id", query);
+        return -1;
+    }
+
+    return -1;
+}
+
 bool FileScanner::HasFileChanged(const QString &filename, const QString &date_modified)
 {
     struct stat stbuf;
 
-    if (stat(filename.ascii(), &stbuf) == 0)
+    if (stat(filename.local8Bit(), &stbuf) == 0)
     {
         if (date_modified.isEmpty() ||
             stbuf.st_mtime >
@@ -121,7 +181,8 @@
         }
     }
     else {
-        VERBOSE(VB_IMPORTANT, QString("Failed to stat file: %1").arg(filename.ascii()));
+        VERBOSE(VB_IMPORTANT, QString("Failed to stat file: %1")
+            .arg(filename.local8Bit()));
     }
     return false;
 }
@@ -132,9 +193,40 @@
 
     if (decoder)
     {
-        Metadata *data = decoder->getMetadata();
+        Metadata *data = decoder->readMetadata();
         if (data) {
+            QString directory = filename;
+            directory.remove(0, m_startdir.length());
+            directory = directory.section( '/', 0, -2);
+
+            QString album_cache_string;
+
+            // Set values from cache
+            if (m_directoryid[directory.utf8().lower()] > 0)
+                data->setDirectoryId(m_directoryid[directory.utf8().lower()]);
+            if (m_artistid[data->Artist().utf8().lower()] > 0)
+            {
+                data->setArtistId(m_artistid[data->Artist().utf8().lower()]);
+
+                // The album cache depends on the artist id
+                album_cache_string = data->getArtistId() + "#"
+                    + data->Album().utf8().lower();
+
+                if (m_albumid[album_cache_string] > 0)
+                    data->setAlbumId(m_albumid[album_cache_string]);
+            }
+            if (m_genreid[data->Genre().utf8().lower()] > 0)
+                data->setGenreId(m_genreid[data->Genre().utf8().lower()]);
+
+            // Commit track info to database
             data->dumpToDatabase();
+
+            // Update the cache
+            m_artistid[data->Artist().utf8().lower()] = data->getArtistId();
+            m_genreid[data->Genre().utf8().lower()] = data->getGenreId();
+            album_cache_string = data->getArtistId() + "#"
+                + data->Album().utf8().lower();
+            m_albumid[album_cache_string] = data->getAlbumId();
             delete data;
         }
 
@@ -143,11 +235,13 @@
 }
 
 // Remove a file from the database
-void FileScanner::RemoveFileFromDB (const QString &directory, const QString &filename)
+void FileScanner::RemoveFileFromDB (const QString &directory,
+const QString &filename)
 {
     QString sqlfilename(filename);
     // We know that the filename will not contain :// as the SQL limits this
     sqlfilename.remove(0, directory.length());
+    sqlfilename = sqlfilename.section( '/', -1 ) ;
     MSqlQuery query(MSqlQuery::InitCon());
     query.prepare("DELETE FROM music_songs WHERE "
                   "filename = :NAME ;");
@@ -166,9 +260,46 @@
 
         if (db_meta && disk_meta)
         {
+            QString directory = filename;
+            directory.remove(0, m_startdir.length());
+            directory = directory.section( '/', 0, -2);
+
             disk_meta->setID(db_meta->ID());
             disk_meta->setRating(db_meta->Rating());
+
+            QString album_cache_string;
+
+            // Set values from cache
+            if (m_directoryid[directory.utf8().lower()] > 0)
+                disk_meta->setDirectoryId(m_directoryid[directory
+                    .utf8().lower()]);
+            if (m_artistid[disk_meta->Artist().utf8().lower()] > 0)
+            {
+                disk_meta->setArtistId(m_artistid[disk_meta->Artist()
+                    .utf8().lower()]);
+
+                // The album cache depends on the artist id
+                album_cache_string = disk_meta->getArtistId() + "#"
+                    + disk_meta->Album().utf8().lower();
+
+                if (m_albumid[album_cache_string] > 0)
+                    disk_meta->setAlbumId(m_albumid[album_cache_string]);
+            }
+            if (m_genreid[disk_meta->Genre().utf8().lower()] > 0)
+                disk_meta->setGenreId(m_genreid[disk_meta->Genre()
+                    .utf8().lower()]);
+
+            // Commit track info to database
             disk_meta->dumpToDatabase();
+
+            // Update the cache
+            m_artistid[disk_meta->Artist().utf8().lower()]
+                = disk_meta->getArtistId();
+            m_genreid[disk_meta->Genre().utf8().lower()]
+                = disk_meta->getGenreId();
+            album_cache_string = disk_meta->getArtistId() + "#"
+                + disk_meta->Album().utf8().lower();
+            m_albumid[album_cache_string] = disk_meta->getAlbumId();
         }
 
         if (disk_meta)
@@ -269,4 +400,3 @@
     file_checking->Close();
     delete file_checking;
 }
-
