From 0afebd0e3cb3da831cd5ffba1eefbe9e61e408a1 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 27 Jul 2013 03:59:47 +0200 Subject: Read JSON from ffprobe Use JSON output from ffprobe instead of string parsing to get some kind of type safety. For doing that, some changes were needed in FileView: Use delegates for displaying Duration and Bitrate instead of mangling output in Qt::Displayrole. To reuse code, move all delegates from the new Archive to a separate file. And, of course, the initial objective: Show the accumulated size and duration of selected files in the status bar from the experimental archive. --- newmoviewizard.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'newmoviewizard.cpp') diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp index 9447a6c..a5df22a 100644 --- a/newmoviewizard.cpp +++ b/newmoviewizard.cpp @@ -31,6 +31,7 @@ #include "mappingtablemodel.h" #include "seriesmetadatamodel.h" #include "filestreemodel.h" +#include "delegates.h" #include "helper.h" #include "pictureviewer2.h" #include "archivemodel.h" @@ -124,13 +125,12 @@ void NewMovieWizard::accept(){ qint64 size = fi.size(); QString md5 = Helper::md5Sum(fullPath); md5Sums.insert(fullPath, md5); - int secs = 0; + qint64 secs = 0; QString picSize; int type = fData.value(WizardTreeModel::FileType).toInt(); if(type == ArchiveFilesModel::Movie){ - QVariant v = Helper::duration(fullPath).value(0); - Helper::Duration dur = v.value(); - secs = dur.toSeconds(); + QVariantMap m = Helper::ffmpegData(fullPath); + secs = m.value("duration").toInt(); }else{ QPixmap pix(fullPath); picSize = QString("%1x%2").arg(QString::number(pix.width())).arg(QString::number(pix.height())); -- cgit v1.2.3-70-g09d2