You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

281 lines
11 KiB

14 years ago
import base64
import json
import socket
import traceback
import urllib
11 years ago
from couchpotato.core.helpers.variable import splitString, getTitle
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
from requests.exceptions import ConnectionError, Timeout
from requests.packages.urllib3.exceptions import MaxRetryError
14 years ago
11 years ago
14 years ago
log = CPLog(__name__)
autoload = 'XBMC'
14 years ago
class XBMC(Notification):
listen_to = ['renamer.after', 'movie.snatched']
use_json_notifications = {}
http_time_between_calls = 0
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
14 years ago
hosts = splitString(self.conf('host'))
successful = 0
max_successful = 0
for host in hosts:
if self.use_json_notifications.get(host) is None:
self.getXBMCJSONversion(host, message = message)
if self.use_json_notifications.get(host):
calls = [
Added option to run the Artwork Downloader addon during XBMC notify. This option will only work in XBMCv12 (Frodo) or later. It also requires the Artwork Downloader Addon. Since XBMC's API doesn't support notifications over HTML, there is no way for couchpotato to know when the Library Scan is complete. Since running the Artwork Downloader before the movie has been scanned won't solve anything, a delay timer can be adjusted to suit the user's needs. Squashed commit of the following: commit bd60ed585f77cc40c31fd67d4ae732e0845d31ab Merge: fcb092e b113a4d Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:26:24 2014 -0500 Merge branch 'fanarttv' into artdlnotify commit b113a4def197a9ca8545bde9f5081c0591b93b36 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:24:12 2014 -0500 Bug-fix and code cleanup. Fixed a bug where the movie.info event would crash if there aren't any pictures to scrape in fanart.tv. commit fcb092e776e00ceabea016b3c26d9394e32d72b0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:21:27 2014 -0500 Option to run the artwork downloader addon during XBMC notify. commit adf7a4675d472e9e95a316c6cccc681a52804f13 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 16:15:03 2014 -0500 Added support for extrafanart. Also, the main fanart will be taken from fanart.tv unless one does not exist. commit 1791e46c8602f40bb56fe0cf7ecb0607f35b4b12 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 15:13:14 2014 -0500 Couchpotato now downloads extrathumbs from the extra tmdb backdrops if they exist. This commit made some major changes to the core image creation functionality that makes writing multiple images to folders possible. commit c0858807873749dbc928c0260037138f51f894ca Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 12:18:53 2014 -0500 Bug Fix & Implemented functionality to select bluray or dvd disc images. Currently, only blurays will be selected, unless there are no blurays. However, if a mechanism for determining the quality of the release is implemented, it would be simple to make this selection based on the quality. commit 786751371d243f53d0f5c6f2c38d92288d8608ba Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:59:25 2014 -0500 Fixed a bug where non-HD clearart and logos couldn't be downloaded. commit feda8df483d13b5a5df3a869f25de8f2c7e6ffe3 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:12:31 2014 -0500 Fixed some problems that were missed with the previous merge. commit 5ddab6c40e69a5accc6c0336cd7485920ff82d8f Merge: 7273abf ff46aa0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:02:11 2014 -0500 Merge branch 'develop' into fanarttv Conflicts: couchpotato/core/media/movie/providers/info/themoviedb.py couchpotato/core/providers/metadata/xbmc/__init__.py commit 7273abf827735cf245711c3d3199a6a173a964aa Author: dan <dan@DBoehm-Arch.danboehm> Date: Thu Feb 27 13:29:57 2014 -0600 Downloads extra artwork from fanart.tv Downloads occur with correct filenaming when XBMC metadata is generated, but the image URLs are selected when the movie.info event is called. commit 9080d9d749c7e1ddbdc78f7b37a3c5f83195d580 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 16:31:37 2014 -0600 Added basic functionality for fanarttv provider. This should be mostly done and is based on the tvdb provider. commit 1b39b246c2a9d65f9ef86c4e150a12d893e362c0 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 14:50:17 2014 -0600 Updated fanarttv library with the correct package hierarchy (libs.fanarttv). commit 8abb7c8f8ad3347900debb9f6a6d5a7acb7df396 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 13:12:48 2014 -0600 Added fanart.tv API python library (lib.fanarttv). The upstream for this library is at https://github.com/z4r/python-fanart.
11 years ago
('GUI.ShowNotification', None, {'title': self.default_title, 'message': message, 'image': self.getNotificationImage('small')}),
]
if data and data.get('destination_dir') and (not self.conf('only_first') or hosts.index(host) == 0):
param = {}
if not self.conf('force_full_scan') and (self.conf('remote_dir_scan') or socket.getfqdn('localhost') == socket.getfqdn(host.split(':')[0])):
param = {'directory': data['destination_dir']}
Added option to run the Artwork Downloader addon during XBMC notify. This option will only work in XBMCv12 (Frodo) or later. It also requires the Artwork Downloader Addon. Since XBMC's API doesn't support notifications over HTML, there is no way for couchpotato to know when the Library Scan is complete. Since running the Artwork Downloader before the movie has been scanned won't solve anything, a delay timer can be adjusted to suit the user's needs. Squashed commit of the following: commit bd60ed585f77cc40c31fd67d4ae732e0845d31ab Merge: fcb092e b113a4d Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:26:24 2014 -0500 Merge branch 'fanarttv' into artdlnotify commit b113a4def197a9ca8545bde9f5081c0591b93b36 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:24:12 2014 -0500 Bug-fix and code cleanup. Fixed a bug where the movie.info event would crash if there aren't any pictures to scrape in fanart.tv. commit fcb092e776e00ceabea016b3c26d9394e32d72b0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:21:27 2014 -0500 Option to run the artwork downloader addon during XBMC notify. commit adf7a4675d472e9e95a316c6cccc681a52804f13 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 16:15:03 2014 -0500 Added support for extrafanart. Also, the main fanart will be taken from fanart.tv unless one does not exist. commit 1791e46c8602f40bb56fe0cf7ecb0607f35b4b12 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 15:13:14 2014 -0500 Couchpotato now downloads extrathumbs from the extra tmdb backdrops if they exist. This commit made some major changes to the core image creation functionality that makes writing multiple images to folders possible. commit c0858807873749dbc928c0260037138f51f894ca Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 12:18:53 2014 -0500 Bug Fix & Implemented functionality to select bluray or dvd disc images. Currently, only blurays will be selected, unless there are no blurays. However, if a mechanism for determining the quality of the release is implemented, it would be simple to make this selection based on the quality. commit 786751371d243f53d0f5c6f2c38d92288d8608ba Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:59:25 2014 -0500 Fixed a bug where non-HD clearart and logos couldn't be downloaded. commit feda8df483d13b5a5df3a869f25de8f2c7e6ffe3 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:12:31 2014 -0500 Fixed some problems that were missed with the previous merge. commit 5ddab6c40e69a5accc6c0336cd7485920ff82d8f Merge: 7273abf ff46aa0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:02:11 2014 -0500 Merge branch 'develop' into fanarttv Conflicts: couchpotato/core/media/movie/providers/info/themoviedb.py couchpotato/core/providers/metadata/xbmc/__init__.py commit 7273abf827735cf245711c3d3199a6a173a964aa Author: dan <dan@DBoehm-Arch.danboehm> Date: Thu Feb 27 13:29:57 2014 -0600 Downloads extra artwork from fanart.tv Downloads occur with correct filenaming when XBMC metadata is generated, but the image URLs are selected when the movie.info event is called. commit 9080d9d749c7e1ddbdc78f7b37a3c5f83195d580 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 16:31:37 2014 -0600 Added basic functionality for fanarttv provider. This should be mostly done and is based on the tvdb provider. commit 1b39b246c2a9d65f9ef86c4e150a12d893e362c0 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 14:50:17 2014 -0600 Updated fanarttv library with the correct package hierarchy (libs.fanarttv). commit 8abb7c8f8ad3347900debb9f6a6d5a7acb7df396 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 13:12:48 2014 -0600 Added fanart.tv API python library (lib.fanarttv). The upstream for this library is at https://github.com/z4r/python-fanart.
11 years ago
calls.append(('VideoLibrary.Scan', None, param))
max_successful += len(calls)
response = self.request(host, calls)
else:
11 years ago
response = self.notifyXBMCnoJSON(host, {'title': self.default_title, 'message': message})
if data and data.get('destination_dir') and (not self.conf('only_first') or hosts.index(host) == 0):
11 years ago
response += self.request(host, [('VideoLibrary.Scan', None, {})])
max_successful += 1
max_successful += 1
try:
for result in response:
12 years ago
if result.get('result') and result['result'] == 'OK':
successful += 1
12 years ago
elif result.get('error'):
log.error('XBMC error; %s: %s (%s)', (result['id'], result['error']['message'], result['error']['code']))
except:
log.error('Failed parsing results: %s', traceback.format_exc())
return successful == max_successful
14 years ago
def getXBMCJSONversion(self, host, message = ''):
success = False
# XBMC JSON-RPC version request
response = self.request(host, [
Added option to run the Artwork Downloader addon during XBMC notify. This option will only work in XBMCv12 (Frodo) or later. It also requires the Artwork Downloader Addon. Since XBMC's API doesn't support notifications over HTML, there is no way for couchpotato to know when the Library Scan is complete. Since running the Artwork Downloader before the movie has been scanned won't solve anything, a delay timer can be adjusted to suit the user's needs. Squashed commit of the following: commit bd60ed585f77cc40c31fd67d4ae732e0845d31ab Merge: fcb092e b113a4d Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:26:24 2014 -0500 Merge branch 'fanarttv' into artdlnotify commit b113a4def197a9ca8545bde9f5081c0591b93b36 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:24:12 2014 -0500 Bug-fix and code cleanup. Fixed a bug where the movie.info event would crash if there aren't any pictures to scrape in fanart.tv. commit fcb092e776e00ceabea016b3c26d9394e32d72b0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:21:27 2014 -0500 Option to run the artwork downloader addon during XBMC notify. commit adf7a4675d472e9e95a316c6cccc681a52804f13 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 16:15:03 2014 -0500 Added support for extrafanart. Also, the main fanart will be taken from fanart.tv unless one does not exist. commit 1791e46c8602f40bb56fe0cf7ecb0607f35b4b12 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 15:13:14 2014 -0500 Couchpotato now downloads extrathumbs from the extra tmdb backdrops if they exist. This commit made some major changes to the core image creation functionality that makes writing multiple images to folders possible. commit c0858807873749dbc928c0260037138f51f894ca Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 12:18:53 2014 -0500 Bug Fix & Implemented functionality to select bluray or dvd disc images. Currently, only blurays will be selected, unless there are no blurays. However, if a mechanism for determining the quality of the release is implemented, it would be simple to make this selection based on the quality. commit 786751371d243f53d0f5c6f2c38d92288d8608ba Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:59:25 2014 -0500 Fixed a bug where non-HD clearart and logos couldn't be downloaded. commit feda8df483d13b5a5df3a869f25de8f2c7e6ffe3 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:12:31 2014 -0500 Fixed some problems that were missed with the previous merge. commit 5ddab6c40e69a5accc6c0336cd7485920ff82d8f Merge: 7273abf ff46aa0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:02:11 2014 -0500 Merge branch 'develop' into fanarttv Conflicts: couchpotato/core/media/movie/providers/info/themoviedb.py couchpotato/core/providers/metadata/xbmc/__init__.py commit 7273abf827735cf245711c3d3199a6a173a964aa Author: dan <dan@DBoehm-Arch.danboehm> Date: Thu Feb 27 13:29:57 2014 -0600 Downloads extra artwork from fanart.tv Downloads occur with correct filenaming when XBMC metadata is generated, but the image URLs are selected when the movie.info event is called. commit 9080d9d749c7e1ddbdc78f7b37a3c5f83195d580 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 16:31:37 2014 -0600 Added basic functionality for fanarttv provider. This should be mostly done and is based on the tvdb provider. commit 1b39b246c2a9d65f9ef86c4e150a12d893e362c0 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 14:50:17 2014 -0600 Updated fanarttv library with the correct package hierarchy (libs.fanarttv). commit 8abb7c8f8ad3347900debb9f6a6d5a7acb7df396 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 13:12:48 2014 -0600 Added fanart.tv API python library (lib.fanarttv). The upstream for this library is at https://github.com/z4r/python-fanart.
11 years ago
('JSONRPC.Version', None, {})
])
for result in response:
12 years ago
if result.get('result') and type(result['result']['version']).__name__ == 'int':
# only v2 and v4 return an int object
# v6 (as of XBMC v12(Frodo)) is required to send notifications
xbmc_rpc_version = str(result['result']['version'])
log.debug('XBMC JSON-RPC Version: %s ; Notifications by JSON-RPC only supported for v6 [as of XBMC v12(Frodo)]', xbmc_rpc_version)
# disable JSON use
self.use_json_notifications[host] = False
# send the text message
11 years ago
resp = self.notifyXBMCnoJSON(host, {'title': self.default_title, 'message': message})
for r in resp:
if r.get('result') and r['result'] == 'OK':
log.debug('Message delivered successfully!')
success = True
break
elif r.get('error'):
log.error('XBMC error; %s: %s (%s)', (r['id'], r['error']['message'], r['error']['code']))
break
12 years ago
elif result.get('result') and type(result['result']['version']).__name__ == 'dict':
# XBMC JSON-RPC v6 returns an array object containing
# major, minor and patch number
xbmc_rpc_version = str(result['result']['version']['major'])
xbmc_rpc_version += '.' + str(result['result']['version']['minor'])
xbmc_rpc_version += '.' + str(result['result']['version']['patch'])
log.debug('XBMC JSON-RPC Version: %s', xbmc_rpc_version)
# ok, XBMC version is supported
self.use_json_notifications[host] = True
# send the text message
Added option to run the Artwork Downloader addon during XBMC notify. This option will only work in XBMCv12 (Frodo) or later. It also requires the Artwork Downloader Addon. Since XBMC's API doesn't support notifications over HTML, there is no way for couchpotato to know when the Library Scan is complete. Since running the Artwork Downloader before the movie has been scanned won't solve anything, a delay timer can be adjusted to suit the user's needs. Squashed commit of the following: commit bd60ed585f77cc40c31fd67d4ae732e0845d31ab Merge: fcb092e b113a4d Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:26:24 2014 -0500 Merge branch 'fanarttv' into artdlnotify commit b113a4def197a9ca8545bde9f5081c0591b93b36 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:24:12 2014 -0500 Bug-fix and code cleanup. Fixed a bug where the movie.info event would crash if there aren't any pictures to scrape in fanart.tv. commit fcb092e776e00ceabea016b3c26d9394e32d72b0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Thu Apr 24 14:21:27 2014 -0500 Option to run the artwork downloader addon during XBMC notify. commit adf7a4675d472e9e95a316c6cccc681a52804f13 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 16:15:03 2014 -0500 Added support for extrafanart. Also, the main fanart will be taken from fanart.tv unless one does not exist. commit 1791e46c8602f40bb56fe0cf7ecb0607f35b4b12 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 15:13:14 2014 -0500 Couchpotato now downloads extrathumbs from the extra tmdb backdrops if they exist. This commit made some major changes to the core image creation functionality that makes writing multiple images to folders possible. commit c0858807873749dbc928c0260037138f51f894ca Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 12:18:53 2014 -0500 Bug Fix & Implemented functionality to select bluray or dvd disc images. Currently, only blurays will be selected, unless there are no blurays. However, if a mechanism for determining the quality of the release is implemented, it would be simple to make this selection based on the quality. commit 786751371d243f53d0f5c6f2c38d92288d8608ba Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:59:25 2014 -0500 Fixed a bug where non-HD clearart and logos couldn't be downloaded. commit feda8df483d13b5a5df3a869f25de8f2c7e6ffe3 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:12:31 2014 -0500 Fixed some problems that were missed with the previous merge. commit 5ddab6c40e69a5accc6c0336cd7485920ff82d8f Merge: 7273abf ff46aa0 Author: Dan Boehm <dboehm.dev@gmail.com> Date: Wed Apr 23 10:02:11 2014 -0500 Merge branch 'develop' into fanarttv Conflicts: couchpotato/core/media/movie/providers/info/themoviedb.py couchpotato/core/providers/metadata/xbmc/__init__.py commit 7273abf827735cf245711c3d3199a6a173a964aa Author: dan <dan@DBoehm-Arch.danboehm> Date: Thu Feb 27 13:29:57 2014 -0600 Downloads extra artwork from fanart.tv Downloads occur with correct filenaming when XBMC metadata is generated, but the image URLs are selected when the movie.info event is called. commit 9080d9d749c7e1ddbdc78f7b37a3c5f83195d580 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 16:31:37 2014 -0600 Added basic functionality for fanarttv provider. This should be mostly done and is based on the tvdb provider. commit 1b39b246c2a9d65f9ef86c4e150a12d893e362c0 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 14:50:17 2014 -0600 Updated fanarttv library with the correct package hierarchy (libs.fanarttv). commit 8abb7c8f8ad3347900debb9f6a6d5a7acb7df396 Author: dan <dan@DBoehm-Arch.danboehm> Date: Wed Feb 26 13:12:48 2014 -0600 Added fanart.tv API python library (lib.fanarttv). The upstream for this library is at https://github.com/z4r/python-fanart.
11 years ago
resp = self.request(host, [('GUI.ShowNotification', None, {'title':self.default_title, 'message':message, 'image': self.getNotificationImage('small')})])
for r in resp:
if r.get('result') and r['result'] == 'OK':
log.debug('Message delivered successfully!')
success = True
break
elif r.get('error'):
log.error('XBMC error; %s: %s (%s)', (r['id'], r['error']['message'], r['error']['code']))
break
# error getting version info (we do have contact with XBMC though)
12 years ago
elif result.get('error'):
log.error('XBMC error; %s: %s (%s)', (result['id'], result['error']['message'], result['error']['code']))
log.debug('Use JSON notifications: %s ', self.use_json_notifications)
return success
def notifyXBMCnoJSON(self, host, data):
server = 'http://%s/xbmcCmds/' % host
12 years ago
# Notification(title, message [, timeout , image])
11 years ago
cmd = "xbmcHttp?command=ExecBuiltIn(Notification(%s,%s,'',%s))" % (urllib.quote(getTitle(data)), urllib.quote(data['message']), urllib.quote(self.getNotificationImage('medium')))
server += cmd
# I have no idea what to set to, just tried text/plain and seems to be working :)
headers = {
'Content-Type': 'text/plain',
}
# authentication support
if self.conf('password'):
base64string = base64.encodestring('%s:%s' % (self.conf('username'), self.conf('password'))).replace('\n', '')
headers['Authorization'] = 'Basic %s' % base64string
try:
log.debug('Sending non-JSON-type request to %s: %s', (host, data))
# response wil either be 'OK':
# <html>
# <li>OK
# </html>
#
# or 'Error':
# <html>
# <li>Error:<message>
# </html>
#
response = self.urlopen(server, headers = headers, timeout = 3, show_error = False)
if 'OK' in response:
log.debug('Returned from non-JSON-type request %s: %s', (host, response))
# manually fake expected response array
return [{'result': 'OK'}]
else:
log.error('Returned from non-JSON-type request %s: %s', (host, response))
# manually fake expected response array
return [{'result': 'Error'}]
except (MaxRetryError, Timeout, ConnectionError):
log.info2('Couldn\'t send request to XBMC, assuming it\'s turned off')
return [{'result': 'Error'}]
except:
log.error('Failed sending non-JSON-type request to XBMC: %s', traceback.format_exc())
return [{'result': 'Error'}]
def request(self, host, do_requests):
server = 'http://%s/jsonrpc' % host
data = []
for req in do_requests:
Added option to run the Artwork Downloader addon during XBMC notify. This option will only work in XBMCv12 (Frodo) or later. It also requires the Artwork Downloader Addon. Since XBMC&#39;s API doesn&#39;t support notifications over HTML, there is no way for couchpotato to know when the Library Scan is complete. Since running the Artwork Downloader before the movie has been scanned won&#39;t solve anything, a delay timer can be adjusted to suit the user&#39;s needs. Squashed commit of the following: commit bd60ed585f77cc40c31fd67d4ae732e0845d31ab Merge: fcb092e b113a4d Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Thu Apr 24 14:26:24 2014 -0500 Merge branch &#39;fanarttv&#39; into artdlnotify commit b113a4def197a9ca8545bde9f5081c0591b93b36 Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Thu Apr 24 14:24:12 2014 -0500 Bug-fix and code cleanup. Fixed a bug where the movie.info event would crash if there aren&#39;t any pictures to scrape in fanart.tv. commit fcb092e776e00ceabea016b3c26d9394e32d72b0 Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Thu Apr 24 14:21:27 2014 -0500 Option to run the artwork downloader addon during XBMC notify. commit adf7a4675d472e9e95a316c6cccc681a52804f13 Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Wed Apr 23 16:15:03 2014 -0500 Added support for extrafanart. Also, the main fanart will be taken from fanart.tv unless one does not exist. commit 1791e46c8602f40bb56fe0cf7ecb0607f35b4b12 Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Wed Apr 23 15:13:14 2014 -0500 Couchpotato now downloads extrathumbs from the extra tmdb backdrops if they exist. This commit made some major changes to the core image creation functionality that makes writing multiple images to folders possible. commit c0858807873749dbc928c0260037138f51f894ca Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Wed Apr 23 12:18:53 2014 -0500 Bug Fix &amp; Implemented functionality to select bluray or dvd disc images. Currently, only blurays will be selected, unless there are no blurays. However, if a mechanism for determining the quality of the release is implemented, it would be simple to make this selection based on the quality. commit 786751371d243f53d0f5c6f2c38d92288d8608ba Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Wed Apr 23 10:59:25 2014 -0500 Fixed a bug where non-HD clearart and logos couldn&#39;t be downloaded. commit feda8df483d13b5a5df3a869f25de8f2c7e6ffe3 Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Wed Apr 23 10:12:31 2014 -0500 Fixed some problems that were missed with the previous merge. commit 5ddab6c40e69a5accc6c0336cd7485920ff82d8f Merge: 7273abf ff46aa0 Author: Dan Boehm &lt;dboehm.dev@gmail.com&gt; Date: Wed Apr 23 10:02:11 2014 -0500 Merge branch &#39;develop&#39; into fanarttv Conflicts: couchpotato/core/media/movie/providers/info/themoviedb.py couchpotato/core/providers/metadata/xbmc/__init__.py commit 7273abf827735cf245711c3d3199a6a173a964aa Author: dan &lt;dan@DBoehm-Arch.danboehm&gt; Date: Thu Feb 27 13:29:57 2014 -0600 Downloads extra artwork from fanart.tv Downloads occur with correct filenaming when XBMC metadata is generated, but the image URLs are selected when the movie.info event is called. commit 9080d9d749c7e1ddbdc78f7b37a3c5f83195d580 Author: dan &lt;dan@DBoehm-Arch.danboehm&gt; Date: Wed Feb 26 16:31:37 2014 -0600 Added basic functionality for fanarttv provider. This should be mostly done and is based on the tvdb provider. commit 1b39b246c2a9d65f9ef86c4e150a12d893e362c0 Author: dan &lt;dan@DBoehm-Arch.danboehm&gt; Date: Wed Feb 26 14:50:17 2014 -0600 Updated fanarttv library with the correct package hierarchy (libs.fanarttv). commit 8abb7c8f8ad3347900debb9f6a6d5a7acb7df396 Author: dan &lt;dan@DBoehm-Arch.danboehm&gt; Date: Wed Feb 26 13:12:48 2014 -0600 Added fanart.tv API python library (lib.fanarttv). The upstream for this library is at https://github.com/z4r/python-fanart.
11 years ago
method, id, kwargs = req
data.append({
'method': method,
'params': kwargs,
'jsonrpc': '2.0',
11 years ago
'id': id if id else method,
})
data = json.dumps(data)
14 years ago
headers = {
'Content-Type': 'application/json',
}
14 years ago
if self.conf('password'):
base64string = base64.encodestring('%s:%s' % (self.conf('username'), self.conf('password'))).replace('\n', '')
headers['Authorization'] = 'Basic %s' % base64string
try:
log.debug('Sending request to %s: %s', (host, data))
response = self.getJsonData(server, headers = headers, data = data, timeout = 3, show_error = False)
log.debug('Returned from request %s: %s', (host, response))
return response
except (MaxRetryError, Timeout, ConnectionError):
log.info2('Couldn\'t send request to XBMC, assuming it\'s turned off')
return []
except:
log.error('Failed sending request to XBMC: %s', traceback.format_exc())
return []
config = [{
'name': 'xbmc',
'groups': [
{
'tab': 'notifications',
'list': 'notification_providers',
'name': 'xbmc',
'label': 'XBMC',
11 years ago
'description': 'v11 (Eden), v12 (Frodo), v13 (Gotham)',
'options': [
{
'name': 'enabled',
'default': 0,
'type': 'enabler',
},
{
'name': 'host',
'default': 'localhost:8080',
},
{
'name': 'username',
'default': 'xbmc',
},
{
'name': 'password',
'default': '',
'type': 'password',
},
{
'name': 'only_first',
'default': 0,
'type': 'bool',
'advanced': True,
'description': 'Only update the first host when movie snatched, useful for synced XBMC',
},
{
'name': 'remote_dir_scan',
'label': 'Remote Folder Scan',
'default': 0,
'type': 'bool',
'advanced': True,
11 years ago
'description': ('Only scan new movie folder at remote XBMC servers.', 'Useful if the XBMC path is different from the path CPS uses.'),
},
{
'name': 'force_full_scan',
'label': 'Always do a full scan',
'default': 0,
'type': 'bool',
'advanced': True,
11 years ago
'description': ('Do a full scan instead of only the new movie.', 'Useful if the XBMC path is different from the path CPS uses.'),
},
{
'name': 'on_snatch',
11 years ago
'default': False,
'type': 'bool',
'advanced': True,
'description': 'Also send message when movie is snatched.',
},
],
}
],
}]