Possible to change the default startup filter?

General support for problems installing or using Deluge
Jerrk
Member
Member
Posts: 23
Joined: Thu Feb 13, 2020 4:45 pm

Possible to change the default startup filter?

Post by Jerrk »

I just hit 10k torrents and deluge is running completely fine except for one issue when starting the WebUI or thinclient in windows.

Since i have so many torrents active and the default tab being "all" it will try to load up all 10k torrents every time i start the client.
i've been able to sort of bypass this issue by clicking on a tracker the second the UI loads so it only shows the torrents for that specific tracker which makes the thinclient UI load much faster.

I was wondering if there is a way to change the default "all" tab to maybe "active" or "downloading" or maybe even a label of mine such as "done".

If i forget to click a tracker when the UI loads it can sometimes take several minutes for the UI to actually load, and sometimes the client will crash/freeze and windows will kill it.
The WebUI will never load for me after i reached i think 9k~ torrents, but since i always use the thinclient that issue is not a big deal for me specifically.

Thanks
Last edited by Jerrk on Tue May 24, 2022 1:43 pm, edited 1 time in total.
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Possible to change the default startup tab?

Post by mhertz »

For GTKUI to start with selected 'label' of 'done', then something along:

In '../deluge/ui/gtk3/filtertreeview.py', bottom function, from:

Code: Select all

    def select_default_filter(self):
        row = self.filters[('state', 'All')]
        path = self.treestore.get_path(row)
        self.treeview.get_selection().select_path(path)
Into:

Code: Select all

    def select_default_filter(self):
        component.get('TorrentView').set_filter({"label": ["done"]})
        try:
            row = self.filters[('label', 'done')]
            path = self.treestore.get_path(row)
            self.treeview.expand_to_path(path)
            self.treeview.get_selection().select_path(path)
        except:
            pass

Why I filter in beginning, is because wanna clear torrent-list as labels slightly delayed showing up, and also otherwise shows other error because not selected any row otherwise for the torrents(there's bound to a state-change-event regarding this). Then the reason for the try block, was that it otherwise shows a keyerror for the gtk.treeiter (deferred?) object returned during 'self.filters()', as not ready in dict yet(I initially made a reactor.callLater delayed function, without needing 'try', but not needed I found, and less effecient - could probably instead just keep search the dict untill ready, but anyway this works). Just explaining for people in the know(which definitelly isn't me btw :) ).
Jerrk
Member
Member
Posts: 23
Joined: Thu Feb 13, 2020 4:45 pm

Re: Possible to change the default startup tab?

Post by Jerrk »

Works perfectly, thanks!
Jerrk
Member
Member
Posts: 23
Joined: Thu Feb 13, 2020 4:45 pm

Re: Possible to change the default startup filter?

Post by Jerrk »

Is this still possible in 2.1.1?
it appears the file structure has been completely changed and i no longer have the '.../deluge/ui/gtk3/filtertreeview.py'' file available to edit
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Possible to change the default startup filter?

Post by mhertz »

I am taking a wild guess that you previously used my unofficial windows installer(or one of it's forks), to connect to your unraid instance? Yeah now scrolling up and reading your original posting describing windows usage, so must be it. Reason for not finding said files is the official installer now is freezed, as per proper norm, so the files to edit unfortunetly is embedded inside deluge.exe duing the pyinstaller freezing process.

Anyway, I guess I could rebuild/freeze deluge myself with said change in my win10 VM, and upload/post deluge.exe for you to replace locally. Not optimal obviously, and especially accepting exe files from others, but up to you. Also if wanting it, then will first be in a few days or so.

Hmm, would be easier to have a plugin doing this, and I just experimented very quick, but for now only could make it change to done label after one second(need delay here, because the place we use is not initialized yet for some reason), but it still lists the marking to be on 'all' default filter despite wrong(i.e. it only shows label done torrents to right, but on left it has wrongly selected 'all' filter, though just cosmetic issue, not functional), and to e.g. get back to 'all', then cannot press merely 'all' , but need press another heading and then 'all' afterwards. Not sure I can control the selected heading from an external plugin, like could with hacking the code directly, but can take a quick look more later at it, one of these days, and if succeed then will return, but other wise let me know if just something like I explained here could work etc.
User avatar
ambipro
Moderator
Moderator
Posts: 411
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: Possible to change the default startup filter?

Post by ambipro »

mhertz wrote: Mon May 29, 2023 7:16 pm I am taking a wild guess that you previously used my unofficial windows installer, to connect to your unraid instance? Yeah now scrolling up and reading your original posting describing windows usage, so must be it. Reason for not finding said files is the official installer now is freezed, as per proper norm, so the files to edit unfortunetly is embedded inside deluge.exe duing the pyinstaller freezing process.

Anyway, I guess I could rebuild/freeze deluge myself with said change in my win10 VM, and upload/post deluge.exe for you to replace locally. Not optimal obviously, and especially accepting exe files from others, but up to you. Also if wanting it, then will first be in a few days or so.

Hmm, would be easier to have a plugin doing this, and I just experimented very quick, but for now only could make it change to done label after one second(need delay here, because the place we use is not initialized yet for some reason), but it still lists the marking to be on 'all' default filter despite wrong(i.e. it only shows label done torrents to right, but on left it has wrongly selected 'all' filter, though just cosmetic issue, not functional), and to e.g. get back to 'all', then cannot press merely 'all' , but need press another heading and then 'all' afterwards. Not sure I can control the selected heading from an external plugin, like could with hacking the code directly, but can take a quick look more later at it, one of these days, and if succeed then will return, but other wise let me know if just something like I explained here could work etc.
Reading your response, it just crossed my mind that perhaps daodin didn't freeze his installer, and he just uploaded his latest build with updated libtorrents, perhaps he could use those if they aren't frozen and edit as normal...

If he does then my bad and I should have stayed bowed out as I said in PM :P
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Possible to change the default startup filter?

Post by mhertz »

Good thinking bro, though unfortunately still freezed, so I'm affraid not an option here. Just me clumsy formulating myself so get your response, and no reason to be bowed out, and appreciate your thinking as always buddy :) Thanks!
Jerrk
Member
Member
Posts: 23
Joined: Thu Feb 13, 2020 4:45 pm

Re: Possible to change the default startup filter?

Post by Jerrk »

mhertz wrote: Mon May 29, 2023 7:16 pm I am taking a wild guess that you previously used my unofficial windows installer(or one of it's forks), to connect to your unraid instance? Yeah now scrolling up and reading your original posting describing windows usage, so must be it. Reason for not finding said files is the official installer now is freezed, as per proper norm, so the files to edit unfortunetly is embedded inside deluge.exe duing the pyinstaller freezing process.
Yes you are correct, i was using the unofficial installer and have since switched to the official installer.
mhertz wrote: Mon May 29, 2023 7:16 pm Anyway, I guess I could rebuild/freeze deluge myself with said change in my win10 VM, and upload/post deluge.exe for you to replace locally. Not optimal obviously, and especially accepting exe files from others, but up to you. Also if wanting it, then will first be in a few days or so.

Hmm, would be easier to have a plugin doing this, and I just experimented very quick, but for now only could make it change to done label after one second(need delay here, because the place we use is not initialized yet for some reason), but it still lists the marking to be on 'all' default filter despite wrong(i.e. it only shows label done torrents to right, but on left it has wrongly selected 'all' filter, though just cosmetic issue, not functional), and to e.g. get back to 'all', then cannot press merely 'all' , but need press another heading and then 'all' afterwards. Not sure I can control the selected heading from an external plugin, like could with hacking the code directly, but can take a quick look more later at it, one of these days, and if succeed then will return, but other wise let me know if just something like I explained here could work etc.
I wouldn't want to bother you to have to update the .exe for each new version of deluge just for my specific usecase.

I'm assuming creating a plugin with a delay would be the easier of the two options, and i do not think the issue of marking would cause any problems for me personally.

The only other thing i would think of is i have renamed my "done" label to "3-done" just to organize all my labels in the sidebar in a more nice way, and if the plugin is hardcoded to just use "done" as a label it would not work for me in this case.

perhaps naming the plugin "default label" or something like that and then give a text field in the settings to choose said label on startup would work more generally.

Thanks for the help :D
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Possible to change the default startup filter?

Post by mhertz »

You're welcome, and I'll think about it, and post later. I still didn't could make the darn thing select the right heading annoyingly(just me being the issue i'm sure), but will look little more, but you said you would probably be OK with it, which is nice or else I couldn't do it in a plugin seemingly.

I will make it configurable then I think, just will take little longer then, but as said, i'll return at little later time.
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Possible to change the default startup filter?

Post by mhertz »

OK I gave it a fair shot but still couldn't overcome my issue of not being able to change the heading correctly, as am to noobish, sorry. As said it will then list 'All' as marked erronyously, which is wrong, and also if wanting 'All' you need to select something else and then back to 'All' afterwards, annoyingly. If finding a way later to fix, then i'll update it of-course.

(For completenes and feel free to ignore of-course - There's no deluge API call to change selected filtertree row to left, and it's done by deluge only in the file setting up the GTK.TreeView() from scratch in first place, and it's exposed deluge API component doesn't support the needed select_path()/cursor() etc, and even though I have connected to said object manually through gtk(or so I think atleast), then the gtk commands working from hacking source directly, doesn't work here in my plugin, no error but neither working, and I tried a bunch variations to no avail.)

Anyway, despite the wrong selected filter to the left, then the actual torrent-list to right is filtered fine at least, and no delay anymore needed. I made a GTK-UI preferences setting(and config-file one) named 'filter' to control this - If i'filter' is a string matching any one of the deluge states, then will filter torrent list from that(at startup), but if not matching a deluge state(case-sensitive), then will instead count it as a label and filter from that instead. Note the 'All' deluge state filter isn't allowed, as then you might as well instead just disable plugin(as standard behaviour). The deluge states I supported here are one of the following: ['Downloading', 'Seeding', 'Paused', 'Checking', 'Queued', 'Error', 'Active', 'Allocating', 'Moving']. No webUI support here btw.

Hope helps little bit.

startfilter-0.1.egg

(Code in unzipped plugin)
Post Reply