Skip to content

Commit

Permalink
v.0.4.5o
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Mar 5, 2024
1 parent b86b0e1 commit 5eebc8b
Show file tree
Hide file tree
Showing 18 changed files with 284 additions and 344 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.5n" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.5o" 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 @@
93f59c5a03345de6f89713d48a0d5fac
7a518e5fbc64040e42136ba12ae25fb1
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.5n" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.5o" 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
4 changes: 4 additions & 0 deletions plugin.video.pseudotv.live/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v.0.4.6


v.0.4.5
-Notice The following steps are required!.
- Open PseudoTV Live settings, under Miscellaneous; Click "Utility Menu" and select "Delete M3U/XMLTV".
Expand All @@ -11,6 +14,7 @@ v.0.4.5
-Fixed a rare instance where existing channels are not detect/imported when rebuilding the library database from scratch.
-Added "Rebuild Library" to the utility menu. Forces a library rebuild which will detected recent Kodi library additions. Default behavior the library self updates every few days to hours.
-Added "Welcome" prompt to help new users understand and operate PseudoTV Live. Suggestions for improvements are welcome.
-Removed "UpNext" support.

v.0.4.4
-Added "Network Folder" clients ability to edit Autotuned channels on server (W.I.P).
Expand Down
55 changes: 32 additions & 23 deletions plugin.video.pseudotv.live/resources/lib/autotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ def log(self, msg, level=xbmc.LOGDEBUG):
return log('%s: %s'%(self.__class__.__name__,msg),level)


def getCustom(self):
#return autotuned channels ie. channels > CHANNEL_LIMIT
channels = self.channels.getCustom()
self.log('getCustom, channels = %s'%(len(channels)))
return channels


def getAutotuned(self):
#return autotuned channels ie. channels > CHANNEL_LIMIT
channels = self.channels.getAutotuned()
Expand All @@ -46,31 +53,33 @@ def getAutotuned(self):
def _runTune(self, samples=False, rebuild=False, dia=None):
if not hasAutotuned() and not isClient():
setAutotuned()
autoChannels = self.getAutotuned()
self.log('_runTune, autotune channels = %s'%(len(autoChannels)))
customChannels = self.getCustom()
autoChannels = self.getAutotuned()
self.log('_runTune, custom channels = %s, autotune channels = %s'%(len(customChannels),len(autoChannels)))
if len(autoChannels) > 0: rebuild = True
elif len(autoChannels) == 0:
autoEnabled = []
for type in AUTOTUNE_TYPES: autoEnabled.extend(self.library.getEnabled(type))
self.log('_runTune, library enabled items = %s'%(len(autoEnabled)))
if len(autoEnabled) > 0: rebuild = True #recover empty channels.json with enabled library.json items.
else: samples = True #create sample channels "autotune".
elif len(customChannels) == 0:
if len(autoChannels) == 0:
autoEnabled = []
for type in AUTOTUNE_TYPES: autoEnabled.extend(self.library.getEnabled(type))
self.log('_runTune, library enabled items = %s'%(len(autoEnabled)))
if len(autoEnabled) > 0: rebuild = True #recover empty channels.json with enabled library.json items.
else: samples = True #create sample channels "autotune".

if samples:
opt = ''
msg = (LANGUAGE(32042)%ADDON_NAME)
if Backup().hasBackup():
opt = LANGUAGE(32112)
msg = '%s\n%s'%((LANGUAGE(32042)%ADDON_NAME),LANGUAGE(32111))
retval = DIALOG.yesnoDialog(message=msg,customlabel=opt,autoclose=90)
if retval == 1: dia = DIALOG.progressBGDialog(header='%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(32021),LANGUAGE(30038))))
elif retval == 2: return Backup().recoverChannels()
else: return
elif rebuild: PROPERTIES.setEXTProperty('%s.has.Predefined'%(ADDON_ID),True)

for idx, ATtype in enumerate(AUTOTUNE_TYPES):
if dia: dia = DIALOG.progressBGDialog(int((idx+1)*100//len(AUTOTUNE_TYPES)),dia,ATtype,'%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(32021),LANGUAGE(30038))))
self.selectAUTOTUNE(ATtype, autoSelect=samples, rebuildChannels=rebuild)
if samples:
opt = ''
msg = (LANGUAGE(32042)%ADDON_NAME)
if Backup().hasBackup():
opt = LANGUAGE(32112)
msg = '%s\n%s'%((LANGUAGE(32042)%ADDON_NAME),LANGUAGE(32111))
retval = DIALOG.yesnoDialog(message=msg,customlabel=opt,autoclose=90)
if retval == 1: dia = DIALOG.progressBGDialog(header='%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(32021),LANGUAGE(30038))))
elif retval == 2: return Backup().recoverChannels()
else: return
elif rebuild: PROPERTIES.setEXTProperty('%s.has.Predefined'%(ADDON_ID),True)
for idx, ATtype in enumerate(AUTOTUNE_TYPES):
if dia: dia = DIALOG.progressBGDialog(int((idx+1)*100//len(AUTOTUNE_TYPES)),dia,ATtype,'%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(32021),LANGUAGE(30038))))
self.selectAUTOTUNE(ATtype, autoSelect=samples, rebuildChannels=rebuild)


def selectAUTOTUNE(self, ATtype, autoSelect=False, rebuildChannels=False):
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ def __init__(self, service=None):
self.epgArt = SETTINGS.getSettingInt('EPG_Artwork')
self.enableGrouping = SETTINGS.getSettingBool('Enable_Grouping')
self.limit = SETTINGS.getSettingInt('Page_Limit')
self.filter = {} #"filter":{"and": [{"operator": "contains", "field": "title", "value": "Star Wars"},{"operator": "contains", "field": "tag", "value": "Good"}]}
self.sort = {} #"sort":{"ignorearticle":true,"method":"random","order":"ascending","useartistsortname":true}
self.limits = {} #"limits":{"end":0,"start":0,"total":0}
self.filter = {} #"filter":{"and": [{"operator": "contains", "field": "title", "value": "Star Wars"},{"operator": "contains", "field": "tag", "value": "Good"}]}
self.sort = {} #"sort":{"ignorearticle":true,"method":"random","order":"ascending","useartistsortname":true}
self.limits = {} #"limits":{"end":0,"start":0,"total":0}

self.minDuration = SETTINGS.getSettingInt('Seek_Tolerance')
self.maxDays = MAX_GUIDEDAYS
Expand Down
8 changes: 4 additions & 4 deletions plugin.video.pseudotv.live/resources/lib/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ def getTemplate(self):
def getChannels(self):
return self.channelDATA.get('channels',[])


def getPredefinedChannels(self):
return list([citem for citem in self.getChannels() if citem.get('number') > CHANNEL_LIMIT])


def popChannels(self, type, channels=[]):
return [self.channelDATA['channels'].pop(self.channelDATA['channels'].index(citem)) for citem in list([c for c in channels if c.get('type') == type])]


def getCustom(self):
return list([citem for citem in self.getChannels() if citem.get('number') <= CHANNEL_LIMIT])


def getAutotuned(self):
return list([citem for citem in self.getChannels() if citem.get('number') > CHANNEL_LIMIT])

Expand Down
19 changes: 10 additions & 9 deletions plugin.video.pseudotv.live/resources/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,22 @@
##builder
RULES_ACTION_CHANNEL_VERIFY = 1 #inject citem changes
RULES_ACTION_CHANNEL_START = 2 #pre channel build trigger
RULES_ACTION_CHANNEL_BUILD_START = 3 #ammend citem
RULES_ACTION_CHANNEL_BUILD_START = 3 #amend citem
RULES_ACTION_CHANNEL_BUILD_GLOBAL = 4 #per path global injection trigger
RULES_ACTION_CHANNEL_BUILD_FILELIST_PRE = 5 #inject filelist before multi-path interleaving
RULES_ACTION_CHANNEL_BUILD_FILELIST_POST = 6 #ammend filelist times
RULES_ACTION_CHANNEL_BUILD_FILELIST_POST = 6 #amend filelist times
RULES_ACTION_CHANNEL_BUILD_TIME_PRE = 7 #filelist
RULES_ACTION_CHANNEL_BUILD_TIME_POST = 8 #filelist
RULES_ACTION_CHANNEL_BUILD_STOP = 9 #ammend filelist after scheduling.
RULES_ACTION_CHANNEL_BUILD_STOP = 9 #amend filelist after scheduling.
RULES_ACTION_CHANNEL_STOP = 10 #restore globals before next channel build



##player
RULES_ACTION_PLAYBACK = 11
RULES_ACTION_PLAYER_START = 12
RULES_ACTION_PLAYER_STOP = 13
##overlay
RULES_ACTION_OVERLAY = 21
RULES_ACTION_PLAYER_CHANGE = 13
RULES_ACTION_PLAYER_STOP = 14
##overlay/background
RULES_ACTION_OVERLAY_OPEN = 21
RULES_ACTION_OVERLAY_CLOSE = 22
RULES_ACTION_BACKGROUND_OPEN = 23
RULES_ACTION_BACKGROUND_CLOSE = 24

4 changes: 3 additions & 1 deletion plugin.video.pseudotv.live/resources/lib/context_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def __init__(self, sysARG, listitem):
if not listitem.getPath(): return DIALOG.notificationDialog(LANGUAGE(32030))
with suspendActivity():
if DIALOG.yesnoDialog('Would you like to add:\n[B]%s[/B]\n[B]%s[/B]\nto the first available %s channel?'%(listitem.getLabel(),listitem.getPath(),ADDON_NAME)):
with busy_dialog():

if not isRunning('MANAGER_RUNNING'):
with setRunning('MANAGER_RUNNING'), busy_dialog(), suspendActivity():
manager = Manager("%s.manager.xml"%(ADDON_ID), ADDON_PATH, "default", start=False)
channelData = manager.newChannel
channelData['type'] = 'Custom'
Expand Down
24 changes: 10 additions & 14 deletions plugin.video.pseudotv.live/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
LISTITEMS = DIALOG.listitems
BUILTIN = DIALOG.builtin

@contextmanager
def setRunning(key):
PROPERTIES.setEXTProperty('%s.%s'%(ADDON_ID,key),'true')
try: yield
finally:
PROPERTIES.setEXTProperty('%s.%s'%(ADDON_ID,key),'false')

def isRunning(key):
return PROPERTIES.getEXTProperty('%s.%s'%(ADDON_ID,key)) == 'true'

@contextmanager
def suspendActivity(): #suspend/quit running background task.
while not MONITOR.abortRequested():
Expand All @@ -70,20 +80,6 @@ def isPendingSuspend():
def setPendingSuspend(state=True):
PROPERTIES.setEXTProperty('%s.pendingSuspend'%(ADDON_ID),str(state).lower())

@contextmanager
def open_dialog():
PROPERTIES.setEXTProperty('%s.opendialog'%(ADDON_ID),'true')
try: yield
finally:
PROPERTIES.setEXTProperty('%s.opendialog'%(ADDON_ID),'false')

@contextmanager
def open_window():
PROPERTIES.setEXTProperty('%s.openwindow'%(ADDON_ID),'true')
try: yield
finally:
PROPERTIES.setEXTProperty('%s.openwindow'%(ADDON_ID),'false')

def slugify(s, lowercase=False):
if lowercase: s = s.lower()
s = s.strip()
Expand Down
32 changes: 9 additions & 23 deletions plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,29 +674,15 @@ def cleanProp(pvalue):
return listitem


def buildMenuListItem(self, label1="", label2="", iconImage=None, url="", infoItem=None, artItem=None, propItem=None, oscreen=False, media='video'):
listitem = xbmcgui.ListItem(label1, label2, path=url, offscreen=oscreen)
iconImage = (iconImage or COLOR_LOGO)
if propItem:
listitem.setProperties(propItem)
if infoItem:
if infoItem.get('label'): listitem.setLabel(infoItem.pop('label',''))
if infoItem.get('label2'): listitem.setLabel2(infoItem.pop('label2',''))
infoTag = ListItemInfoTag(listitem, media)
infoTag.set_info(infoItem)
else:
listitem.setLabel(label1)
listitem.setLabel2(label2)
infoTag = ListItemInfoTag(listitem, media)
infoTag.set_info({'mediatype': 'video', 'title' : label1})

if artItem:
listitem.setArt(artItem)
else:
listitem.setArt({'thumb': iconImage,
'logo' : iconImage,
'icon' : iconImage})
return listitem
def buildMenuListItem(self, label1="", label2="", iconImage=None, url="", infoItem={}, artItem={}, propItem={}, oscreen=False, media='video'):
if label1: infoItem['label'] = label1
if label2: infoItem['label2'] = label2
if url: infoItem['file'] = url
if iconImage: artItem = {'thumb': iconImage,'logo' : iconImage,'icon' : iconImage}
item = infoItem.copy()
item['art'] = artItem
item['customproperties'] = propItem
return self.buildItemListItem(item, media, oscreen, playable=False)


class Builtin:
Expand Down
Loading

0 comments on commit 5eebc8b

Please sign in to comment.