Compare commits
6 Commits
master
...
config_opt
Author | SHA1 | Date | |
---|---|---|---|
c7e66ccbab | |||
320bdfaa92 | |||
e73e27b954 | |||
d7fb3f78f9 | |||
811979cea7 | |||
5856541a22 |
@ -1,18 +1,20 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import configparser
|
import argparse
|
||||||
import os
|
import os
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import dir_activities
|
import dir_activities
|
||||||
import api_calls
|
import api_calls
|
||||||
|
from prog_conf import gaa_conf
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
gaa_version = "2024.10.15.2"
|
||||||
if (os.path.exists('config.ini')):
|
|
||||||
conf_path = 'config.ini'
|
|
||||||
else:
|
|
||||||
conf_path = os.path.join(os.path.expanduser("~"), ".local/share/get_artist_art/config.ini")
|
|
||||||
|
|
||||||
config.read(conf_path)
|
option_set = argparse.ArgumentParser(description=f"An automatic downloader of artist art using MusicBrainz and Fanart.TV.\nVersion: {gaa_version}")
|
||||||
|
jls_extract_var = f'%(prog)s {gaa_version}'
|
||||||
|
option_set.add_argument('--version', '-v', action='version', version=jls_extract_var)
|
||||||
|
cmd_options = option_set.parse_args()
|
||||||
|
|
||||||
|
config = gaa_conf().conf
|
||||||
|
|
||||||
music_path = config['music']['dir']
|
music_path = config['music']['dir']
|
||||||
ftv_api_key = config['fanart_tv']['api_key']
|
ftv_api_key = config['fanart_tv']['api_key']
|
||||||
|
19
prog_conf.py
Normal file
19
prog_conf.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import configparser
|
||||||
|
from os.path import exists,join,expanduser
|
||||||
|
|
||||||
|
|
||||||
|
class gaa_conf:
|
||||||
|
def __init__(self):
|
||||||
|
self.conf = configparser.ConfigParser()
|
||||||
|
if (exists('config.ini')):
|
||||||
|
self.conf_path = 'config.ini'
|
||||||
|
else:
|
||||||
|
self.conf_path = join(expanduser(
|
||||||
|
"~"), ".local/share/get_artist_art/config.ini")
|
||||||
|
self.conf.read(self.conf_path)
|
||||||
|
|
||||||
|
def get():
|
||||||
|
return gaa_conf
|
||||||
|
def set_conf(self, conf_path):
|
||||||
|
self.read(conf_path)
|
||||||
|
return self
|
Loading…
x
Reference in New Issue
Block a user