Compare commits

..

5 Commits

3 changed files with 33 additions and 5 deletions

View File

@ -48,8 +48,11 @@ def download(url, bitrate, portable, path):
arl = f.readline().rstrip("\n").strip() arl = f.readline().rstrip("\n").strip()
if not dz.login_via_arl(arl): arl = requestValidArl() if not dz.login_via_arl(arl): arl = requestValidArl()
else: arl = requestValidArl() else: arl = requestValidArl()
with open(configFolder / '.arl', 'w', encoding="utf-8") as f: try:
f.write(arl) with open(configFolder / '.arl', 'w', encoding="utf-8") as f:
f.write(arl)
except:
print(f"Error opening {configFolder / '.arl'}, continuing anyway.")
plugins = {} plugins = {}
if Spotify: if Spotify:

View File

@ -51,7 +51,7 @@ DEFAULTS = {
"localArtworkSize": 1400, "localArtworkSize": 1400,
"logErrors": True, "logErrors": True,
"logSearched": False, "logSearched": False,
"maxBitrate": str(TrackFormats.MP3_320), "maxBitrate": TrackFormats.MP3_320,
"overwriteFile": OverwriteOption.DONT_OVERWRITE, "overwriteFile": OverwriteOption.DONT_OVERWRITE,
"paddingSize": "0", "paddingSize": "0",
"padTracks": True, "padTracks": True,
@ -125,13 +125,17 @@ def load(configFolder=None):
except Exception: except Exception:
settings = deepcopy(DEFAULTS) settings = deepcopy(DEFAULTS)
if check(settings) > 0: save(settings, configFolder) # Check the settings and save them if something changed if check(settings) > 0:
try:
save(settings, configFolder) # Check the settings and save them if something changed
except:
print(f"Error saving config file {configFile.name}, continuing without saving.")
return settings return settings
def check(settings): def check(settings):
changes = 0 changes = 0
for i_set in DEFAULTS: for i_set in DEFAULTS:
if not i_set in settings or not isinstance(settings[i_set], type(DEFAULTS[i_set])): if not i_set in settings or not type(settings[i_set] is type(DEFAULTS[i_set])):
settings[i_set] = DEFAULTS[i_set] settings[i_set] = DEFAULTS[i_set]
changes += 1 changes += 1
for i_set in DEFAULTS['tags']: for i_set in DEFAULTS['tags']:

21
shell.nix Normal file
View File

@ -0,0 +1,21 @@
{
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell {
buildInputs = [
pkgs.python312
pkgs.python312Packages.virtualenv
];
shellHook = ''
if [ ! -d .venv ]; then
virtualenv .venv
. .venv/bin/activate
pip install -r requirements.txt
pip install -e .
else
. .venv/bin/activate
fi
'';
}