Skip to content

Commit

Permalink
v.0.4.9g
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Apr 23, 2024
1 parent 4e3603d commit 9c25d94
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 24 deletions.
2 changes: 1 addition & 1 deletion 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.9f" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.9g" 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
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
058f41b5ce08be6fe6a42b69eb671379
ff9badaebd3254c54fc3118bc5c62ae2
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.9f" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.9g" 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
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@
CHANNELBACKUPFLE = 'channels.backup'
CHANNELRESTOREFLE = 'channels.restore'

VIDEO_EXTS = xbmc.getSupportedMedia('video').split('|')[-1]
MUSIC_EXTS = xbmc.getSupportedMedia('music').split('|')[-1]
IMAGE_EXTS = xbmc.getSupportedMedia('picture').split('|')[-1]
VIDEO_EXTS = xbmc.getSupportedMedia('video').split('|')[:-1]
MUSIC_EXTS = xbmc.getSupportedMedia('music').split('|')[:-1]
IMAGE_EXTS = xbmc.getSupportedMedia('picture').split('|')[:-1]
IMG_EXTS = ['.png','.jpg','.gif']
TEXTURES = 'Textures.xbt'

Expand Down
17 changes: 9 additions & 8 deletions plugin.video.pseudotv.live/resources/lib/fillers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, builder):
"adverts" :{"max":builder.incAdverts,"auto":builder.incAdverts == 1,"enabled":bool(builder.incAdverts),"sources":builder.srcAdverts,"items":{}},
"trailers" :{"max":builder.incTrailer,"auto":builder.incTrailer == 1,"enabled":bool(builder.incTrailer),"sources":builder.srcTrailer,"items":{}}}
self.fillSources()


def log(self, msg, level=xbmc.LOGDEBUG):
return log('%s: %s'%(self.__class__.__name__,msg),level)
Expand Down Expand Up @@ -129,6 +129,14 @@ def getMulti(self, type, keys=['resources'], count=1):


def injectBCTs(self, citem, fileList):
addBumpers = self.bctTypes['bumpers'].get('enabled',False)
addRatings = self.bctTypes['ratings'].get('enabled',False)
addAdverts = self.bctTypes['adverts'].get('enabled',False)
addTrailers = self.bctTypes['trailers'].get('enabled',False)
cntAdverts = PAGE_LIMIT if self.bctTypes['adverts']['auto'] else self.bctTypes['adverts']['max']
cntTrailers = PAGE_LIMIT if self.bctTypes['trailers']['auto'] else self.bctTypes['trailers']['max']
self.log('injectBCTs, Bumpers = %s, Ratings = %s, Adverts = %s, Trailers = %s'%(addBumpers,addRatings,addAdverts,addTrailers))

nfileList = []
for idx, fileItem in enumerate(fileList):
if not fileItem: continue
Expand All @@ -145,13 +153,6 @@ def injectBCTs(self, citem, fileList):
fgenre = (fileItem.get('genre') or citem.get('group') or '')
if isinstance(fgenre,list) and len(fgenre) > 0: fgenre = fgenre[0]

addBumpers = self.bctTypes['bumpers'].get('enabled',False)
addRatings = self.bctTypes['ratings'].get('enabled',False)
addAdverts = self.bctTypes['adverts'].get('enabled',False)
addTrailers = self.bctTypes['trailers'].get('enabled',False)
cntAdverts = PAGE_LIMIT if self.bctTypes['adverts']['auto'] else self.bctTypes['adverts']['max']
cntTrailers = PAGE_LIMIT if self.bctTypes['trailers']['auto'] else self.bctTypes['trailers']['max']

#pre roll - bumpers
if addBumpers:
# #todo movie bumpers for audio/video codecs? imax, cinema experience bumpers?
Expand Down
31 changes: 22 additions & 9 deletions plugin.video.pseudotv.live/resources/lib/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,31 @@ def cacheJSON(self, param, life=datetime.timedelta(minutes=15), checksum=ADDON_V

def walkFileDirectory(self, path, media='files', depth=3, chkDuration=False, retItem=False, checksum=ADDON_VERSION, expiration=datetime.timedelta(minutes=15)):
self.log('walkFileDirectory, path = %s, media = %s'%(path,media))
chks = list()
walk = dict()
dirs = [path]

for idx, dir in enumerate(dirs):
if MONITOR.waitForAbort(0.001) or idx > depth: break
depth -= 1
if MONITOR.waitForAbort(0.001) or depth < 1: break
else:
if len(dirs) > 0: dir = dirs.pop(dirs.index(dir))
if dir in chks: continue
else: chks.append(dir)
self.log('walkFileDirectory, walking %s/%s directory'%(idx,len(dirs)))
for item in self.getDirectory(param={"directory":dir,"media":media}).get('files',[]):
print('walkFileDirectory',item,dirs)
if item.get('filetype') == 'directory': dirs.append(item.get('file'))
elif item.get('filetype') == 'file':
if chkDuration:
dur = self.getDuration(item.get('file'),item, accurate=True)
if dur == 0: continue
item['duration'] = dur
item['duration'] = self.getDuration(item.get('file'),item, accurate=True)
if item['duration'] == 0: continue
walk.setdefault(dir,[]).append(item if retItem else item.get('file'))
return walk


def walkListDirectory(self, path, exts='', depth=3, chkDuration=False, appendPath=False, checksum=ADDON_VERSION, expiration=datetime.timedelta(minutes=15)):
self.log('walkListDirectory, path = %s, exts = %s'%(path,exts))
def _chkfile(path, f):
if chkDuration:
if self.getDuration(os.path.join(path,f), accurate=True) == 0: return
Expand All @@ -122,15 +129,21 @@ def _parseXBT():
walk.setdefault(resource,[]).extend(self.getListDirectory(resource,checksum,expiration)[1])
return walk

self.log('walkListDirectory, path = %s, exts = %s'%(path,exts))
chks = list()
walk = dict()
path = path.replace('\\','/')
dirs, files = self.getListDirectory(path,checksum,expiration)
if TEXTURES in files: return _parseXBT()
else: walk.setdefault(path,[]).extend(list(filter(None,[_chkfile(path, f) for f in files if f.endswith(tuple(exts))])))
else:
walk.setdefault(path,[]).extend(list(filter(None,[_chkfile(path, f) for f in files if f.endswith(tuple(exts))])))

for idx, dir in enumerate(dirs):
if MONITOR.waitForAbort(0.001) or idx > depth: break
depth -= 1
if MONITOR.waitForAbort(0.001) or depth < 1: break
else:
if len(dirs) > 0: dir = dirs.pop(dirs.index(dir))
if dir in chks: continue
else: chks.append(dir)
self.log('walkListDirectory, walking %s/%s directory'%(idx,len(dirs)))
walk.update(self.walkListDirectory(os.path.join(path, dir),exts,checksum))
return walk
Expand Down Expand Up @@ -305,7 +318,7 @@ def parseYoutubeRuntime(self, id):

def getDuration(self, path, item={}, accurate=bool(SETTINGS.getSettingInt('Duration_Type'))):
self.log("getDuration, accurate = %s, path = %s" % (accurate, path))
runtime = (item.get('runtime') or item.get('duration') or item.get('streamdetails',{}).get('video',[{}])[0].get('duration') or 0)
runtime = (item.get('runtime') or item.get('duration') or (item.get('streamdetails',{}).get('video',[]) or [{}])[0].get('duration') or 0)
if not runtime and path.startswith(('plugin://plugin.video.youtube','plugin://plugin.video.tubed','plugin://plugin.video.invidious')):
runtime = self.parseYoutubeRuntime(path)

Expand All @@ -325,7 +338,7 @@ def parseDuration(self, path, item={}, save=SETTINGS.getSettingBool('Store_Durat
self.log("parseDuration, path = %s, save = %s" % (path, save))
cacheCHK = getMD5(path)
cacheName = 'parseDuration.%s'%(cacheCHK)
runtime = (item.get('runtime') or item.get('duration') or item.get('streamdetails', {}).get('video',[{}])[0].get('duration') or 0)
runtime = (item.get('runtime') or item.get('duration') or (item.get('streamdetails',{}).get('video',[]) or [{}])[0].get('duration') or 0)
duration = self.cache.get(cacheName, checksum=cacheCHK, json_data=False)
if not duration:
try:
Expand Down
14 changes: 14 additions & 0 deletions plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,20 @@ def setCacheSetting(self, key, value, checksum=ADDON_VERSION, life=datetime.time
def setPropertySetting(self, key, value):
return self.property.setProperty(key, value)


def getEXTMeta(self, id):
addon = xbmcaddon.Addon(id)
properties = ['name', 'version', 'summary', 'description', 'path', 'author', 'icon', 'disclaimer', 'fanart', 'changelog', 'id', 'profile', 'stars', 'type']
for property in properties: yield (property, addon.getAddonInfo(property))


def getEXTSetting(self, id, key):
return xbmcaddon.Addon(id).getSetting(key)


def setEXTSetting(self, id, key, value):
return xbmcaddon.Addon(id).setSetting(key,value)


def setPVRPath(self, userFolder):
self.log('setPVRPath, userFolder = %s'%(userFolder)) #set local pvr folder
Expand Down
7 changes: 6 additions & 1 deletion plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,16 @@ def validateVFS(self, path, channelData):
with busy_dialog():
items = self.jsonRPC.walkFileDirectory(path, 'music' if isRadio({'path':[path]}) else 'video', retItem=True)

attempts = 3
for dir in items:
tries = 3
attempts -= 1
if MONITOR.waitForAbort(0.001) or attempts < 1: break
for idx, item in enumerate(items.get(dir,[])):
dia = DIALOG.progressDialog(int(((idx)*100)//len(items)),control=dia, message='%s %s...\n%s\n%s'%(LANGUAGE(32098),'Path',path,item.get('file','')))
if MONITOR.waitForAbort(1): break
if MONITOR.waitForAbort(1) or tries < 1: break
else:
tries -= 1
dur = self.jsonRPC.getDuration(item.get('file'), item, accurate=True)
item.update({'duration':dur,'runtime':dur})
if dur == 0: continue
Expand Down
Binary file not shown.

0 comments on commit 9c25d94

Please sign in to comment.