Skip to content

Commit

Permalink
refactor: minor corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
qx6ghqkz committed Dec 17, 2024
1 parent c92d8f2 commit 9c97fe6
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions gallery-dl-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,35 +104,36 @@ def config_remove(path, key=None, value=None):
else:
if entry.get(key):
entries.append(entry)
else:
elif value:
if entry == value:
entries.append(entry)

for entry in entries:
try:
_list.remove(entry)
except Exception as e:
logger.error("Exception: %s", str(e))
logger.error("Exception: %s", e)
else:
removed_entries.append(entry)

if isinstance(path, dict):
_dict = path

if value:
for k, v in _dict.items():
if k == key and v == value:
entries.append(k)
else:
for k in _dict.keys():
if k == key:
entries.append(k)
if key:
if value:
for k, v in _dict.items():
if k == key and v == value:
entries.append(k)
else:
for k in _dict.keys():
if k == key:
entries.append(k)

for entry in entries:
try:
val = _dict.pop(entry)
except Exception as e:
logger.error("Exception: %s", str(e))
logger.error("Exception: %s", e)
else:
removed_entries.append({entry: val})

Expand Down

0 comments on commit 9c97fe6

Please sign in to comment.