Closed narenh closed 3 months ago
struct Category: Decodable {
let name: String
let savePath: String
}
could be a fix. I don't think qBitControl needs access to download_path
since that's all handled by Qbittorrent so defining this type and then ignoring the download_path
key when decoding should fix the issue. The other nice thing is using a struct like this should remove the need for categoriesArr
and categoriesPaths
which seems kinda messy.
Thank you for fixing the bugs and simplifying the code! It seems that the "Use another path for incomplete torrents" option is not available in the WebUI, so I never noticed, as I use a headless version of qBittorrent on my server.
Regarding the optimization you mentioned in #17, creating a CategoryManager is indeed a good idea. However, there is another method that could be effective. In the WebUI, all changes are fetched from /api/v2/sync/maindata
, which prevents the same data from being fetched repeatedly. When I created this app, I wasn't aware of this method. I plan to implement it in the future, but it will be tricky and require a lot of changes.
Describe the bug If any one of your categories has "Use another path for incomplete torrents" set to No (as opposed to Default or Yes), no categories will load in the app.
To Reproduce Steps to reproduce the behavior:
Expected behavior Categories should appear
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Additional context In
func requestCategoriesJSON()
, JSONDecoder expects[String: [String: String]]
. However,download_path
is returned as a Booleanfalse
if "use another path" is set to No. If "use another path" is set to Yes, thendownload_path
is a string containing the alternate download path.This seems like poor API design on Qbittorrent's part, so I imagine a solution will have to work around this.