From 7bda040f35c6be15dbf1ba007de28849a0803cae Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 16 Mar 2013 16:13:05 +0100 Subject: First shot at SmDirModel Gotta take a break here. Hopefully this will end up in a custom QFilesystemModel, but I'm hitting so many bugs on the way. Some things haven't worked for ages, I guess. Anyway, the watcher doesn't do anythying right now, still fixing bugs... --- helper.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'helper.cpp') diff --git a/helper.cpp b/helper.cpp index b3f2fc6..cfb1711 100644 --- a/helper.cpp +++ b/helper.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -208,5 +209,33 @@ namespace Helper { widgetRect.moveCenter(qApp->desktop()->screenGeometry(widget).center()); widget->move(widgetRect.topLeft()); } + + QList duration(const QString &path){ + QSettings s; + QString ffProbe = s.value("paths/ffprobe").toString(); + QStringList args; + QList retval; + args << "-show_streams" << path; + QProcess ffproc; + ffproc.start(ffProbe, args); + if(!ffproc.waitForStarted()){ + return retval; + } + ffproc.waitForFinished(); + QByteArray ffData = ffproc.readAllStandardError(); + QList lines = ffData.split('\n'); + + foreach(QString l, lines){ + QString llc = l.toLower(); + if(llc.contains("duration")){ + int idx = llc.indexOf("duration:"); + retval << llc.mid(idx + 10, 8); + idx = llc.indexOf("bitrate:"); + retval << llc.mid(idx + 9); + break; + } + } + return retval; + } } -- cgit v1.2.3-70-g09d2