New PTP-config for more accurate hits
Conflicts: couchpotato/core/providers/torrent/passthepopcorn/main.py
This commit is contained in:
@@ -38,6 +38,38 @@ config = [{
|
|||||||
'name': 'passkey',
|
'name': 'passkey',
|
||||||
'default': '',
|
'default': '',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'prefer_golden',
|
||||||
|
'advanced': True,
|
||||||
|
'type': 'bool',
|
||||||
|
'label': 'Prefer golden',
|
||||||
|
'default': 1,
|
||||||
|
'description': 'Favors Golden Popcorn-releases over all other releases.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'prefer_scene',
|
||||||
|
'advanced': True,
|
||||||
|
'type': 'bool',
|
||||||
|
'label': 'Prefer scene',
|
||||||
|
'default': 0,
|
||||||
|
'description': 'Favors scene-releases over non-scene releases.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'require_approval',
|
||||||
|
'advanced': True,
|
||||||
|
'type': 'bool',
|
||||||
|
'label': 'Require approval',
|
||||||
|
'default': 0,
|
||||||
|
'description': 'Require staff-approval for releases to be accepted.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'require_bluray',
|
||||||
|
'advanced': True,
|
||||||
|
'type': 'bool',
|
||||||
|
'label': 'Require Blu-ray',
|
||||||
|
'default': 0,
|
||||||
|
'description': 'Require source to be Blu-ray for releases to be accepted.'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name': 'extra_score',
|
'name': 'extra_score',
|
||||||
'advanced': True,
|
'advanced': True,
|
||||||
|
|||||||
@@ -103,11 +103,18 @@ class PassThePopcorn(TorrentProvider):
|
|||||||
for torrent in ptpmovie['Torrents']:
|
for torrent in ptpmovie['Torrents']:
|
||||||
torrent_id = tryInt(torrent['Id'])
|
torrent_id = tryInt(torrent['Id'])
|
||||||
torrentdesc = '%s %s %s' % (torrent['Resolution'], torrent['Source'], torrent['Codec'])
|
torrentdesc = '%s %s %s' % (torrent['Resolution'], torrent['Source'], torrent['Codec'])
|
||||||
|
torrentscore = 0
|
||||||
|
|
||||||
if 'GoldenPopcorn' in torrent and torrent['GoldenPopcorn']:
|
if 'GoldenPopcorn' in torrent and torrent['GoldenPopcorn']:
|
||||||
torrentdesc += ' HQ'
|
torrentdesc += ' HQ'
|
||||||
|
if self.conf('prefer_golden'):
|
||||||
|
torrentscore += 100
|
||||||
|
log.debug('Config: Prefer Golden Popcorn is active, awarding torrent 100 points')
|
||||||
if 'Scene' in torrent and torrent['Scene']:
|
if 'Scene' in torrent and torrent['Scene']:
|
||||||
torrentdesc += ' Scene'
|
torrentdesc += ' Scene'
|
||||||
|
if self.conf('prefer_scene'):
|
||||||
|
torrentscore += 50
|
||||||
|
log.debug('Config: Prefer Scene release is active, awarding torrent 50 points')
|
||||||
if 'RemasterTitle' in torrent and torrent['RemasterTitle']:
|
if 'RemasterTitle' in torrent and torrent['RemasterTitle']:
|
||||||
torrentdesc += self.htmlToASCII(' %s' % torrent['RemasterTitle'])
|
torrentdesc += self.htmlToASCII(' %s' % torrent['RemasterTitle'])
|
||||||
|
|
||||||
@@ -115,18 +122,21 @@ class PassThePopcorn(TorrentProvider):
|
|||||||
torrent_name = re.sub('[^A-Za-z0-9\-_ \(\).]+', '', '%s (%s) - %s' % (movie_title, ptpmovie['Year'], torrentdesc))
|
torrent_name = re.sub('[^A-Za-z0-9\-_ \(\).]+', '', '%s (%s) - %s' % (movie_title, ptpmovie['Year'], torrentdesc))
|
||||||
|
|
||||||
def extra_check(item):
|
def extra_check(item):
|
||||||
return self.torrentMeetsQualitySpec(item, type)
|
return self.torrentMeetsQualitySpec(item, quality_id)
|
||||||
|
|
||||||
results.append({
|
results.append({
|
||||||
'id': torrent_id,
|
'id': torrent_id,
|
||||||
'name': torrent_name,
|
'name': torrent_name,
|
||||||
|
'Source': torrent['Source'],
|
||||||
|
'Checked': 'true' if torrent['Checked'] else 'false',
|
||||||
|
'Resolution': torrent['Resolution'],
|
||||||
'url': '%s?action=download&id=%d&authkey=%s&torrent_pass=%s' % (self.urls['torrent'], torrent_id, authkey, passkey),
|
'url': '%s?action=download&id=%d&authkey=%s&torrent_pass=%s' % (self.urls['torrent'], torrent_id, authkey, passkey),
|
||||||
'detail_url': self.urls['detail'] % torrent_id,
|
'detail_url': self.urls['detail'] % torrent_id,
|
||||||
'date': tryInt(time.mktime(parse(torrent['UploadTime']).timetuple())),
|
'date': tryInt(time.mktime(parse(torrent['UploadTime']).timetuple())),
|
||||||
'size': tryInt(torrent['Size']) / (1024 * 1024),
|
'size': tryInt(torrent['Size']) / (1024 * 1024),
|
||||||
'seeders': tryInt(torrent['Seeders']),
|
'seeders': tryInt(torrent['Seeders']),
|
||||||
'leechers': tryInt(torrent['Leechers']),
|
'leechers': tryInt(torrent['Leechers']),
|
||||||
'score': 50 if torrent['GoldenPopcorn'] else 0,
|
'score': torrentscore,
|
||||||
'extra_check': extra_check,
|
'extra_check': extra_check,
|
||||||
'download': self.loginDownload,
|
'download': self.loginDownload,
|
||||||
})
|
})
|
||||||
@@ -167,7 +177,17 @@ class PassThePopcorn(TorrentProvider):
|
|||||||
if not quality in self.post_search_filters:
|
if not quality in self.post_search_filters:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
for field, specs in self.post_search_filters[quality].items():
|
reqs = self.post_search_filters[quality].copy()
|
||||||
|
|
||||||
|
if self.conf('require_bluray'):
|
||||||
|
reqs['Source'] = ['Blu-ray']
|
||||||
|
log.debug('Config: Require Blu-ray source is activated')
|
||||||
|
|
||||||
|
if self.conf('require_approval'):
|
||||||
|
reqs['Checked'] = ['true']
|
||||||
|
log.debug('Config: Require staff-approval activated')
|
||||||
|
|
||||||
|
for field, specs in reqs.items():
|
||||||
matches_one = False
|
matches_one = False
|
||||||
seen_one = False
|
seen_one = False
|
||||||
|
|
||||||
@@ -182,11 +202,14 @@ class PassThePopcorn(TorrentProvider):
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
# a positive rule; if any of the possible positive values match the field, return True
|
# a positive rule; if any of the possible positive values match the field, return True
|
||||||
|
log.debug('Checking if torrents field %s equals %s' % (field, spec))
|
||||||
seen_one = True
|
seen_one = True
|
||||||
if torrent[field] == spec:
|
if torrent[field] == spec:
|
||||||
|
log.debug('Torrent satisfied %s == %s' % (field, spec))
|
||||||
matches_one = True
|
matches_one = True
|
||||||
|
|
||||||
if seen_one and not matches_one:
|
if seen_one and not matches_one:
|
||||||
|
log.debug('Torrent did not satisfy requirements, ignoring')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user