Compare commits
No commits in common. "2026b64faf121047e763f22276d1665d31007024" and "47347843d01ef21f94eb8cffe0d18e97fb5f3b29" have entirely different histories.
2026b64faf
...
47347843d0
4 changed files with 4 additions and 46 deletions
|
|
@ -227,8 +227,6 @@ def signin(url):
|
||||||
url = 'https://%s/api/' % url
|
url = 'https://%s/api/' % url
|
||||||
else:
|
else:
|
||||||
site = url.split('/')[2]
|
site = url.split('/')[2]
|
||||||
if not url.endswith('/'):
|
|
||||||
url += '/'
|
|
||||||
api = API(url)
|
api = API(url)
|
||||||
update = False
|
update = False
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
42
ox/cache.py
42
ox/cache.py
|
|
@ -456,47 +456,7 @@ class RedisCache(KVCache):
|
||||||
self.backend = redis.from_url(self.url)
|
self.backend = redis.from_url(self.url)
|
||||||
|
|
||||||
|
|
||||||
class FallbackCache(KVCache):
|
if cache_path().startswith('fs:'):
|
||||||
caches = []
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
fallback = cache_path()
|
|
||||||
for path in fallback.split('|'):
|
|
||||||
os.environ['oxCACHE'] = path
|
|
||||||
if path.startswith('redis:'):
|
|
||||||
store = RedisCache()
|
|
||||||
elif path.startswith('memcache:'):
|
|
||||||
store = MemCache()
|
|
||||||
self.caches.append(store)
|
|
||||||
os.environ['oxCACHE'] = fallback
|
|
||||||
|
|
||||||
def get(self, url, data, headers=None, timeout=-1, value="data"):
|
|
||||||
if timeout == 0:
|
|
||||||
return None
|
|
||||||
|
|
||||||
info_key, data_key = self._keys(url, data, headers)
|
|
||||||
for cache in self.caches:
|
|
||||||
try:
|
|
||||||
info = cache.backend.get(info_key)
|
|
||||||
except:
|
|
||||||
info = None
|
|
||||||
if info:
|
|
||||||
return cache.get(url, data, headers, timeout, value)
|
|
||||||
return None
|
|
||||||
|
|
||||||
def set(self, url, post_data, data, headers):
|
|
||||||
self.caches[0].set(url, post_data, data, headers)
|
|
||||||
for cache in self.caches[1:]:
|
|
||||||
cache.delete(url, post_data, headers)
|
|
||||||
|
|
||||||
def delete(self, url, data=None, headers=None):
|
|
||||||
for cache in self.caches:
|
|
||||||
cache.delete(url, data, headers)
|
|
||||||
|
|
||||||
|
|
||||||
if '|' in cache_path():
|
|
||||||
store = FallbackCache()
|
|
||||||
elif cache_path().startswith('fs:'):
|
|
||||||
store = FileCache()
|
store = FileCache()
|
||||||
elif cache_path().startswith('redis:'):
|
elif cache_path().startswith('redis:'):
|
||||||
store = RedisCache()
|
store = RedisCache()
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ class Imdb(SiteParser):
|
||||||
], type='int'),
|
], type='int'),
|
||||||
'keyword': {
|
'keyword': {
|
||||||
'page': 'keywords',
|
'page': 'keywords',
|
||||||
're': 'data-item-keyword="(.*?)"',
|
're': '<a href="/keyword/.*?>(.*?)</a>',
|
||||||
'type': 'list'
|
'type': 'list'
|
||||||
},
|
},
|
||||||
'language': zebra_list('Language', more=['<a.*?>(.*?)</a>']),
|
'language': zebra_list('Language', more=['<a.*?>(.*?)</a>']),
|
||||||
|
|
@ -224,7 +224,7 @@ class Imdb(SiteParser):
|
||||||
'releasedate': {
|
'releasedate': {
|
||||||
'page': 'releaseinfo',
|
'page': 'releaseinfo',
|
||||||
're': [
|
're': [
|
||||||
'<td class="release-date-item__date".*?>(.*?)</td>',
|
'<td class="release_date">(.*?)</td>',
|
||||||
strip_tags,
|
strip_tags,
|
||||||
],
|
],
|
||||||
'type': 'list'
|
'type': 'list'
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from ox.net import read_url
|
||||||
|
|
||||||
def get_poster_url(id):
|
def get_poster_url(id):
|
||||||
url = 'http://piratecinema.org/posters/'
|
url = 'http://piratecinema.org/posters/'
|
||||||
html = read_url(url).decode('utf-8')
|
html = read_url(url, unicode=True)
|
||||||
results = re.compile('src="(.+)" title=".+\((\d{7})\)"').findall(html)
|
results = re.compile('src="(.+)" title=".+\((\d{7})\)"').findall(html)
|
||||||
for result in results:
|
for result in results:
|
||||||
if result[1] == id:
|
if result[1] == id:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue