Add default thumb and art to Live TV library

This commit is contained in:
JonnyWong16 2020-09-26 18:32:13 -07:00
parent bfa4d3dfec
commit ccf0e0dae7
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
4 changed files with 20 additions and 0 deletions

View file

@ -1943,6 +1943,19 @@ def dbcheck():
'ALTER TABLE library_sections ADD COLUMN is_active INTEGER DEFAULT 1' 'ALTER TABLE library_sections ADD COLUMN is_active INTEGER DEFAULT 1'
) )
# Upgrade library_sections table from earlier versions
try:
result = c_db.execute('SELECT thumb, art FROM library_sections WHERE section_id = ?',
[common.LIVE_TV_SECTION_ID]).fetchone()
if result and (not result[0] or not result[1]):
logger.debug("Altering database. Updating database table library_sections.")
c_db.execute('UPDATE library_sections SET thumb = ?, art =? WHERE section_id = ?',
[common.DEFAULT_LIVE_TV_THUMB,
common.DEFAULT_LIVE_TV_ART_FULL,
common.LIVE_TV_SECTION_ID])
except sqlite3.OperationalError:
pass
# Upgrade users table from earlier versions (remove UNIQUE constraint on username) # Upgrade users table from earlier versions (remove UNIQUE constraint on username)
try: try:
result = c_db.execute('SELECT SQL FROM sqlite_master WHERE type="table" AND name="users"').fetchone() result = c_db.execute('SELECT SQL FROM sqlite_master WHERE type="table" AND name="users"').fetchone()

View file

@ -48,6 +48,7 @@ DEFAULT_ART = "interfaces/default/images/art.png"
DEFAULT_LIVE_TV_POSTER_THUMB = "interfaces/default/images/poster-live.png" DEFAULT_LIVE_TV_POSTER_THUMB = "interfaces/default/images/poster-live.png"
DEFAULT_LIVE_TV_ART = "interfaces/default/images/art-live.png" DEFAULT_LIVE_TV_ART = "interfaces/default/images/art-live.png"
DEFAULT_LIVE_TV_ART_FULL = "interfaces/default/images/art-live-full.png" DEFAULT_LIVE_TV_ART_FULL = "interfaces/default/images/art-live-full.png"
DEFAULT_LIVE_TV_THUMB = "interfaces/default/images/libraries/live.png"
ONLINE_POSTER_THUMB = "https://tautulli.com/images/poster.png" ONLINE_POSTER_THUMB = "https://tautulli.com/images/poster.png"
ONLINE_COVER_THUMB = "https://tautulli.com/images/cover.png" ONLINE_COVER_THUMB = "https://tautulli.com/images/cover.png"

View file

@ -126,6 +126,8 @@ def add_live_tv_library(refresh=False):
'section_id': common.LIVE_TV_SECTION_ID, 'section_id': common.LIVE_TV_SECTION_ID,
'section_name': common.LIVE_TV_SECTION_NAME, 'section_name': common.LIVE_TV_SECTION_NAME,
'section_type': 'live', 'section_type': 'live',
'thumb': common.DEFAULT_LIVE_TV_THUMB,
'art': common.DEFAULT_LIVE_TV_ART_FULL,
'is_active': 1 'is_active': 1
} }

View file

@ -4439,6 +4439,10 @@ class WebInterface(object):
None None
``` ```
""" """
if isinstance(img, str) and img.startswith('interfaces/default/images'):
fp = os.path.join(plexpy.PROG_DIR, 'data', img)
return serve_file(path=fp, content_type='image/png')
if not img and not rating_key: if not img and not rating_key:
if fallback in common.DEFAULT_IMAGES: if fallback in common.DEFAULT_IMAGES:
fbi = common.DEFAULT_IMAGES[fallback] fbi = common.DEFAULT_IMAGES[fallback]