diff options
author | Arno <am@disconnect.de> | 2013-03-16 16:13:05 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-03-16 16:13:05 +0100 |
commit | 7bda040f35c6be15dbf1ba007de28849a0803cae (patch) | |
tree | 561995ddb3cd7087dbc6b993c0a5a4cd0166418f /helper.cpp | |
parent | 5dbe3b400f798b0d9c5c72bb1fdbf762c603fad8 (diff) | |
download | SheMov-7bda040f35c6be15dbf1ba007de28849a0803cae.tar.gz SheMov-7bda040f35c6be15dbf1ba007de28849a0803cae.tar.bz2 SheMov-7bda040f35c6be15dbf1ba007de28849a0803cae.zip |
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...
Diffstat (limited to 'helper.cpp')
-rw-r--r-- | helper.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -18,6 +18,7 @@ #include <QTemporaryFile> #include <QProcess> #include <QRect> +#include <QTime> #include <QtWidgets/QWidget> #include <QtWidgets/QDesktopWidget> #include <QtWidgets/QApplication> @@ -208,5 +209,33 @@ namespace Helper { widgetRect.moveCenter(qApp->desktop()->screenGeometry(widget).center()); widget->move(widgetRect.topLeft()); } + + QList<QVariant> duration(const QString &path){ + QSettings s; + QString ffProbe = s.value("paths/ffprobe").toString(); + QStringList args; + QList<QVariant> retval; + args << "-show_streams" << path; + QProcess ffproc; + ffproc.start(ffProbe, args); + if(!ffproc.waitForStarted()){ + return retval; + } + ffproc.waitForFinished(); + QByteArray ffData = ffproc.readAllStandardError(); + QList<QByteArray> 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; + } } |