Commit bece40b6 authored by Vadim Rutkovsky's avatar Vadim Rutkovsky

query: be more specific about which XDG folder

has not been set
parent cf6ead2d
......@@ -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>'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment