diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-03-30 15:05:03 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-04-14 10:56:21 -0700 |
commit | 4eee2655560fbb2f7724095bb7fa488f3f39ba55 (patch) | |
tree | f8903724e9890fd8163880d04a1f5545577ce3ed /app/lightmediascanner.cpp | |
parent | 86affe07b3ec456c8c43651a7d009508dd64491a (diff) |
dbus: add signal support for removable media
Detect media insertation and removal from lightmediascanner
and update the playlist accordingly. This makes some assumptions
that only one media device will available at a time.
Bug-AGL: SPEC-484
Change-Id: I8300abce3ac09c9cd0327c9d90892e3c5171d8d2
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'app/lightmediascanner.cpp')
-rw-r--r-- | app/lightmediascanner.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/lightmediascanner.cpp b/app/lightmediascanner.cpp index aa8c362..c17e0dc 100644 --- a/app/lightmediascanner.cpp +++ b/app/lightmediascanner.cpp @@ -40,3 +40,18 @@ bool LightMediaScanner::next(QString& item) return true; } + +QVariantList LightMediaScanner::processLightMediaScanner() +{ + QVariantList mediaFiles; + QString music; + LightMediaScanner scanner(QDir::homePath() + "/.config/lightmediascannerd/db.sqlite3"); + while (scanner.next(music)) { + QFileInfo fileInfo(music); + // Possible for stale entries due to removable media + if (!fileInfo.exists()) + continue; + mediaFiles.append(QUrl::fromLocalFile(music)); + } + return mediaFiles; +} |