Skip to content

NewPCT added search feature#1680

Merged
liiight merged 4 commits intoFlexget:developfrom
malkavi:patch-6
Feb 20, 2017
Merged

NewPCT added search feature#1680
liiight merged 4 commits intoFlexget:developfrom
malkavi:patch-6

Conversation

@malkavi
Copy link
Copy Markdown
Contributor

@malkavi malkavi commented Feb 10, 2017

Motivation for changes:

Addead search options based on divxatope

Detailed changes:

  • Search NewPCT

Addressed issues:

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

discover:
      what:
        - movie_list: wanted_movies
      from:
        - newpct: yes

Log and/or tests output (preferably both):

2017-02-08 13:38 INFO     urlrewriter   bajar_pelis     Entry 'Passengers  DVDRIP-AC3 5.1' URL rewritten to http://www.newpct1.com/download/27486_passengers---.torrent (with newpct)
2017-02-08 13:38 INFO     download      bajar_pelis     Downloading: Passengers  DVDRIP-AC3 5.1
2017-02-08 13:38 INFO     transmission  bajar_pelis     "Passengers  DVDRIP-AC3 5.1" torrent added to transmission

response = task.requests.post(url_search, data=data)
except requests.RequestException as e:
log.error('Error searching NewPCT: %s' % e)
return
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to return the empty set or discover will probably crash

entry['url'] = child['href']
entry_title = child.find('h2')
if entry_title is None:
continue
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd recommend some debug logging

requests = Session()
requests.headers.update({'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'})
requests.add_domain_limiter(TimedLimiter('imdb.com', '2 seconds'))
requests.add_domain_limiter(TimedLimiter('www.newpct1.com', '2 seconds'))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use just the domain here, no subdomains

for search_string in entry.get('search_strings', [entry['title']]):
query = normalize_unicode(search_string)
query = re.sub(' \(\d\d\d\d\)$', '', query)
log.debug('Searching NewPCT %s' % query)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let the logger do the string interpolation:
log.debug('Searching NewPCT %s', query)

try:
response = task.requests.post(url_search, data=data)
except requests.RequestException as e:
log.error('Error searching NewPCT: %s' % e)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger interpolation

entry_title = re.sub(' \[.+]$', '', entry_title)
entry['title'] = entry_title + ' ' + entry_quality_lan
results.add(entry)
log.debug('Finish search NewPCT with %d entries' % len(results))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger interpolation

@@ -64,7 +74,49 @@ def parse_download_page(self, url):
torrent_id = torrent_id_prog.search(torrent_ids[0]).group(1)
return 'http://www.newpct.com/torrents/{:0>6}.torrent'.format(torrent_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving this to be a static const

@liiight liiight merged commit 4d8ec26 into Flexget:develop Feb 20, 2017
@liiight
Copy link
Copy Markdown
Member

liiight commented Feb 20, 2017

thanks, wanna add this to the wiki?

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.

2 participants