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

Feature domain tags #31

Merged
merged 11 commits into from
Mar 22, 2021
Merged

Feature domain tags #31

merged 11 commits into from
Mar 22, 2021

Conversation

alvaroreig
Copy link
Collaborator

Hi there @mmagnus,

I've recently changed my workflow and I don't use tags anymore. Therefore, all the articles appear under "untagged", which I didn't like.

Therefore, I've developed a new feature that organizes the articles under sections based on the first level domain of the URL of each article. Check this screenshot:

alt text

However, there are two drawbacks:

First of all, this feature is incompatible with the pocket tags normal functionality (TAGS, TAGS_EXCEPTIONS, INCLUDE_UNTAGGED, etc.). This is because the recipe ignores duplicates, and therefore an article can't belong in a section inherited from a pocket tag and also belong in a section created from its domain. Therefore, if SECTIONS_BY_DOMAIN=True pocket tags will be ignored. Because of that, I have left it disabled by default, so it won't break current use cases.

And second, because I use the tld module for extracting the domain, now the recipe has a new dependency (pip install tld). Therefore, even if someone is not going to use it python would check the import line and raise an exception. To avoid that, I have commented the related import. This can be resolved in a way better elegant way (lazy load, use a regular expressión, etc.) but I don't have the time right now.

Therefore, if someone wants to use this functionality you have to:

  • uncomment "from tld import get_fld" in line 64
  • install the tld module (pip install tld or whatever)
  • set the SECTIONS_BY_DOMAIN to True in line 46

https://github.com/mmagnus/Pocket-Plus-Calibre-Plugin/tree/feature_domain_tags

@mmagnus
Copy link
Owner

mmagnus commented Mar 22, 2021

Hi @alvaroreig,

Yeah, this is pretty cool. I had a similar problem to this, I was super lazy on tagging, so in PocketX (some more experimental version of the plugin) I coded a way to automatically Tag given urls ;-)

URLS_TO_TAGS = {'investing':
                ['fool.com',
                 'finance',
                 'marketwatch.com',
                 'benzinga'],
                 'rna':
                ['rnajournal']

so tag RNA will be added to URLs with "rnajournal" in it.

I like your approach. I think this should be an option.

Worked for me as well*

screenshot_2021_03_22T20_28_39+0100

  • I have one problem that Calibre's python does not see my libs, and I have to always help it to find it.
if SECTIONS_BY_DOMAIN:
    # maybe this is only me? @mmagnus but I need explicit append like this
    # sys.path.append("/Users/magnus/miniconda2/envs/py37/lib/python3.7/site-packages") 
    from tld import get_fld

@mmagnus mmagnus merged commit 747f8c0 into master Mar 22, 2021
@alvaroreig alvaroreig deleted the feature_domain_tags branch March 27, 2021 21:13
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

Successfully merging this pull request may close these issues.

None yet

2 participants