-
Notifications
You must be signed in to change notification settings - Fork 11
/
configurator.py
37 lines (28 loc) · 1.12 KB
/
configurator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
""" Configuration (gsettings) handler for Fileorganizer
----------------Authors----------------
Lachlan de Waard <[email protected]>
Wolter Hellmund <[email protected]>
----------------Licence----------------
Creative Commons - Attribution Share Alike v3.0
"""
from gi.repository import Gio
# gsettings locations for library and output paths
RHYTHMBOX_RHYTHMDB = 'locations'
RHYTHMBOX_LIBRARY = {'layout-path', 'layout-filename'}
class FileorganizerConf(object):
""" Class to read RB values using dconf/gsettings """
def __init__(self):
self.rhythmdbsettings = Gio.Settings("org.gnome.rhythmbox.rhythmdb")
self.librarysettings = Gio.Settings("org.gnome.rhythmbox.library")
# Request value
def get_val(self, key):
""" Fill values according to the current value in gsettings """
keypath = None
if key == RHYTHMBOX_RHYTHMDB:
return self.rhythmdbsettings[key]
elif key in RHYTHMBOX_LIBRARY:
return self.librarysettings[key]
else:
print('Invalid key requested')
return keypath