[gnome-music] query: add some debug info: are Download / Music symlinks and number of files there



commit 454a97872f990573b74605e795546c402e7fe6d6
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Fri Oct 17 01:15:26 2014 +0200

    query: add some debug info: are Download / Music symlinks and number of files there

 gnomemusic/query.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index bc371c2..e1bf794 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -26,6 +26,9 @@
 # delete this exception statement from your version.
 
 from gi.repository import GLib, Tracker
+import os
+import logging
+logger = logging.getLogger(__name__)
 
 
 class Query():
@@ -34,6 +37,14 @@ class Query():
     download_folder = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD)
     DOWNLOAD_URI = Tracker.sparql_escape_string(GLib.filename_to_uri(download_folder))
 
+    for folder in [music_folder, download_folder]:
+        if os.path.islink(folder):
+            logger.warn("%s is a symlink, this folder will be omitted" % folder)
+        else:
+            i = len(next(os.walk(folder))[2])
+            logger.debug("Found %d files in %s" % (i, folder))
+
+
     @staticmethod
     def all_albums():
         return Query.albums('?album a nmm:MusicAlbum .')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]