summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/helper.cpp b/helper.cpp
index 91e4d7f..eaf0dda 100644
--- a/helper.cpp
+++ b/helper.cpp
@@ -3,6 +3,9 @@
#include <QAction>
#include <QApplication>
+#include <taglib/fileref.h>
+#include <taglib/audioproperties.h>
+
#include "helper.h"
namespace Helper {
@@ -23,4 +26,13 @@ namespace Helper {
a->setSeparator(true);
return a;
}
+
+ quint64 lengthInSeconds(const QString &file){
+ TagLib::FileRef f(QString(file).toUtf8());
+ if(f.isNull()){
+ return 0;
+ }
+ TagLib::AudioProperties *props = f.audioProperties();
+ return props->lengthInSeconds();
+ }
}