mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Merge tag 'v4.0.4' into develop
v4.0.4 v4.0.4
This commit is contained in:
commit
6151062ea4
@ -9,7 +9,7 @@
|
||||
#set global $sbPath = ".."
|
||||
|
||||
#set global $topmenu="home"#
|
||||
#import os.path
|
||||
#import os.pat
|
||||
#include $os.path.join($sickbeard.PROG_DIR, "gui/slick/interfaces/default/inc_top.tmpl")
|
||||
|
||||
#set $myDB = $db.DBConnection()
|
||||
|
@ -17,17 +17,8 @@
|
||||
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import traceback
|
||||
import re
|
||||
import sickbeard
|
||||
import six
|
||||
import chardet
|
||||
import unicodedata
|
||||
|
||||
from string import ascii_letters, digits
|
||||
from sickbeard import logger
|
||||
from unidecode import unidecode
|
||||
|
||||
import sickbeard
|
||||
|
||||
def _toUnicode(x):
|
||||
try:
|
||||
|
@ -26,6 +26,7 @@ import platform
|
||||
|
||||
import sickbeard
|
||||
from sickbeard import classes
|
||||
from sickbeard.encodingKludge import ek
|
||||
from github import Github
|
||||
from pastebin import PastebinAPI
|
||||
|
||||
@ -149,10 +150,11 @@ class Logger(object):
|
||||
pastebin_url = None
|
||||
try:
|
||||
if self.logFile and os.path.isfile(self.logFile):
|
||||
with ek.ek(open, self.logFile) as f:
|
||||
data = f.readlines(50)
|
||||
with ek(open, self.logFile) as f:
|
||||
data = f.readlines()
|
||||
data = "".join(data[len(data) - 100:])
|
||||
pastebin_url = PastebinAPI().paste('f59b8e9fa1fc2d033e399e6c7fb09d19', data)
|
||||
except:
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
try:
|
||||
|
@ -128,7 +128,8 @@ class ApiHandler(RequestHandler):
|
||||
else:
|
||||
outputCallback = outputCallbackDict['default']
|
||||
|
||||
return self.finish(outputCallback(outDict))
|
||||
try:self.finish(outputCallback(outDict))
|
||||
except:pass
|
||||
|
||||
def _out_as_json(self, dict):
|
||||
self.set_header("Content-Type", "application/json;charset=UTF-8'")
|
||||
@ -176,7 +177,14 @@ class ApiHandler(RequestHandler):
|
||||
if not (multiCmds and cmd in ('show.getposter', 'show.getbanner')): # skip these cmd while chaining
|
||||
try:
|
||||
if cmd in _functionMaper:
|
||||
curOutDict = _functionMaper.get(cmd)(curArgs, curKwargs).run()
|
||||
# map function
|
||||
func = _functionMaper.get(cmd)
|
||||
|
||||
# add request handler to function
|
||||
func.rh = self
|
||||
|
||||
# call function and get response back
|
||||
curOutDict = func(curArgs, curKwargs).run()
|
||||
elif _is_int(cmd):
|
||||
curOutDict = TVDBShorthandWrapper(curArgs, curKwargs, cmd).run()
|
||||
else:
|
||||
@ -241,6 +249,34 @@ class ApiHandler(RequestHandler):
|
||||
return curArgs, curKwargs
|
||||
|
||||
|
||||
def showPoster(self, show=None, which=None):
|
||||
# Redirect initial poster/banner thumb to default images
|
||||
if which[0:6] == 'poster':
|
||||
default_image_name = 'poster.png'
|
||||
else:
|
||||
default_image_name = 'banner.png'
|
||||
|
||||
# image_path = ek.ek(os.path.join, sickbeard.PROG_DIR, 'gui', 'slick', 'images', default_image_name)
|
||||
static_image_path = os.path.join('/images', default_image_name)
|
||||
if show and sickbeard.helpers.findCertainShow(sickbeard.showList, int(show)):
|
||||
cache_obj = image_cache.ImageCache()
|
||||
|
||||
image_file_name = None
|
||||
if which == 'poster':
|
||||
image_file_name = cache_obj.poster_path(show)
|
||||
if which == 'poster_thumb' or which == 'small':
|
||||
image_file_name = cache_obj.poster_thumb_path(show)
|
||||
if which == 'banner':
|
||||
image_file_name = cache_obj.banner_path(show)
|
||||
if which == 'banner_thumb':
|
||||
image_file_name = cache_obj.banner_thumb_path(show)
|
||||
|
||||
if ek.ek(os.path.isfile, image_file_name):
|
||||
static_image_path = os.path.normpath(image_file_name.replace(sickbeard.CACHE_DIR, '/cache'))
|
||||
|
||||
static_image_path = sickbeard.WEB_ROOT + static_image_path.replace('\\', '/')
|
||||
return self.redirect(static_image_path)
|
||||
|
||||
class ApiCall(ApiHandler):
|
||||
_help = {"desc": "No help message available. Please tell the devs that a help msg is missing for this cmd"}
|
||||
|
||||
@ -2304,7 +2340,7 @@ class CMD_ShowGetPoster(ApiCall):
|
||||
|
||||
def run(self):
|
||||
""" get the poster for a show in sickrage """
|
||||
return {'outputType': 'image', 'image': WebRoot().showPoster(self.indexerid, 'poster')}
|
||||
return {'outputType': 'image', 'image': self.rh.showPoster(self.indexerid, 'poster')}
|
||||
|
||||
|
||||
class CMD_ShowGetBanner(ApiCall):
|
||||
@ -2327,7 +2363,7 @@ class CMD_ShowGetBanner(ApiCall):
|
||||
|
||||
def run(self):
|
||||
""" get the banner for a show in sickrage """
|
||||
return {'outputType': 'image', 'image': WebRoot().showPoster(self.indexerid, 'banner')}
|
||||
return {'outputType': 'image', 'image': self.rh.showPoster(self.indexerid, 'banner')}
|
||||
|
||||
|
||||
class CMD_ShowPause(ApiCall):
|
||||
|
Loading…
Reference in New Issue
Block a user