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
an add-on for automatically filter before download #701
Comments
Yes, you can create such an add-on. You'll want to add the
|
@elelay, Do you know of any extensions that modify the podcast settings dialog, or do you know how I could add a tab to that dialog? A filtering extension would be more useful if the user could edit filters in each podcast's settings dialog instead of hardcoding them in the extension's python file. |
The code says on_ui_object_available shouldn't be used but with the following patch, I was able to add a tab to the podcast's settings dialog. What I can't figure out though, is how to save changes to self.container.config.<extension>.* made by the extension. The changes show up in the edit config dialog but are lost when gpodder restarts.
|
Interesting: the on_ui_object_available is only used to give the main window to extensions. But why not pass other parts, indeed! Changes to the settings should be persistent : it's used in many extensions. Does it work if you do it in the edit config dialog, not in your podcast settings tab? |
Double-clicking on the setting and then hitting enter to exit the edit does cause it to be saved. I looked through the edit config and preferences and couldn't find any save ability. |
It does save the settings modified by the extension, but it is buggy. I have a setting that defaults to an empty array with []. It doesn't save when appending one dictionary to the array and quiting. Appending two or more dictionaries will save both correctly. Removing one of the dictionaries so it only has one will cause it to not save and on next startup, it has both dictionaries again. |
There were no bugs, it was just randomly saving, not sure how though. Calling self.container.manager.core.config.schedule_save() when the extension makes changes seems to work. It auto-saves after 60 seconds or at shutdown if sooner. I'll post the extension tomorrow after I clean it up. |
Thank you for your interest and enthusiasm, I follow with interest ... [I am under seven and I can install gpodder specially for that, because I use it normally in portable version] |
yes, the config module is tricky: it can only observe changes when you set an attribute of an object.
|
http://borg.qzx.com/files/gpodder-filter-extension.zip Unzip that file to ~/gPodder/Extensions/ and restart gpodder. Then open settings for a podcast and go to the new "Filter" tab. It has some help text on the dialog. ISSUES:
@elelay, Setting the key to itself doesn't trigger _on_key_changed(). |
i try (with a new/clean) 3.10.11 on seven : i have the extension in the list and active-it but after the re-start i haven't new "Filter" tab in the right clic podcast setting windows... if this is because of your 702 issues, i don't know how to apply... |
That link is the most important patch, #702 is only needed if you will delete a podcast that has been filtered. You need to find where gpodder is installed, edit gtkui/desktop/channel.py, go to line 96 and insert the following line (including the 8 spaces at start of line):
|
ok, ty (sorry for my level!...) It seem to work for me :-) |
I didn't think about case-sensitivity. Not sure if I should add a checkbox or just always ignore case for normal and RE filters.
I'm not sure what you are saying here, but #702 isn't related. |
I meant that I think there is a problem if/when we change the word/filter: no more downloads are offered (neither for the old nor for the new filter) |
http://borg.qzx.com/test-rss.php For that fake test feed, if you set filter for 'aaa' and update, it will mark all episodes with 'aaa' as old. After changing filter to 'bbb' and updating, it will mark all episodes with 'bbb' as old. But it never marks episodes as new when no longer blocked. Is this the problem you are describing? If so, I'm not sure it should be changed. The user may have manually marked an allowed episode as old and having the extension mark it back to new would be unwanted behavior. I added a button on the filter tab to manually force a re-filtering of all episodes. A new download is available at http://borg.qzx.com/files/gpodder-filter-extension.zip. But the following patch is required to refresh the episode list. Without the patch, you must click another podcast and then click back to refresh. Edit gtkui/main.py around line 3118 and insert the line starting with a +, but remove the +. @elelay, It would probably be better if the gPodder instance was passed to gPodderChannel instead of passing a bunch of its methods.
|
Thank you for describing how the extension works ; that's what I was describing. the idea of a re-filtering button seems excellent (either for a modification of the filter, or in case of typing error during the first filtering ...) I will test it tonight or we (because i have a pb of electricity and snow here!) Thanks again for all this work |
it seems to work fine :-) nice job and great thank you |
i try to translate for myself for now so i add
in line 2 for accented characters in your filter.py |
I added that utf-8 line to the extension. I also figured out that the gPodder instance could be grabbed from on_ui_object_available('gpodder-gtk') so the second patch here for update_episode_list_mode is not needed. @alexis26 There is no reason to download newest version if you've modified your copy. |
Hi, Since I tested the version of auouymous it works very well and I use it a lot ; it's super practical! |
This is mainly me forgetting about it. Still, it's not super trivial to integrate: I'm not sure Wouldn't it be better to add an extension point like @auouymous maybe we can refine this in a PR? |
http://borg.qzx.com/files/gpodder-filter-v2-extension.zip Requires https://github.com/gpodder/gpodder/commit/117e72107411388fa2322a34002f57102c6248aa.patch applied to gpodder or use https://ci.appveyor.com/project/elelay/gpodder/builds/30507515/artifacts if on windows. Now uses the on_channel_settings callback and supports case-insensitive filtering. Also cleaned up the UI and localized all strings (assuming that is how it is done). |
Hi for me it works well ... just a small thing (for the user friendly side): I fully understand the logic of having to check 'block' before checking 'allow' which will block everything except what you allow ... Otherwise, I wanted at least to help translate into my language (not be only requester!...) But I saw nothing in the 'po' |
What modifications have you made? Having allow automatically tick block might be less intuitive. By checking block first you know that episodes are being blocked and you can unblock some by checking allow. It might be confusing to enable both choices up front and then block is forced on and shaded when you enable allow. The action is also not symmetrical, when you uncheck allow, block would remain checked. Having it so unchecking allow also unchecks block would cause data loss for anyone who had added a block pattern. The extension is not part of gpodder (yet) so there is no reason the strings would exist in po files. If it gets added, the strings would become available and you could translate them at that time. |
"modification" : I just talking about a fresh 3.10.11 portable that i used specially for this thread and modifications you mentioned since the begining... about the 'blocked' 'allow' field : me, I have no pb with ... I was just wondering if it will be intuitive for users to have to uncheck another field to be able to write in the one they want ... for po files, sorry, my mistake...translation problem for "localized all strings"! |
Are you not able to write in both allow and block patterns when allow is checked? The block checkbox grays out when allow is checked to prevent the user from unchecking it, but the block pattern can still be used. |
"The block checkbox grays out when allow is checked to prevent the user from unchecking it, but the block pattern can still be used." that seems normal and justified "Are you not able to write in both allow and block patterns when allow is checked?" |
I think clicking block before clicking allow better indicates something is being blocked and allow is unblocking it. |
What would you think about switching Block and Allow lines and renaming Allow to Except? |
Merged to master. |
gPodder 3.10.15 bundles the extension |
hi,
some channel have a big content and mix their topics...
...it would be nice to have an add-on (an option) for automatically filter before downloading
like "only donwload if there is [example] in the title"
What do you think about ?
ty
The text was updated successfully, but these errors were encountered: