Added moviemeter.nl automation
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from .main import Moviemeter
|
||||
|
||||
def start():
|
||||
return Moviemeter()
|
||||
|
||||
config = [{
|
||||
'name': 'moviemeter',
|
||||
'groups': [
|
||||
{
|
||||
'tab': 'automation',
|
||||
'name': 'moviemeter_automation',
|
||||
'label': 'Moviemeter',
|
||||
'description': 'Imports movies from the current top 10 of moviemeter.nl. (uses minimal requirements)',
|
||||
'options': [
|
||||
{
|
||||
'name': 'automation_enabled',
|
||||
'default': False,
|
||||
'type': 'enabler',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}]
|
||||
39
couchpotato/core/providers/automation/moviemeter_nl/main.py
Normal file
39
couchpotato/core/providers/automation/moviemeter_nl/main.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from couchpotato.core.helpers.rss import RSS
|
||||
from couchpotato.core.helpers.variable import md5
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.providers.automation.base import Automation
|
||||
import datetime
|
||||
import xml.etree.ElementTree as XMLTree
|
||||
|
||||
log = CPLog(__name__)
|
||||
|
||||
|
||||
class Moviemeter(Automation, RSS):
|
||||
|
||||
interval = 1800
|
||||
rss_url = 'http://www.moviemeter.nl/rss/cinema'
|
||||
|
||||
def getIMDBids(self):
|
||||
|
||||
if self.isDisabled():
|
||||
return
|
||||
|
||||
movies = []
|
||||
|
||||
cache_key = 'moviemeter.%s' % md5(self.rss_url)
|
||||
rss_data = self.getCache(cache_key, self.rss_url)
|
||||
data = XMLTree.fromstring(rss_data)
|
||||
|
||||
if data is not None:
|
||||
rss_movies = self.getElements(data, 'channel/item')
|
||||
|
||||
for movie in rss_movies:
|
||||
name = self.getTextElement(movie, "title")
|
||||
year = datetime.datetime.now().strftime("%Y")
|
||||
|
||||
imdb = self.search(name, year)
|
||||
|
||||
if imdb and self.isMinimalMovie(imdb):
|
||||
movies.append(imdb['imdb'])
|
||||
|
||||
return movies
|
||||
Reference in New Issue
Block a user