Skip to content

Commit ca04d3d

Browse files
committed
Minor fix
Signed-off-by: anasty17 <[email protected]>
1 parent 4790c54 commit ca04d3d

File tree

2 files changed

+33
-15
lines changed

2 files changed

+33
-15
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ programming in Python.
77

88
## qBittorrent
99

10-
- External access to webui, so you can remove files or edit settings
11-
- Select files from a Torrent before and during download (Requires Base URL) (task option)
10+
- External access to webui, so you can remove files or edit settings. Then you can sync settings in database with sync button in bsetting
11+
- Select files from a Torrent before and during download using mltb file selector (Requires Base URL) (task option)
1212
- Seed torrents to a specific ratio and time (task option)
1313
- Edit Global Options while the bot is running from bot settings (global option)
1414

@@ -23,8 +23,8 @@ programming in Python.
2323

2424
## Sabnzbd
2525

26-
- External access to web interface, so you can remove files or edit settings
27-
- Remove files from job before and during download (Requires Base URL) (task option)
26+
- External access to web interface, so you can remove files or edit settings. Then you can sync settings in database with sync button in bsetting
27+
- Remove files from job before and during download using mltb file selector (Requires Base URL) (task option)
2828
- Edit Global Options while the bot is running from bot settings (global option)
2929
- Servers menu to edit/add/remove usenet servers
3030

bot/modules/bot_settings.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async def get_buttons(key=None, edit_type=None):
131131
buttons.ibutton("Default", f"botset resetnzb {key}")
132132
buttons.ibutton("Empty String", f"botset emptynzb {key}")
133133
buttons.ibutton("Close", "botset close")
134-
msg = f"Send a valid value for {key}. Current value is '{nzb_options[key]}.\nIf the value is list then seperate them by space or ,\nExample: .exe,info or .exe .info\nTimeout: 60 sec"
134+
msg = f"Send a valid value for {key}. Current value is '{nzb_options[key]}'.\nIf the value is list then seperate them by space or ,\nExample: .exe,info or .exe .info\nTimeout: 60 sec"
135135
elif edit_type.startswith("nzbsevar"):
136136
index = 0 if key == "newser" else int(edit_type.replace("nzbsevar", ""))
137137
buttons.ibutton("Back", f"botset nzbser{index}")
@@ -211,7 +211,9 @@ async def get_buttons(key=None, edit_type=None):
211211
msg = f"Sabnzbd Options | Page: {int(START / 10)} | State: {STATE}"
212212
elif key == "nzbserver":
213213
if len(config_dict["USENET_SERVERS"]) > 0:
214-
for index, k in enumerate(config_dict["USENET_SERVERS"][START : 10 + START]):
214+
for index, k in enumerate(
215+
config_dict["USENET_SERVERS"][START : 10 + START]
216+
):
215217
buttons.ibutton(k["name"], f"botset nzbser{index}")
216218
buttons.ibutton("Add New", "botset nzbsevar newser")
217219
buttons.ibutton("Back", "botset nzb")
@@ -440,7 +442,9 @@ async def edit_nzb_server(_, message, pre_message, key, index=0):
440442
await update_buttons(pre_message, f"nzbser{index}")
441443
await deleteMessage(message)
442444
if DATABASE_URL:
443-
await DbManager().update_config({"USENET_SERVERS": config_dict["USENET_SERVERS"]})
445+
await DbManager().update_config(
446+
{"USENET_SERVERS": config_dict["USENET_SERVERS"]}
447+
)
444448
await nzb_client.log_out()
445449

446450

@@ -723,12 +727,16 @@ async def edit_bot_settings(client, query):
723727
if DATABASE_URL:
724728
await DbManager().update_nzb_config()
725729
elif data[1] == "syncnzb":
726-
await query.answer("Syncronization Started. It takes up to 2 sec!", show_alert=True)
730+
await query.answer(
731+
"Syncronization Started. It takes up to 2 sec!", show_alert=True
732+
)
727733
await get_nzb_options()
728734
if DATABASE_URL:
729735
await DbManager().update_nzb_config()
730736
elif data[1] == "syncqbit":
731-
await query.answer("Syncronization Started. It takes up to 2 sec!", show_alert=True)
737+
await query.answer(
738+
"Syncronization Started. It takes up to 2 sec!", show_alert=True
739+
)
732740
await get_qb_options()
733741
if DATABASE_URL:
734742
await DbManager().save_qbit_settings()
@@ -766,12 +774,16 @@ async def edit_bot_settings(client, query):
766774
elif data[1] == "remser":
767775
index = int(data[2])
768776
nz_client = get_sabnzb_client()
769-
await nz_client.delete_config("servers", config_dict["USENET_SERVERS"][index]["name"])
777+
await nz_client.delete_config(
778+
"servers", config_dict["USENET_SERVERS"][index]["name"]
779+
)
770780
del config_dict["USENET_SERVERS"][index]
771781
await update_buttons(message, "nzbserver")
772-
if DATABASE_URL:
773-
await DbManager().update_config({"USENET_SERVERS": config_dict["USENET_SERVERS"]})
774782
await nz_client.log_out()
783+
if DATABASE_URL:
784+
await DbManager().update_config(
785+
{"USENET_SERVERS": config_dict["USENET_SERVERS"]}
786+
)
775787
elif data[1] == "private":
776788
await query.answer()
777789
await update_buttons(message, data[1])
@@ -851,11 +863,17 @@ async def edit_bot_settings(client, query):
851863
await update_buttons(message, f"nzbser{data[2]}")
852864
index = int(data[2])
853865
nzb_client = get_sabnzb_client()
854-
res = await nzb_client.add_server({"name": config_dict["USENET_SERVERS"][index]['name'], data[3]: ""})
855-
config_dict["USENET_SERVERS"][index][data[3]] = res['config']['servers'][0][data[3]]
866+
res = await nzb_client.add_server(
867+
{"name": config_dict["USENET_SERVERS"][index]["name"], data[3]: ""}
868+
)
869+
config_dict["USENET_SERVERS"][index][data[3]] = res["config"]["servers"][0][
870+
data[3]
871+
]
856872
await nzb_client.log_out()
857873
if DATABASE_URL:
858-
await DbManager().update_config_dict["USENET_SERVERS"]()
874+
await DbManager().update_config(
875+
{"USENET_SERVERS": config_dict["USENET_SERVERS"]}
876+
)
859877
elif data[1].startswith("nzbsevar") and (STATE == "edit" or data[2] == "newser"):
860878
index = 0 if data[2] == "newser" else int(data[1].replace("nzbsevar", ""))
861879
await query.answer()

0 commit comments

Comments
 (0)