Cache userscript url download
This commit is contained in:
@@ -11,7 +11,7 @@ class AlloCine(UserscriptBase):
|
||||
return 'Url isn\'t from a movie'
|
||||
|
||||
try:
|
||||
data = self.urlopen(url)
|
||||
data = self.getUrl(url)
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class AppleTrailers(UserscriptBase):
|
||||
def getMovie(self, url):
|
||||
|
||||
try:
|
||||
data = self.urlopen(url)
|
||||
data = self.getUrl(url)
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from couchpotato.core.event import addEvent, fireEvent
|
||||
from couchpotato.core.helpers.variable import getImdb
|
||||
from couchpotato.core.helpers.encoding import simplifyString
|
||||
from couchpotato.core.helpers.variable import getImdb, md5
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
from urlparse import urlparse
|
||||
@@ -42,9 +43,12 @@ class UserscriptBase(Plugin):
|
||||
|
||||
return
|
||||
|
||||
def getUrl(self, url):
|
||||
return self.getCache(md5(simplifyString(url)), url = url)
|
||||
|
||||
def getMovie(self, url):
|
||||
try:
|
||||
data = self.urlopen(url)
|
||||
data = self.getUrl(url)
|
||||
except:
|
||||
data = ''
|
||||
return self.getInfo(getImdb(data))
|
||||
|
||||
@@ -9,7 +9,7 @@ class RottenTomatoes(UserscriptBase):
|
||||
def getMovie(self, url):
|
||||
|
||||
try:
|
||||
data = self.urlopen(url)
|
||||
data = self.getUrl(url)
|
||||
except:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user