

Wallpaper Other

AmarokQuilt
Utilities by keegancsmith 12 comments
Your code only checks covers downloaded by amarok. I modified the source so it also uses the covers stored inside the audio files. If you like you can merge this with your version of the code.
Seems like I can't attch files here, so I'll just paste the modifications below. The only changes are in AlbumArtworkItem::_updateArtwork()
-----------------------------------
void AlbumArtworkItem::_updateArtwork() {
// Get a list of cached amarok albums
QStringList coverList;
// get covers from "albumcovers/large"
QDir dirLarge(QDir::homePath() + "/.kde/share/apps/amarok/albumcovers/large/");
foreach(QString fileName, dirLarge.entryList(QDir::Files)) {
coverList << "large/"+ fileName;
}
// get covers from "albumcovers/tagcover"
QDir dirTagcover(QDir::homePath() + "/.kde/share/apps/amarok/albumcovers/tagcover/");
foreach(QString fileName, dirTagcover.entryList(QDir::Files)) {
coverList << "tagcover/"+ fileName;
}
// Try five times to find non-conflicting images. This reduces the chances
// of displaying an image twice at the same time greatly.
for (int i = 0; i < 5; i++) {
m_artworkFileTmp = coverList[std::rand() % coverList.size()];
if (AlbumArtworkItem::m_usedArtworks[m_artworkFileTmp] == 0)
break;
}
AlbumArtworkItem::m_usedArtworks[m_artworkFileTmp]++;
// Load selected cover into the temporary pixmap m_artworktmp
qDebug() << "Loading " << m_artworkFileTmp
<< AlbumArtworkItem::m_usedArtworks[m_artworkFileTmp];
QImage image(QDir::homePath() +"/.kde/share/apps/amarok/albumcovers/"+ m_artworkFileTmp);
image = image.scaled(QSize(m_size,m_size),
Qt::KeepAspectRatioByExpanding,
Qt::SmoothTransformation);
// Load pixmap in GUI thread
QMetaObject::invokeMethod(this, "updatePixmap", Qt::QueuedConnection,
Q_ARG(QImage, image));
}
-------------------------------------- - Oct 17 2008
Seems like I can't attch files here, so I'll just paste the modifications below. The only changes are in AlbumArtworkItem::_updateArtwork()
-----------------------------------
void AlbumArtworkItem::_updateArtwork() {
// Get a list of cached amarok albums
QStringList coverList;
// get covers from "albumcovers/large"
QDir dirLarge(QDir::homePath() + "/.kde/share/apps/amarok/albumcovers/large/");
foreach(QString fileName, dirLarge.entryList(QDir::Files)) {
coverList << "large/"+ fileName;
}
// get covers from "albumcovers/tagcover"
QDir dirTagcover(QDir::homePath() + "/.kde/share/apps/amarok/albumcovers/tagcover/");
foreach(QString fileName, dirTagcover.entryList(QDir::Files)) {
coverList << "tagcover/"+ fileName;
}
// Try five times to find non-conflicting images. This reduces the chances
// of displaying an image twice at the same time greatly.
for (int i = 0; i < 5; i++) {
m_artworkFileTmp = coverList[std::rand() % coverList.size()];
if (AlbumArtworkItem::m_usedArtworks[m_artworkFileTmp] == 0)
break;
}
AlbumArtworkItem::m_usedArtworks[m_artworkFileTmp]++;
// Load selected cover into the temporary pixmap m_artworktmp
qDebug() << "Loading " << m_artworkFileTmp
<< AlbumArtworkItem::m_usedArtworks[m_artworkFileTmp];
QImage image(QDir::homePath() +"/.kde/share/apps/amarok/albumcovers/"+ m_artworkFileTmp);
image = image.scaled(QSize(m_size,m_size),
Qt::KeepAspectRatioByExpanding,
Qt::SmoothTransformation);
// Load pixmap in GUI thread
QMetaObject::invokeMethod(this, "updatePixmap", Qt::QueuedConnection,
Q_ARG(QImage, image));
}
-------------------------------------- - Oct 17 2008