[gnome-music] query: be more specific about which XDG folder has not been set
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] query: be more specific about which XDG folder has not been set
- Date: Tue, 11 Aug 2015 08:25:34 +0000 (UTC)
commit bece40b6b31c1e656ba655f583449dbb9fc9c772
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Tue Aug 11 10:24:30 2015 +0200
query: be more specific about which XDG folder
has not been set
gnomemusic/query.py | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index 251453f..584c06f 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -43,18 +43,25 @@ class Query():
DOWNLOAD_URI = None
try:
music_folder = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC)
- MUSIC_URI = Tracker.sparql_escape_string(GLib.filename_to_uri(music_folder))
+ except TypeError:
+ logger.warn("XDG Music dir is not set")
+ return
+
+ try:
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)
except TypeError:
- logger.warn("XDG user dirs are not set")
+ logger.warn("XDG Download dir is not set")
+ return
+
+ MUSIC_URI = Tracker.sparql_escape_string(GLib.filename_to_uri(music_folder))
+ 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)
def __repr__(self):
return '<Query>'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]