Userscript add via url

This commit is contained in:
Ruud
2011-09-27 08:42:00 +02:00
parent d79a25bb5b
commit 9c7c5159e6
2 changed files with 31 additions and 20 deletions
@@ -1,4 +1,5 @@
from beautifulsoup import BeautifulSoup
from couchpotato.core.event import fireEvent
from couchpotato.core.providers.userscript.base import UserscriptBase
import re
@@ -19,27 +20,14 @@ class IMDB(UserscriptBase):
if 'seasons' in head.lower():
return False
identifier = re.search('(?P<id>tt[0-9{7}]+)', url).group('id')
movie = fireEvent('movie.info', identifier = identifier)
return {
'id': re.search('(?P<id>tt[0-9{7}]+)', url).group('id'),
'year': self.getYear(html)
}
def getYear(self, html):
headers = html.findAll('h1')
tv_pattern = '/^\((TV|Video) ([0-9]+)\)$/';
try:
year = headers[0].findAll('a').text
return year
except:
pass
for head in headers:
match = re.search(tv_pattern, head)
if match:
return match[1]
#CouchPotato['imdb.com'] = (function(){
#