From e72986212ae6ebc4becbc51d705b05a531d152fc Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Fri, 5 Jul 2013 17:02:54 +0200 Subject: [PATCH] Moved config file to ~/.config and now retrieving password from keyring --- thunner | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/thunner b/thunner index fd1ddd8..2c56f7e 100755 --- a/thunner +++ b/thunner @@ -33,7 +33,7 @@ import subprocess import collections import sys import signal - +import keyring from Queue import Queue, Empty from threading import Thread from gmusicapi import Webclient @@ -54,7 +54,7 @@ def parse_config(): 'text':'default' } config = { 'colors':[], 'assignments':defaultcolors } try: - with open(os.path.expanduser("~/.thunnerrc")) as f: + with open(os.path.expanduser("~/.config/thunnerrc")) as f: lines = f.readlines() for i in lines: words = i.split() @@ -68,9 +68,12 @@ def parse_config(): config['assignments'][words[2]] = words[1] if 'pass' not in config: # If Password not in Config, ask for it - config['pass'] = getpass() + k = keyring.get_keyring() + if isinstance(k, keyring.backends.Gnome.Keyring): + k.KEYRING_NAME = 'pwsafe' + config['pass'] = keyring.get_password('google-music', config['email']) except IOError: - print "Can't find ~/.thunnerrc" + print "Can't find ~/.config/thunnerrc" sys.exit() return config