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. --- smdirwatcher.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'smdirwatcher.cpp') diff --git a/smdirwatcher.cpp b/smdirwatcher.cpp index 2421b1e..a6163c2 100644 --- a/smdirwatcher.cpp +++ b/smdirwatcher.cpp @@ -147,7 +147,9 @@ const QList SmDataColletor::fileData(const QFileInfo &fi){ data << fi.lastModified(); QList si = QList() << QVariant() << QVariant(); if(mime.startsWith("video")){ - si = Helper::duration(fi.absoluteFilePath()); + QVariantMap ffData = Helper::ffmpegData(fi.absoluteFilePath()); + si[0] = ffData.value("duration").toDouble(); + si[1] = ffData.value("bit_rate").toInt(); }else if(mime.startsWith("image")){ QImage img(fi.absoluteFilePath()); si[0] = img.size(); -- cgit v1.2.3-70-g09d2