diff options
Diffstat (limited to 'helper.cpp')
-rw-r--r-- | helper.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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(); + } } |