Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jq: Argument list too long #5

Open
IkiaeM opened this issue May 20, 2024 · 0 comments
Open

jq: Argument list too long #5

IkiaeM opened this issue May 20, 2024 · 0 comments

Comments

@IkiaeM
Copy link

IkiaeM commented May 20, 2024

Hello,

I've just discovered your extra ordinary and very useful tools.
But I've run into a problem, let me explain.

I have more than 500 torrents in my qbit, and when I add a torrent your before-after verification method retrieves the entire list of torrents and compares it... with the entire list of torrents after the upload.
Except that I wasn't getting the torrent hash or even the info that followed because JQ was actually returning an error but you weren't showing it, so I reproduced your code by hand and indeed jq has arguments that are too long. It seems that having a lot of torrents is too much for him and therefore no result.

So I put in place, not having read all your code and everything you did.
I first tried to limit the number of results directly via the API call with "limit=10" but it doesn't seem to return the last element sorted by date, which is a problem....
So I abandoned the idea of processing directly from the api but after your call by adding "| jq .[-10:]" which filters the list of torrents to the last 10 elements and then I put this on the $oldinfo, $newinfo and recheck $newinfo.

I haven't done this anywhere else, using nothing else, but I think it might be useful to reduce the number to maybe 50 items, which seems more reasonable to check that no more than 1 torrent has been uploaded, or none at all.

Line 562 : local oldinfo=$(__META_qbrequest 'torrents/info?sort=added_on' | jq .[-10:])
Line 575 : local newinfo=$(__META_qbrequest 'torrents/info?sort=added_on' 2>/dev/null | jq .[-10:])
Line 580 : newinfo=$(__META_qbrequest 'torrents/info?sort=added_on' 2>/dev/null | jq .[-10:])

By the way, I didn't understand why the variable wasn't local in the case of recheck if $diff is empty.
But here's my modification

Good day/evening

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant