Userscript providers
This commit is contained in:
1 parent
e2a373f15a
commit
76f471ad34
3 files changed
+44
-52
No files matched your search
@@ -1,29 +1,24 @@
|
||||
from couchpotato.core.event import fireEvent
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
import re
|
||||
|
||||
|
||||
class AppleTrailers(UserscriptBase):
|
||||
|
||||
includes = ['http://trailers.apple.com/trailers/*']
|
||||
|
||||
#CouchPotato['trailers.apple.com'] = (function(){
|
||||
#
|
||||
# function getId() {
|
||||
# var name = document.title.substr(0, document.title.indexOf(" -")).replace(/ /g, "+");
|
||||
# return lib.search(name, getYear())
|
||||
#
|
||||
# }
|
||||
#
|
||||
# function getYear(){
|
||||
# var release_date = document.getElementById("view-showtimes").parentNode.innerHTML;
|
||||
# var year = new RegExp("\\d{4}", release_date)
|
||||
#
|
||||
# return year;
|
||||
# }
|
||||
#
|
||||
# function constructor(){
|
||||
# getId();
|
||||
# }
|
||||
#
|
||||
# return constructor;
|
||||
#
|
||||
#})();
|
||||
def getMovie(self, url):
|
||||
|
||||
data = self.urlopen(url)
|
||||
|
||||
name = re.search('(?P<id>(var trailerTitle(.+);))', data)
|
||||
name = name.group('id').split(' = \'')[1].strip()[:-2].decode('string_escape')
|
||||
|
||||
date = re.search('(?P<id>(var releaseDate(.+);))', data)
|
||||
year = date.group('id').split(' = \'')[1].strip()[:-2]
|
||||
|
||||
result = self.search(name, year)
|
||||
if result:
|
||||
movie = fireEvent('movie.info', identifier = result.get('imdb'), merge = True)
|
||||
|
||||
return movie
|
||||
Reference in new issue
Block a user