Skip to content

Commit

Permalink
v.0.5.5q
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Nov 8, 2024
1 parent f6d8c10 commit 96e1128
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 93 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.5.5p" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5q" 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 @@
3707cd412e91581ee8ddaf91d43d7f60
439e959c7b0a51883c3b9a7962567040
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.5.5p" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.5q" 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
Original file line number Diff line number Diff line change
Expand Up @@ -1507,27 +1507,27 @@ msgid "Dynamic SmartPlaylist"
msgstr ""

msgctxt "#32196"
msgid "Video Library"
msgid "Video"
msgstr ""

msgctxt "#32197"
msgid ""
msgstr ""

msgctxt "#32198"
msgid "File Folders"
msgid "All"
msgstr ""

msgctxt "#32199"
msgid "Local Folders"
msgid "Local"
msgstr ""

msgctxt "#32200"
msgid "Network Folders"
msgid "Shared"
msgstr ""

msgctxt "#32201"
msgid "Pictures Sources"
msgid "Image Sources"
msgstr ""

msgctxt "#32202"
Expand All @@ -1543,7 +1543,7 @@ msgid "Basic Playlist"
msgstr ""

msgctxt "#32207"
msgid "Music Library"
msgid "Music"
msgstr ""

msgctxt "#32208"
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def build(self):
elif self.service._suspend():
channels.insert(idx,citem)
self.pDialog = DIALOG.progressBGDialog(self.pCount, self.pDialog, message='%s: %s'%(LANGUAGE(32144),LANGUAGE(32145)), header=ADDON_NAME)
self.service.monitor.waitForAbort(EPOCH_TIMER)
self.service.monitor.waitForAbort(SUSPEND_TIMER)
continue
else:
self.pMSG = '%s: %s'%(LANGUAGE(32144),LANGUAGE(32212))
Expand Down
3 changes: 2 additions & 1 deletion plugin.video.pseudotv.live/resources/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
#constants
DISCOVERY_TIMER = 60 #secs
EPOCH_TIMER = 15 #secs
DISCOVER_INTERVAL = 30 #secs
SUSPEND_TIMER = 15 #secs
DISCOVER_INTERVAL = 30 #secs
EPG_DURATION = 10800 #secs
DTFORMAT = '%Y%m%d%H%M%S'
DTZFORMAT = '%Y%m%d%H%M%S +%z'
Expand Down
14 changes: 8 additions & 6 deletions plugin.video.pseudotv.live/resources/lib/cqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ def _push(self, package: tuple, priority: int=0, delay: int=0):
node = LlNode(package, priority, delay)
if self.__exists((1,priority,package)): self.log("_push, func = %s exists; ignoring package"%(package[0].__name__))
elif self.priority:
self.qsize += 1
item = (priority, package)
self.itemCount[priority] += 1
self.log("_push, func = %s, priority = %s"%(package[0].__name__,priority))
heapq.heappush(self.min_heap, (item[0], self.itemCount[priority], item[1]))
try:
self.qsize += 1
item = (priority, package)
self.itemCount[priority] += 1
self.log("_push, func = %s, priority = %s"%(package[0].__name__,priority))
heapq.heappush(self.min_heap, (item[0], self.itemCount[priority], item[1]))
except Exception as e: self.log("_push, func = %s failed! %s"%(func.__name__,e), xbmc.LOGFATAL)
elif self.head:
self.tail.next = node
node.prev = self.tail
Expand All @@ -114,7 +116,7 @@ def __pop(self):
break
elif self.service._interrupt() or self.service._suspend():
self.log("__pop, _interrupt/_suspend")
self.service.monitor.waitForAbort(EPOCH_TIMER)
self.service.monitor.waitForAbort(SUSPEND_TIMER)
continue
elif not self.head and not self.priority:
self.log("__pop, The queue is empty!")
Expand Down
69 changes: 35 additions & 34 deletions plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,9 @@ def getCRC32(text):
return binascii.crc32(text.encode('utf8'))

class Settings:
#Kodi often breaks settings API with changes between versions. Stick with core setsettings/getsettings to avoid specifics; that may break.
def __init__(self):
self.cacheDB = Cache()
self.cache = Cache(mem_cache=True)
self.property = Properties()


def log(self, msg, level=xbmc.LOGDEBUG):
Expand All @@ -147,7 +145,7 @@ def __match(label):
for item in items:
if item.get('label','').lower().startswith(instance.lower()): return item

with Builtin().busy_dialog():
with self.builtin.busy_dialog():
from jsonrpc import JSONRPC
jsonRPC = JSONRPC()
baseURL = 'pvr://channels/tv/'
Expand All @@ -157,8 +155,8 @@ def __match(label):
del jsonRPC
if not item: item = {'file':baseURL}
self.log('openGuide, opening %s'%(item.get('file',baseURL)))
Builtin().executebuiltin("Dialog.Close(all)")
Builtin().executebuiltin("ReplaceWindow(TVGuide,%s)"%(item.get('file',baseURL)))
self.builtin.executebuiltin("Dialog.Close(all)")
self.builtin.executebuiltin("ReplaceWindow(TVGuide,%s)"%(item.get('file',baseURL)))


def openSettings(self):
Expand Down Expand Up @@ -322,10 +320,10 @@ def getBonjour(self, inclChannels=False):
'uuid' :self.getMYUUID(),
'version' :ADDON_VERSION,
'machine' :platform.machine(),
'platform':Builtin().getInfoLabel('OSVersionInfo','System'),
'build' :Builtin().getInfoLabel('BuildVersion','System'),
'platform':self.builtin.getInfoLabel('OSVersionInfo','System'),
'build' :self.builtin.getInfoLabel('BuildVersion','System'),
'name' :self.getFriendlyName(),
'host' :self.property.getRemoteURL()}
'host' :self.property.getRemoteHost()}

payload['remotes'] = {'bonjour':'http://%s/%s'%(payload['host'],BONJOURFLE),
'remote' :'http://%s/%s'%(payload['host'],REMOTEFLE),
Expand Down Expand Up @@ -454,7 +452,7 @@ def hasPVRInstance(self, instance=ADDON_NAME):

def setPVRInstance(self, instance=ADDON_NAME):
# todo https://github.com/xbmc/xbmc/pull/23648
if not self.getSettingBool('Enable_PVR_SETTINGS'): Dialog().notificationDialog(LANGUAGE(32186))
if not self.getSettingBool('Enable_PVR_SETTINGS'): self.dialog.notificationDialog(LANGUAGE(32186))
elif not FileAccess.exists(os.path.join(PVR_CLIENT_LOC,'settings.xml')):
self.log('setPVRInstance, creating missing default settings.xml')
return self.chkPluginSettings(PVR_CLIENT_ID,self.IPTV_SIMPLE_SETTINGS(),False)
Expand Down Expand Up @@ -601,14 +599,14 @@ def getInstanceID(self):
return instanceID


def getRemoteURL(self):
remote = self.getProperty('%s.Remote_URL'%(ADDON_ID))
if not remote: remote = self.setRemoteURL(Settings().getSettingInt('TCP_PORT'))
def getRemoteHost(self):
remote = self.getProperty('%s.Remote_Host'%(ADDON_ID))
if not remote: remote = self.setRemoteHost('%s:%s'%(getIP(),Settings().getSettingInt('TCP_PORT')))
return remote


def setRemoteURL(self, value):
return self.setProperty('%s.Remote_URL'%(ADDON_ID),value)
def setRemoteHost(self, value):
return self.setProperty('%s.Remote_Host'%(ADDON_ID),value)


def hasFirstrun(self):
Expand Down Expand Up @@ -1065,7 +1063,9 @@ class Dialog:
builtin = Builtin()

def __init__(self):
self.settings.dialog = self
self.settings.dialog = self
self.settings.property = self.properties
self.settings.builtin = self.builtin


def log(self, msg, level=xbmc.LOGDEBUG):
Expand Down Expand Up @@ -1316,7 +1316,7 @@ def __buildMenuItem(option):
def __importSTRM(strm):
try:
with self.builtin.busy_dialog():
fle = FileAccess.open(strm,'r')
fle = FileAccess.open(strm,'r')
paths = [line for line in fle.readlines() if not line.startswith('#') and '://' in line]
fle.close()
select = self.selectDialog(paths, LANGUAGE(32080), useDetails=False, multi=False)
Expand All @@ -1326,19 +1326,20 @@ def __importSTRM(strm):

with self.builtin.busy_dialog():
if prompt:
opts = [{"label":LANGUAGE(32196), "label2":"library://video/" , "default":"library://video/" , "shares":"video" , "mask":xbmc.getSupportedMedia('video') , "type":0 , "multi":multi},
{"label":LANGUAGE(32207), "label2":"library://music/" , "default":"library://music/" , "shares":"music" , "mask":xbmc.getSupportedMedia('music') , "type":0 , "multi":multi},
{"label":LANGUAGE(32201), "label2":"Images" , "default":"" , "shares":"pictures", "mask":xbmc.getSupportedMedia('picture') , "type":1 , "multi":False},
{"label":LANGUAGE(32194), "label2":"Import paths from STRM" , "default":"" , "shares":"files" , "mask":".strm" , "type":1 , "multi":False},
{"label":LANGUAGE(32191), "label2":"special://profile/playlists/video/" , "default":"special://profile/playlists/video/" , "shares":"" , "mask":".xsp" , "type":1 , "multi":False},
{"label":LANGUAGE(32192), "label2":"special://profile/playlists/music/" , "default":"special://profile/playlists/music/" , "shares":"" , "mask":".xsp" , "type":1 , "multi":False},
{"label":LANGUAGE(32193), "label2":"special://profile/playlists/mixed/" , "default":"special://profile/playlists/mixed/" , "shares":"" , "mask":".xsp" , "type":1 , "multi":False},
{"label":LANGUAGE(32195), "label2":"Create Dynamic Smartplaylist" , "default":"" , "shares":"" , "mask":"" , "type":1 , "multi":False},
{"label":LANGUAGE(32206), "label2":".cue,.m3u,.m3u8,.strm,.pls,.wpl" , "default":"" , "shares":"" , "mask":"|".join(ALT_PLAYLISTS) , "type":1 , "multi":False},
{"label":LANGUAGE(32198), "label2":"All Folders & Files" , "default":"" , "shares":"files" , "mask":mask , "type":type , "multi":multi},
{"label":LANGUAGE(32199), "label2":"Local Folders & Files" , "default":"" , "shares":"local" , "mask":mask , "type":type , "multi":multi},
{"label":LANGUAGE(32200), "label2":"Local Drives and Network Share" , "default":"" , "shares":shares , "mask":mask , "type":type , "multi":multi},
{"label":LANGUAGE(32202), "label2":"resource://" , "default":"resource://" , "shares":shares , "mask":mask , "type":type , "multi":multi}]
optlabel = "%s"%({'0':'Folders','1':'Files'}[str(type)]) if multi else "%s"%({'0':'Folder','1':'File'}[str(type)])
opts = [{"label":'%s %s'%(LANGUAGE(32196),optlabel), "label2":"library://video/" , "default":"library://video/" , "shares":"video" , "mask":xbmc.getSupportedMedia('video') , "type":0 , "multi":multi},
{"label":'%s %s'%(LANGUAGE(32207),optlabel), "label2":"library://music/" , "default":"library://music/" , "shares":"music" , "mask":xbmc.getSupportedMedia('music') , "type":0 , "multi":multi},
{"label":LANGUAGE(32191) , "label2":"special://profile/playlists/video/" , "default":"special://profile/playlists/video/" , "shares":"" , "mask":".xsp" , "type":1 , "multi":False},
{"label":LANGUAGE(32192) , "label2":"special://profile/playlists/music/" , "default":"special://profile/playlists/music/" , "shares":"" , "mask":".xsp" , "type":1 , "multi":False},
{"label":LANGUAGE(32193) , "label2":"special://profile/playlists/mixed/" , "default":"special://profile/playlists/mixed/" , "shares":"" , "mask":".xsp" , "type":1 , "multi":False},
{"label":LANGUAGE(32195) , "label2":"Create Dynamic Smartplaylist" , "default":"" , "shares":"" , "mask":"" , "type":1 , "multi":False},
{"label":LANGUAGE(32194) , "label2":"Import directory paths from STRM" , "default":"" , "shares":"files" , "mask":".strm" , "type":1 , "multi":False},
{"label":LANGUAGE(32206) , "label2":"Media from basic playlists" , "default":"" , "shares":"" , "mask":"|".join(ALT_PLAYLISTS) , "type":1 , "multi":False},
{"label":'%s %s'%(LANGUAGE(32198),optlabel), "label2":"" , "default":"" , "shares":"files" , "mask":mask , "type":type , "multi":multi},
{"label":'%s %s'%(LANGUAGE(32199),optlabel), "label2":"" , "default":"" , "shares":"local" , "mask":mask , "type":type , "multi":multi},
{"label":'%s %s'%(LANGUAGE(32200),optlabel), "label2":"" , "default":"" , "shares":shares , "mask":mask , "type":type , "multi":multi},
{"label":LANGUAGE(32201) , "label2":"" , "default":"" , "shares":"pictures", "mask":xbmc.getSupportedMedia('picture') , "type":1 , "multi":False},
{"label":LANGUAGE(32202) , "label2":"resource://" , "default":"resource://" , "shares":shares , "mask":mask , "type":type , "multi":multi}]

if isinstance(exclude,list): options = [opt for opt in opts if not opt.get('label') in exclude]
else: options = opts
Expand Down Expand Up @@ -1564,18 +1565,18 @@ def getValue(self, params={}, rule={}):
# "album" : (self.selectDialog,jsonRPC.getAlbums),
# "studio" : (self.selectDialog,(jsonRPC.getMovieStudios,jsonRPC.getNetworks))}

def getInput(): return self.inputDialog("Enter Value\nSeparate by ',' ex. Action,Comedy",','.join([unquoteString(value) for value in rule.get('value',[])]))
def getBrowse(): return self.browseDialog(default='|'.join([unquoteString(value) for value in rule.get('value',[])]))
def getSelect(): return self.notificationDialog(LANGUAGE(32020))
def __getInput(): return self.inputDialog("Enter Value\nSeparate by ',' ex. Action,Comedy",','.join([unquoteString(value) for value in rule.get('value',[])]))
def __getBrowse(): return self.browseDialog(default='|'.join([unquoteString(value) for value in rule.get('value',[])]))
def __getSelect(): return self.notificationDialog(LANGUAGE(32020))
enumLST = sorted(['Enter', 'Browse', 'Select'])
enumKEY = {'Enter':{'func':getInput},'Browse':{'func':getBrowse},'Select':{'func':getSelect}}
enumKEY = {'Enter':{'func':__getInput},'Browse':{'func':__getBrowse},'Select':{'func':__getSelect}}
enumSEL = self.selectDialog(enumLST,header="Select Input",useDetails=False, multi=False)
if not enumSEL is None: return [quoteString(value) for value in (enumKEY[enumLST[enumSEL]].get('func')()).split(',')]


@contextmanager
def sudo_dialog(self, msg):
dia = self.progressBGDialog((int(time.time()) % 60),Dialog().progressBGDialog(message=msg))
dia = self.progressBGDialog((int(time.time()) % 60),self.progressBGDialog(message=msg))
try:
yield
finally:
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _fill(type, func):
__clear()

complete = True
self.parserDialog = DIALOG.progressBGDialog()
self.parserDialog = DIALOG.progressBGDialog(header='%s, %s'%(ADDON_NAME,LANGUAGE(32041)))

types = AUTOTUNE_TYPES
for idx, type in enumerate(types):
Expand All @@ -141,7 +141,7 @@ def _fill(type, func):
break
elif self.service._suspend():
types.insert(idx,type)
self.service.monitor.waitForAbort(EPOCH_TIMER)
self.service.monitor.waitForAbort(SUSPEND_TIMER)
continue
else:
msg = LANGUAGE(30014)
Expand All @@ -151,7 +151,7 @@ def _fill(type, func):
if not items: msg = LANGUAGE(32022)
self.parserMSG = AUTOTUNE_TYPES[idx]
self.parserCount = int(idx*100//len(AUTOTUNE_TYPES))
self.parserDialog = DIALOG.progressBGDialog(self.parserCount,self.parserDialog,self.parserMSG,'%s, %s'%(ADDON_NAME,'%s %s'%(msg,LANGUAGE(32041))))
self.parserDialog = DIALOG.progressBGDialog(self.parserCount,self.parserDialog,self.parserMSG,header='%s, %s'%(ADDON_NAME,'%s %s'%(msg,LANGUAGE(32041))))
if not items: items = _fill(type, func)
self.setLibrary(type, [__update(type,item) for item in items])

Expand Down
Loading

0 comments on commit 96e1128

Please sign in to comment.