diff options
-rw-r--r-- | archivemodel.cpp | 12 | ||||
-rw-r--r-- | newmoviewizard.cpp | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/archivemodel.cpp b/archivemodel.cpp index 692629d..4f4c69e 100644 --- a/archivemodel.cpp +++ b/archivemodel.cpp @@ -857,6 +857,18 @@ void ArchiveFilesModel::populate(const QSet<int> &seriesPartIds){ if(data.at(FileType).toInt() == Movie){ SmTreeItem *newItem = new SmTreeItem(data, movies); movies->appendChild(newItem); + if((data.at(DvdNo).toInt() < 0) && (data.at(SizeDur) == 0)){ + QVariantMap m = Helper::ffmpegData(data.at(FullPath).toString()); + QSqlQuery updDurQ = QSqlQuery(mDb); + updDurQ.prepare("UPDATE files SET iduration = :dur WHERE ifiles_id = :id"); + // we have to cast this to int explicitly, otherwise Postgres will choke + int dur = m.value("duration").toDouble(); + updDurQ.bindValue(":dur", dur); + updDurQ.bindValue(":id", data.at(FileId)); + if(updDurQ.exec()){ + data[SizeDur] = dur; + } + } }else{ SmTreeItem *newItem = new SmTreeItem(data, pictures); pictures->appendChild(newItem); diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp index 72b7d1e..9c12dca 100644 --- a/newmoviewizard.cpp +++ b/newmoviewizard.cpp @@ -128,7 +128,7 @@ void NewMovieWizard::accept(){ int type = fData.value(WizardTreeModel::FileType).toInt(); if(type == ArchiveFilesModel::Movie){ QVariantMap m = Helper::ffmpegData(fullPath); - secs = m.value("duration").toInt(); + secs = m.value("duration").toDouble(); }else{ QPixmap pix(fullPath); picSize = QString("%1x%2").arg(QString::number(pix.width())).arg(QString::number(pix.height())); |