Skip to content

Commit

Permalink
v1.0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
IIeTp committed Jul 12, 2020
1 parent 3ec81b3 commit 7df265b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
13 changes: 10 additions & 3 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
from updater import Updater
from utils import *

FileBotMod = filebot_is(Prefs['xattr_id'])
if FileBotMod != False:
if module_add_syspath('../../../Scanners/Common/', 'filebot.py') == True:
from filebot import *
Log('FileBot Xattr is founded')
FileBot = True
else:
FileBot = False

THEME_URL = 'https://tvthemes.plexapp.com/%s.mp3'
TVDB_API_KEY = 'D4DDDAEFAD083E6F'
META_HOST = 'https://meta.plex.tv'

Expand Down Expand Up @@ -478,8 +478,9 @@ def search(self, results, media, lang, manual=False):
file = media.seasons[s].episodes[e].items[0].parts[0].file ; break
break
if file:
attr = xattr_metadata(file) if FileBot == True else None
attr = xattr_metadata(file) if FileBot == True and Prefs['xattr_id'] == True else None
if attr is not None:
Log('Trying to use FileBot XATTR Metadata')
if attr_get(attr, '@type') == 'MultiEpisode':
attr = (attr_get(attr, 'episodes'))[0]
sid = series_id(attr)
Expand Down Expand Up @@ -879,6 +880,7 @@ def update(self, metadata, media, lang, force=False):

tvdb_series_data = defaultdict(lambda: '')
tvdb_series_orig_data = dict()

try:
tvdb_series_orig_data = JSON.ObjectFromString(GetResultFromNetwork(TVDB_SERIES_URL % (metadata.id, lang), additionalHeaders={'Accept-Language': lang}, cacheTime=0 if force else CACHE_1WEEK))
tvdb_series_data.update(tvdb_series_orig_data['data'])
Expand Down Expand Up @@ -931,6 +933,11 @@ def update(self, metadata, media, lang, force=False):
metadata.summary = tvdb_series_data['overview'] or tvdb_english_series_data['overview']
metadata.content_rating = tvdb_series_data['rating']
metadata.studio = tvdb_series_data['network']
if Prefs['theme_music'] == True and metadata.id is not None:
Log('Trying to load from PlexThemeMusic')
try:
metadata.themes[THEME_URL % metadata.id] = Proxy.Media(HTTP.Request(THEME_URL % metadata.id))
except: pass

# Convenience Function
parse_date = lambda s: Datetime.ParseDate(s).date()
Expand Down
10 changes: 8 additions & 2 deletions Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
"label":"Prefer FileBot Xattr Metadata for matching, if present",
"type":"bool",
"default":"true"
},
{
},
{
"id":"theme_music",
"label":"Plex Theme Music support",
"type":"bool",
"default":"true"
},
{
"id":"extras",
"label":"Find trailers and extras automatically (Plex Pass required)",
"type":"bool",
Expand Down
15 changes: 2 additions & 13 deletions Contents/Libraries/Shared/utils.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import re, importlib, sys, os, importlib
from os.path import *

def import_ext_module(mod_path, mod_name):
def module_add_syspath(mod_path, mod_name):
module_file = os.path.isfile(os.path.realpath(os.path.join(mod_path + mod_name)))
if module_file == True:
module_path = os.path.realpath(os.path.join(mod_path))
sys.path.append(module_path)
my_mod = importlib.import_module(mod_name[:(len(mod_name)-3)])
return my_mod
else:
return False

def filebot_is(prefs_is):
if prefs_is == True:
import_mod = import_ext_module('../../../Scanners/Common/', 'filebot.py')
if import_mod != False:
return import_mod
else:
return False
return True
else:
return False

Expand Down
2 changes: 1 addition & 1 deletion Contents/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.20
v1.0.21

0 comments on commit 7df265b

Please sign in to comment.