223 changed files with 23529 additions and 3074 deletions
@ -0,0 +1,30 @@ |
|||
from .main import Trakt |
|||
|
|||
def start(): |
|||
return Trakt() |
|||
|
|||
config = [{ |
|||
'name': 'trakt', |
|||
'groups': [ |
|||
{ |
|||
'tab': 'notifications', |
|||
'list': 'notification_providers', |
|||
'name': 'trakt', |
|||
'label': 'Trakt', |
|||
'description': 'add movies to your collection once downloaded. Fill in your username and password in the <a href="../automation/">Automation Trakt settings</a>', |
|||
'options': [ |
|||
{ |
|||
'name': 'notification_enabled', |
|||
'default': False, |
|||
'type': 'enabler', |
|||
}, |
|||
{ |
|||
'name': 'remove_watchlist_enabled', |
|||
'label': 'Remove from watchlist', |
|||
'default': False, |
|||
'type': 'bool', |
|||
}, |
|||
], |
|||
} |
|||
], |
|||
}] |
@ -0,0 +1,46 @@ |
|||
from couchpotato.core.logger import CPLog |
|||
from couchpotato.core.notifications.base import Notification |
|||
|
|||
log = CPLog(__name__) |
|||
|
|||
class Trakt(Notification): |
|||
|
|||
urls = { |
|||
'base': 'http://api.trakt.tv/%s', |
|||
'library': 'movie/library/%s', |
|||
'unwatchlist': 'movie/unwatchlist/%s', |
|||
} |
|||
|
|||
listen_to = ['movie.downloaded'] |
|||
|
|||
def notify(self, message = '', data = {}, listener = None): |
|||
|
|||
post_data = { |
|||
'username': self.conf('automation_username'), |
|||
'password' : self.conf('automation_password'), |
|||
'movies': [{ |
|||
'imdb_id': data['library']['identifier'], |
|||
'title': data['library']['titles'][0]['title'], |
|||
'year': data['library']['year'] |
|||
}] if data else [] |
|||
} |
|||
|
|||
result = self.call((self.urls['library'] % self.conf('automation_api_key')), post_data) |
|||
if self.conf('remove_watchlist_enabled'): |
|||
result = result and self.call((self.urls['unwatchlist'] % self.conf('automation_api_key')), post_data) |
|||
|
|||
return result |
|||
|
|||
def call(self, method_url, post_data): |
|||
|
|||
try: |
|||
response = self.getJsonData(self.urls['base'] % method_url, params = post_data, cache_timeout = 1) |
|||
if response: |
|||
if response.get('status') == "success": |
|||
log.info('Successfully called Trakt') |
|||
return True |
|||
except: |
|||
pass |
|||
|
|||
log.error('Failed to call trakt, check your login.') |
|||
return False |
@ -0,0 +1,34 @@ |
|||
from .main import Letterboxd |
|||
|
|||
def start(): |
|||
return Letterboxd() |
|||
|
|||
config = [{ |
|||
'name': 'letterboxd', |
|||
'groups': [ |
|||
{ |
|||
'tab': 'automation', |
|||
'list': 'watchlist_providers', |
|||
'name': 'letterboxd_automation', |
|||
'label': 'Letterboxd', |
|||
'description': 'Import movies from any public <a href="http://letterboxd.com/">Letterboxd</a> watchlist', |
|||
'options': [ |
|||
{ |
|||
'name': 'automation_enabled', |
|||
'default': False, |
|||
'type': 'enabler', |
|||
}, |
|||
{ |
|||
'name': 'automation_urls_use', |
|||
'label': 'Use', |
|||
}, |
|||
{ |
|||
'name': 'automation_urls', |
|||
'label': 'Username', |
|||
'type': 'combined', |
|||
'combine': ['automation_urls_use', 'automation_urls'], |
|||
}, |
|||
], |
|||
}, |
|||
], |
|||
}] |
@ -0,0 +1,49 @@ |
|||
from bs4 import BeautifulSoup |
|||
from couchpotato.core.helpers.variable import tryInt, splitString |
|||
from couchpotato.core.logger import CPLog |
|||
from couchpotato.core.providers.automation.base import Automation |
|||
import re |
|||
|
|||
log = CPLog(__name__) |
|||
|
|||
|
|||
class Letterboxd(Automation): |
|||
|
|||
url = 'http://letterboxd.com/%s/watchlist/' |
|||
pattern = re.compile(r'(.*)\((\d*)\)') |
|||
|
|||
def getIMDBids(self): |
|||
|
|||
urls = splitString(self.conf('automation_urls')) |
|||
|
|||
if len(urls) == 0: |
|||
return [] |
|||
|
|||
movies = [] |
|||
|
|||
for movie in self.getWatchlist(): |
|||
imdb_id = self.search(movie.get('title'), movie.get('year'), imdb_only = True) |
|||
movies.append(imdb_id) |
|||
|
|||
return movies |
|||
|
|||
def getWatchlist(self): |
|||
|
|||
enablers = [tryInt(x) for x in splitString(self.conf('automation_urls_use'))] |
|||
urls = splitString(self.conf('automation_urls')) |
|||
|
|||
index = -1 |
|||
movies = [] |
|||
for username in urls: |
|||
|
|||
index += 1 |
|||
if not enablers[index]: |
|||
continue |
|||
|
|||
soup = BeautifulSoup(self.getHTMLData(self.url % username)) |
|||
|
|||
for movie in soup.find_all('a', attrs = { 'class': 'frame' }): |
|||
match = filter(None, self.pattern.split(movie['title'])) |
|||
movies.append({'title': match[0], 'year': match[1] }) |
|||
|
|||
return movies |
@ -0,0 +1,6 @@ |
|||
from .main import Criticker |
|||
|
|||
def start(): |
|||
return Criticker() |
|||
|
|||
config = [] |
@ -0,0 +1,6 @@ |
|||
from couchpotato.core.providers.userscript.base import UserscriptBase |
|||
|
|||
|
|||
class Criticker(UserscriptBase): |
|||
|
|||
includes = ['http://www.criticker.com/film/*'] |
Binary file not shown.
After Width: | Height: | Size: 213 KiB |
Binary file not shown.
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue