diff options
author | Arno <arno@disconnect.de> | 2017-03-05 17:23:33 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-03-05 17:23:33 +0100 |
commit | 2ff72f033af3f24ffb816bc19a34fc794f585775 (patch) | |
tree | be21b99d6ac7ebf60d398daca79567bb6e5b0565 /indexerwidget.cpp | |
parent | 51990db36b7b4c1ff8ca72ff16ded36c72be24b9 (diff) | |
download | BeetPlayer-2ff72f033af3f24ffb816bc19a34fc794f585775.tar.gz BeetPlayer-2ff72f033af3f24ffb816bc19a34fc794f585775.tar.bz2 BeetPlayer-2ff72f033af3f24ffb816bc19a34fc794f585775.zip |
Implement statusBar
Display in statusBar:
* viewMode
* number of files in playlist
* length of playlist in h:m:s
* player status (Stopped, Playing, Paused)
Diffstat (limited to 'indexerwidget.cpp')
-rw-r--r-- | indexerwidget.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/indexerwidget.cpp b/indexerwidget.cpp index f30de80..49b221a 100644 --- a/indexerwidget.cpp +++ b/indexerwidget.cpp @@ -12,6 +12,8 @@ #include <QProgressBar> #include "taglib/tag.h" +#include "taglib/audioproperties.h" + #include "indexerwidget.h" #include "globals.h" @@ -91,7 +93,7 @@ BeetReader::BeetReader() : mCanceled(false){ mCurAlbumQ = new QSqlQuery(mDb); mCurAlbumQ->prepare("SELECT currval('albums_ialbums_id__seq')"); mInsertSongQ = new QSqlQuery(mDb); - mInsertSongQ->prepare("INSERT INTO songs (ialbums_id, sipos, ttitle, iartists_id, igenres_id, tfullpath) VALUES(:aid, :pos, :title, :iartistid, :igenid, :tfp)"); + mInsertSongQ->prepare("INSERT INTO songs (ialbums_id, sipos, ttitle, iartists_id, igenres_id, tfullpath, ilength) VALUES(:aid, :pos, :title, :iartistid, :igenid, :tfp, :len)"); } void BeetReader::run(){ @@ -124,6 +126,7 @@ void BeetReader::run(){ QString album = toQString(file.tag()->album()); QString title = toQString(file.tag()->title()); QString genre = toQString(file.tag()->genre()); + int length = file.audioProperties()->lengthInSeconds(); quint16 track = file.tag()->track(); quint16 year = file.tag()->year(); @@ -131,7 +134,7 @@ void BeetReader::run(){ int artistId = doArtist(artist); int genreId = doGenre(genre); int albumId = doAlbum(album, year); - doSong(title, track, albumId, genreId, artistId, s); + doSong(title, track, albumId, genreId, artistId, s, length); if(ctr % 100 == 0){ emit progress(ctr); @@ -229,7 +232,7 @@ int BeetReader::doAlbum(QString name, int year){ return retval; } -void BeetReader::doSong(QString title, int pos, int album, int genre, int artist, QString fullpath){ +void BeetReader::doSong(QString title, int pos, int album, int genre, int artist, QString fullpath, int length){ mDb.transaction(); mInsertSongQ->bindValue(":title", title); mInsertSongQ->bindValue(":pos", pos); @@ -237,6 +240,7 @@ void BeetReader::doSong(QString title, int pos, int album, int genre, int artist mInsertSongQ->bindValue(":iartistid", artist); mInsertSongQ->bindValue(":igenid", genre); mInsertSongQ->bindValue(":tfp", fullpath); + mInsertSongQ->bindValue(":len", length); mInsertSongQ->exec(); mDb.commit(); } |