mirror of
https://github.com/vikstrous/pirate-get
synced 2025-03-12 18:58:39 +01:00
throws exception instead of error if local database doesnt exist
This commit is contained in:
parent
c0293fce1d
commit
310f91ede7
@ -52,17 +52,25 @@ def parse_config_file(text):
|
||||
|
||||
return config
|
||||
|
||||
|
||||
print 'exist'
|
||||
def load_config():
|
||||
# user-defined config files
|
||||
config_home = os.getenv('XDG_CONFIG_HOME', '~/.config')
|
||||
config = expanduser(os.path.join(config_home, 'pirate-get'))
|
||||
|
||||
# read config file
|
||||
|
||||
if os.path.isfile(config):
|
||||
with open(config) as f:
|
||||
return parse_config_file(f.read())
|
||||
|
||||
# sees if local database exsists
|
||||
try:
|
||||
os.path.isfile('/root/downloads/pirate-get/db')
|
||||
|
||||
except FileNotFoundError:
|
||||
return "piratebay local database does not exsist!"
|
||||
|
||||
return parse_config_file("")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user