Compare commits

...

6 Commits

Author SHA1 Message Date
c7e66ccbab Remove testing code from get_artist_art.py 2024-10-16 11:53:34 -04:00
320bdfaa92 Impiment set_conf.
This function updates the config file being used by the script.
2024-10-16 11:52:39 -04:00
e73e27b954 Remove old code.
Remove the old config setup code.
2024-10-16 11:22:04 -04:00
d7fb3f78f9 Simplify setup of gaa_conf.
Now done on one line in the main file.
2024-10-16 11:21:18 -04:00
811979cea7 Move configparser code to seperate module
This code is now in its own Class. This is to make it easier to do reporting and updating.
2024-10-16 11:20:14 -04:00
5856541a22 Display version number
The program will now output a version number with the use of either the 'version' or 'help' options.
2024-10-15 15:06:54 -04:00
2 changed files with 29 additions and 8 deletions

View File

@ -1,18 +1,20 @@
#!/usr/bin/env python3
import configparser
import argparse
import os
from time import sleep
import dir_activities
import api_calls
from prog_conf import gaa_conf
config = configparser.ConfigParser()
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)
gaa_version = "2024.10.15.2"
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']
ftv_api_key = config['fanart_tv']['api_key']

19
prog_conf.py Normal file
View 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