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

Nzbgeek search plugin #2674

Merged
merged 1 commit into from Jan 21, 2023
Merged

Nzbgeek search plugin #2674

merged 1 commit into from Jan 21, 2023

Conversation

rlwmmw
Copy link

@rlwmmw rlwmmw commented May 15, 2020

Motivation for changes:

I use nzbgeek for searching and ran into problems using newznab and search_rss.

Detailed changes:

I copied newznab.py and renamed it nzbgeek.py with the following modifications.

  9c9
  < __author__ = 'deksan and rlwmmw'
  ---
  > __author__ = 'deksan'
  11c11
  < logger = logger.bind(name='nzbgeek')
  ---
  > logger = logger.bind(name='newznab')
  14c14
  < class Nzbgeek:
  ---
  > class Newznab:
  16c16
  <     Nzbgeek search plugin
  ---
  >     Newznab search plugin
  21c21,23
  <         nzbgeek:
  ---
  >         newznab:
  >           url: "http://website/api?apikey=xxxxxxxxxxxxxxxxxxxxxxxxxx&t=movie&extended=1"
  >           website: https://website
  48,50d49
  <         if 'website' not in config:
  <           config['website'] = 'https://api.nzbgeek.info'
  <
  53c52,54
  <                 config['url'] = f"{config['website']}/api?t={config['category']}&apikey={config['apikey']}&extended=1"
  ---
  >                 config['params'] = {'t': config['category'], 'apikey': config['apikey'], 'extended': 1}
  >                 config['url'] = f"{config['website']}/api"
  >
  68c69
  <             if not rss.entries:
  ---
  >             if rss.entries:
  121,122c122,123
  <         imdbid = arg_entry['imdb_id'].replace('tt', '')
  <         config['params']['imdbid'] = imdbid
  ---
  >         imdb_id = arg_entry['imdb_id'].replace('tt', '')
  >         config['params']['imdb_id'] = imdb_id
  133,134c134
  <     plugin.register(Nzbgeek, 'nzbgeek', api_ver=2, interfaces=['search'])
  <
  ---
  >     plugin.register(Newznab, 'newznab', api_ver=2, interfaces=['search'])

Addressed issues:

Fix1. newznab does not retain parameters on re-run. For example apikey, category, extended, and entry parameters are included in the initial request, but only entry parameters are included in re-run requests.
The easiest fix was to add them to the config['url'] variable which is not overwritten on subsequent reruns (line 53).

Fix 2. nzbgeek uses 'imdbid' rather than 'imdb_id' (lines 121 & 122)

Fix 3. I corrected a simple boolean error that affected logging on line 69. Should have been 'if not'

Fix 4. hardcoded nzbgeek domain. Only category and api are required.

Config usage if relevant (new plugin or updated schema):

  Nzbgeek search plugin
  Provide a url or your website + apikey and a category

  Config example::

      nzbgeek:
        apikey: xxxxxxxxxxxxxxxxxxxxxxxxxx
        category: movie

  Category is any of: movie, tvsearch, music, book, all

Modified version of newznab plugin with minor corrections for compatibility with the nzbgeek api
@ianstalk
Copy link
Contributor

Instead of a copy-paste, can you refactor so these plugins can share common code?

@github-actions
Copy link

github-actions bot commented May 3, 2021

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label May 3, 2021
@rlwmmw
Copy link
Author

rlwmmw commented May 3, 2021

Just saw the refactor request. I will take a look at doing so.

@github-actions github-actions bot removed the Stale label May 4, 2021
@github-actions
Copy link

github-actions bot commented Oct 2, 2021

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Oct 2, 2021
@paranoidi paranoidi removed the Stale label Oct 2, 2021
@github-actions
Copy link

github-actions bot commented Mar 1, 2022

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Mar 1, 2022
@rlwmmw
Copy link
Author

rlwmmw commented Mar 3, 2022

I am not sure I can refactor this without breaking previous functionality.

I suppose it could be done by adding optional settings that would only use the modified code when nzbgeek is selected.

I will try to make time to review it sometime this week. Frankly, I don't use this anymore, so I will have to setup a new environment for testing.

@github-actions github-actions bot removed the Stale label Mar 4, 2022
@github-actions
Copy link

github-actions bot commented Aug 1, 2022

This PR is stale because it has been open 150 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the Stale label Aug 1, 2022
@github-actions
Copy link

This PR has been stale for 60 days and is being closed. Apologies if this is still relevant, it can be hard to find the time to review and merge everything. Feel free to make sure it is up to date and open it again.

@github-actions github-actions bot closed this Sep 30, 2022
@paranoidi paranoidi reopened this Sep 30, 2022
@github-actions github-actions bot removed the Stale label Oct 12, 2022
@paranoidi paranoidi merged commit c30631d into Flexget:next Jan 21, 2023
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

3 participants