Skip to content

Commit

Permalink
v.0.4.6d
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Mar 24, 2024
1 parent d08e19d commit c6bc776
Show file tree
Hide file tree
Showing 22 changed files with 296 additions and 255 deletions.
9 changes: 2 additions & 7 deletions addons.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addons>
<addon id="plugin.video.pseudotv.live" version="0.4.6b" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.6d" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="pvr.iptvsimple" version="21.8.0"/>
Expand Down Expand Up @@ -72,18 +72,13 @@
</extension>
</addon>

<addon id="repository.pseudotv" name="PseudoTV Repository" version="1.0.4" provider-name="Lunatixz">
<addon id="repository.pseudotv" name="PseudoTV Repository" version="1.0.5" provider-name="Lunatixz">
<extension point="xbmc.addon.repository" name="PseudoTV Repository">
<dir>
<info compressed="false">https://raw.githubusercontent.com/PseudoTV/PseudoTV_Live/master/addons.xml</info>
<checksum>https://raw.githubusercontent.com/PseudoTV/PseudoTV_Live/master/addons.xml.md5</checksum>
<datadir zip="true">https://raw.githubusercontent.com/PseudoTV/PseudoTV_Live/master/zips</datadir>
</dir>
<dir>
<info compressed="false">https://raw.githubusercontent.com/PseudoTV/PseudoTV_Live/matrix/addons.xml</info>
<checksum>https://raw.githubusercontent.com/PseudoTV/PseudoTV_Live/matrix/addons.xml.md5</checksum>
<datadir zip="true">https://raw.githubusercontent.com/PseudoTV/PseudoTV_Live/matrix/zips</datadir>
</dir>
<dir>
<info compressed="false">https://raw.githubusercontent.com/PseudoTV/PseudoTV_Resources/master/addons.xml</info>
<checksum>https://raw.githubusercontent.com/PseudoTV/PseudoTV_Resources/master/addons.xml.md5</checksum>
Expand Down
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c114e588b689314a3e71fca10db045fb
fb26230a02ae4a12cb2625438e566e17
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.pseudotv.live" version="0.4.6b" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.6d" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="pvr.iptvsimple" version="21.8.0"/>
Expand Down
3 changes: 3 additions & 0 deletions plugin.video.pseudotv.live/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
v.0.4.7
-Fixed misc. playback issues.
-Fixed Movie ratings filler and resources.
-Updated April Seasonal channels.
-Fixed channel bug not displaying correct logo.

v.0.4.6
-Refactored Seasonal & Provisional Autotuning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,18 @@ msgctxt "#30124"
msgid "Three Shows"
msgstr ""

msgctxt "#30125"
msgid "IMDB Trailers"
msgstr ""

msgctxt "#30126"
msgid "Kodi Trailers"
msgstr ""

msgctxt "#30127"
msgid "Both Kodi/IMDB Trailers"
msgstr ""




Expand Down
44 changes: 24 additions & 20 deletions plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,35 @@ def __init__(self, service=None):
self.sort = {} #{"ignorearticle":true,"method":"random","order":"ascending","useartistsortname":true}
self.limits = {} #{"end":0,"start":0,"total":0}

self.incRatings = SETTINGS.getSettingInt('Fillers_Ratings')
self.resRatings = SETTINGS.getSetting('Resource_Ratings').split('|')
self.incBumpers = SETTINGS.getSettingInt('Fillers_Bumpers')
self.resBumpers = SETTINGS.getSetting('Resource_Bumpers').split('|')
self.incAdverts = SETTINGS.getSettingInt('Fillers_Commercials')
self.resAdverts = SETTINGS.getSetting('Resource_Commericals').split('|')
self.incTrailer = SETTINGS.getSettingInt('Fillers_Trailers')
self.resTrailer = SETTINGS.getSetting('Resource_Trailers').split('|')
self.incRatings = SETTINGS.getSettingInt('Fillers_Ratings')
self.srcRatings = {"RESC":SETTINGS.getSetting('Resource_Ratings').split('|')}

self.incBumpers = SETTINGS.getSettingInt('Fillers_Bumpers')
self.srcBumpers = {"PATH":[SETTINGS.getSetting('Resource_Bumpers')]}

self.incAdverts = SETTINGS.getSettingInt('Fillers_Commercials')
self.srcAdverts = {"PATH":[SETTINGS.getSetting('Resource_Commericals')]}

self.incTrailer = SETTINGS.getSettingInt('Fillers_Trailers')
self.srcTrailer = {"PATH":[SETTINGS.getSettingInt('Resource_Trailers')]}

self.minDuration = SETTINGS.getSettingInt('Seek_Tolerance')
self.maxDays = MAX_GUIDEDAYS
self.minEPG = 10800 #Secs., Min. EPG guidedata

self.service = service
self.cache = Cache()
self.channels = Channels()
self.rules = RulesList(self.channels.getChannels())
self.runActions = self.rules.runActions
self.xmltv = XMLTVS()
self.jsonRPC = JSONRPC()
self.xsp = XSP()
self.m3u = M3U()
self.resources = Resources(self.jsonRPC,self.cache)
self.service = service
self.cache = Cache()
self.channels = Channels()
self.rules = RulesList(self.channels.getChannels())
self.runActions = self.rules.runActions
self.xmltv = XMLTVS()
self.jsonRPC = JSONRPC()
self.xsp = XSP()
self.m3u = M3U()
self.fillers = Fillers(self)
self.resources = Resources(self.jsonRPC,self.cache)



def log(self, msg, level=xbmc.LOGDEBUG):
return log('%s: %s'%(self.__class__.__name__,msg),level)

Expand Down Expand Up @@ -158,7 +161,8 @@ def getFileList(self, citem, now, start):
else: cacheResponse = self.buildChannel(citem)

if cacheResponse:
if self.fillBCTs and not radio: cacheResponse = Fillers(self).injectBCTs(citem, cacheResponse)
if self.fillBCTs and not radio:
cacheResponse = self.fillers.injectBCTs(citem, cacheResponse)
cacheResponse = self.addScheduling(citem, cacheResponse, start)
return sorted(cacheResponse, key=lambda k: k['start'])
else: raise Exception('cacheResponse in-valid!\n%s'%(cacheResponse))
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/channelbug.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def log(self, msg, level=xbmc.LOGDEBUG):

def onInit(self):
if not BUILTIN.getInfoBool('IsFullscreen','System'):
DIALOG.okDialog(LANGUAGE(32097)%(BUILTIN.getInfoLabel('ScreenResolution','System')), usethread=True)
DIALOG.okDialog(LANGUAGE(32097)%(BUILTIN.getInfoLabel('ScreenResolution','System')))

self.log('onInit, channelbug posx,posy = (%s,%s)'%(self.userPOSX,self.userPOSY))
self._channelBug = xbmcgui.ControlImage(self.userPOSX, self.userPOSY, 128, 128, COLOR_LOGO, aspectRatio=2)
Expand Down
152 changes: 90 additions & 62 deletions plugin.video.pseudotv.live/resources/lib/fillers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
"R" :"Restricted – Under 17 requires accompanying parent or adult guardian.\nContains some adult material. Parents are urged to learn more about the film before taking their young children with them.",
"NC-17":"Adults only – No one 17 and under admitted.\nClearly adult. Children are not admitted.",
"NR" :"Film has not been submitted for a rating or it's rating is unknown."}


IMDB_PATHS = ['plugin://plugin.video.imdb.trailers/?action=list1&key=showing',
'plugin://plugin.video.imdb.trailers/?action=list1&key=coming']
#Ratings - resource only, Movie Type only any channel type
#Bumpers - plugin, path only, tv type, tv network, custom channel type
#Adverts - plugin, path only, tv type, any tv channel type
#Trailers - plug, path only, movie type, any movie channel.

class Fillers:
def __init__(self, builder):
self.builder = builder
Expand All @@ -36,88 +43,109 @@ def __init__(self, builder):
self.resources = Resources(self.jsonRPC,self.cache)

#default global rules:
self.bctTypes = {"ratings" :{"min":1,"max":1,"auto":builder.incRatings == 1,"enabled":bool(builder.incRatings),"paths":builder.resRatings,"resources":{}},
"bumpers" :{"min":1,"max":1,"auto":builder.incBumpers == 1,"enabled":bool(builder.incBumpers),"paths":builder.resBumpers,"resources":{}},}

# "commercials":{"min":SETTINGS.getSettingInt('Fillers_Commercials'),"max":4,
# "enabled":SETTINGS.getSettingInt('Fillers_Commercials') > 0,"paths":(SETTINGS.getSetting('Resource_Commericals')).split('|')},

# "trailers" :{"min":SETTINGS.getSettingInt('Fillers_Trailers') ,"max":SETTINGS.getSettingInt('Fillers_Trailers') - 2,
# "enabled":SETTINGS.getSettingInt('Fillers_Trailers') > 0,"paths":(SETTINGS.getSetting('Resource_Trailers')).split('|')}}

# self.buildResourceByType('ratings',self.bctTypes['ratings']['paths'])
self.bctTypes = {"ratings" :{"max":1 ,"auto":builder.incRatings == 1,"enabled":bool(builder.incRatings),"sources":builder.srcRatings,"resources":{}},
"bumpers" :{"max":1 ,"auto":builder.incBumpers == 1,"enabled":bool(builder.incBumpers),"sources":builder.srcBumpers,"resources":{}},
"adverts" :{"max":builder.incAdverts,"auto":builder.incAdverts == 1,"enabled":bool(builder.incAdverts),"sources":builder.srcAdverts,"resources":{}},
"trailers" :{"max":builder.incTrailer,"auto":builder.incTrailer == 1,"enabled":bool(builder.incTrailer),"sources":builder.srcTrailer,"resources":{}}}

self.fillResources()
print('self.bctTypes',self.bctTypes)


def log(self, msg, level=xbmc.LOGDEBUG):
return log('%s: %s'%(self.__class__.__name__,msg),level)


@cacheit(expiration=datetime.timedelta(minutes=15),json_data=True)
def buildResourceByType(self, type, ids):
def _parse(ids):
for id in ids:
if not hasAddon(id): continue
yield self.resources.walkResource(id,exts=VIDEO_EXTS)

for resource in list(_parse(ids)):
def fillResources(self):
data = {}
for key, values in self.bctTypes.items():
if values.get("sources",{}).get("RESC"):
data = self.buildResource(key,values['sources']["RESC"])
if data: values["resources"].update(data)


# @cacheit(expiration=datetime.timedelta(minutes=15),json_data=True)
def buildResource(self, type, ids):
self.log('buildResource, type = %s, ids = %s'%(type, ids))
def _parse(addonids):
for addon in addonids:
if not hasAddon(addon): continue
yield self.resources.walkResource(addon,exts=VIDEO_EXTS)

def _rating(resource):
for path in resource:
for file in resource[path]:
key = file.split('.')[0].replace(' (3DSBS)','')
if '(3DSBS)' in file: self.bctTypes['ratings'].get('resources',{}).setdefault('3D',{}).setdefault(key,[]).append(os.path.join(path,file))
else: self.bctTypes['ratings'].get('resources',{}).setdefault(key,[]).append(os.path.join(path,file))
print('buildResourceByType',self.bctTypes.get(type,{}))

tmpDCT.setdefault(file.split('.')[0],[]).append(os.path.join(path,file)) #{'PG-13':[],'R':[]}
tmpDCT = {}
for id in list(_parse(ids)):
if type == 'ratings': _rating(id)
return tmpDCT


def getRating(self, fileItem, mpaa):
def getRating(self, mpaa):
def _convert(rating):
#https://www.spherex.com/tv-ratings-vs-movie-ratings
#https://www.spherex.com/which-is-more-regulated-film-or-tv
return rating.replace('TV-Y','G').replace('TV-Y7','G').replace('TV-G','G').replace('NA','NR').replace('TV-PG','PG').replace('TV-14','PG-13').replace('TV-MA','R')

try:
mpaa = re.compile(":(.*?)/", re.IGNORECASE).search(mpaa.upper()).group(1)
mpaa = mpaa.strip()
except:
mpaa = mpaa.upper()
mpaa = re.compile(":(.*?)/", re.IGNORECASE).search(mpaa).group(1)
except: pass

files = []
print('getRating',mpaa)
if self.builder.is3D(fileItem): files = self.bctTypes['ratings']['resources'].get('3D',{}).get(mpaa,[])
if not files: files = self.bctTypes['ratings'].get('resources',{}).get(mpaa,[])
if not files:
mpaa = _convert(mpaa)
files = self.bctTypes['ratings'].get('resources',{}).get(mpaa,[])
if files: return mpaa, random.choice(files)
return mpaa, files
for rating in [mpaa, _convert(mpaa)]:
print('getRating',rating)
files = self.bctTypes['ratings'].get('resources',{}).get(rating,[])
if files: return rating, random.choice(files)
return mpaa, None


# @cacheit(expiration=datetime.timedelta(minutes=15),json_data=True)
def buildKodiTrailers(self, fileList):
def _parse(fileItem):
if not fileItem.get('trailer','').startswith(tuple(VFS_TYPES)):
return {'title':fileItem.get('title','Trailer'),'plot':(fileItem.get('plotoutline') or fileItem.get('plot','')),'path':fileItem.get('trailer')}
return poolit(_parse)(fileList)


def getTrailers(self, fileList):
files = self.buildKodiTrailers(fileList)
print('getTrailers',files)
if files: return random.choice(files)


def injectBCTs(self, citem, fileList):
# nfileList = []
# for idx, fileItem in enumerate(fileList):
# if not fileItem: continue
# elif self.builder.service._interrupt() or self.builder.service._suspend(): break
# else:
# try:
# #pre roll - ratings
# if fileItem.get('type').startswith(tuple(MOVIE_TYPES)):
# if self.bctTypes['ratings']['enabled']:
# mpaa = fileItem.get('mpaa','NR')
# mpaa, file = self.getRating(fileItem, mpaa)
# print('injectBCTs',mpaa,file)
# if file:
# dur = self.jsonRPC.getDuration(file, accurate=True)
# if dur > 0:
# self.log('injectBCTs, adding ratings %s\n%s - %s'%(fileItem.get('title'),file,dur))
# nfileList.append(self.builder.buildCells(citem,dur,entries=1,info={'title':mpaa,'genre':['ratings'],'plot':RATING_DESC.get(mpaa,''),'path':file})[0])
# # #pre roll - bumpers
# # elif fileItem.get('type').startswith(tuple(TV_TYPES)):
# # ...
# except Exception as e: self.log('injectBCTs, pre roll failed! %s'%(e), xbmc.LOGERROR)
# nfileList.append(fileItem)
# #post roll - commercials/trailers
# return nfileList
nfileList = []
for idx, fileItem in enumerate(fileList):
if not fileItem: continue
elif self.builder.service._interrupt() or self.builder.service._suspend(): break
else:
#pre roll - ratings
if fileItem.get('type').startswith(tuple(MOVIE_TYPES)):
if self.bctTypes['ratings'].get('enabled',False):
mpaa, file = self.getRating(fileItem.get('mpaa','NR'))
print('injectBCTs',mpaa,file)
if file:
dur = self.jsonRPC.getDuration(file, accurate=True)
if dur > 0:
self.log('injectBCTs, adding ratings %s\n%s - %s'%(fileItem.get('title'),file,dur))
nfileList.append(self.builder.buildCells(citem,dur,entries=1,info={'title':mpaa,'genre':['ratings'],'plot':RATING_DESC.get(mpaa,''),'path':file})[0])
# #pre roll - bumpers
# elif fileItem.get('type').startswith(tuple(TV_TYPES)):
# ...
nfileList.append(fileItem)
#post roll - commercials/trailers
# if self.bctTypes['trailers'].get('enabled',False):
# tmpItem = self.getTrailers(fileList):
# dur = self.jsonRPC.getDuration(tmpItem.get('file'),tmpItem, accurate=True)
# print('injectBCTs',tmpItem,dur)
# if dur > 0: nfileList.append(self.builder.buildCells(citem,dur,entries=1,info=tmpItem)[0])
return nfileList


return fileList
# HasAddon(plugin.video.imdb.trailers)
# HasContent(Movies)
# return fileList
# if not fileList: return fileList
# self.log("injectBCTs, channel = %s, fileList = %s"%(citem.get('id'),len(fileList)))
# ratings = self.buildResourceByType('ratings')
Expand Down
Loading

0 comments on commit c6bc776

Please sign in to comment.