Skip to content

Commit

Permalink
v.0.4.3a
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Oct 12, 2023
1 parent 05de835 commit 0e33526
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 53 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
*.db
*.pyc
plugin.video.pseudotv.live/remotes/genres.json
plugin.video.pseudotv.live/.idea/vcs.xml
plugin.video.pseudotv.live/.idea/inspectionProfiles/profiles_settings.xml
plugin.video.pseudotv.live/.idea/misc.xml
plugin.video.pseudotv.live/.idea/modules.xml
plugin.video.pseudotv.live/.idea/plugin.video.pseudotv.live.iml
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.3" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.3a" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="pvr.iptvsimple" version="7.5.0"/>
Expand Down
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a874e1c4ddf53dbb2ca37ea62f40c634
3233466be841ccf1242f0b31a21f9160
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.3" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.3a" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="pvr.iptvsimple" version="7.5.0"/>
Expand Down
9 changes: 5 additions & 4 deletions plugin.video.pseudotv.live/resources/lib/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def getType(self, type):

def setChannels(self, channels=None):
if channels is None: channels = self.channelDATA['channels']
else: self.channelDATA['channels'] = channels
SETTINGS.setSetting('Select_Channels','[B]%s[/B] Channels'%(len(channels)))
return self._save()

Expand Down Expand Up @@ -124,16 +125,16 @@ def addChannel(self, citem):
return True


def findChannel(self, citem, channels=[]):
if len(channels) == 0: channels = self.getChannels()
def findChannel(self, citem, channels=None):
if channels is None: channels = self.getChannels()
for idx, eitem in enumerate(channels):
if citem.get('id') == eitem.get('id',str(random.random())):
return idx, eitem
return None, {}


def findAutotuned(self, citem, channels=[]):
if len(channels) == 0: channels = self.getAutotuned()
def findAutotuned(self, citem, channels=None):
if channels is None: channels = self.getAutotuned()
for idx, eitem in enumerate(channels):
if (citem.get('id') == eitem.get('id',str(random.random()))) or (citem.get('type') == eitem.get('type',str(random.random())) and citem.get('name').lower() == eitem.get('name',str(random.random())).lower()):
return idx, eitem
Expand Down
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,8 +26,8 @@ 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)):
manager = Manager("%s.manager.xml"%(ADDON_ID), ADDON_PATH, "default", start=False)
with busy_dialog():
manager = Manager("%s.manager.xml"%(ADDON_ID), ADDON_PATH, "default", start=False)
channelData = manager.newChannel
channelData['type'] = 'Custom'
channelData['favorite'] = True
Expand All @@ -40,6 +40,8 @@ def __init__(self, sysARG, listitem):
manager.channels.addChannel(channelData)
manager.channels.setChannels()
forceUpdateTime('updateChannels')
manager.closeManager()
del manager
manager = Manager("%s.manager.xml"%(ADDON_ID), ADDON_PATH, "default", channel=channelData['number'])
del manager

Expand Down
86 changes: 43 additions & 43 deletions plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,40 +93,39 @@ def __init__(self, *args, **kwargs):
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
if isClient():
DIALOG.notificationDialog(LANGUAGE(32058))
return openAddonSettings(0,1)
return openAddonSettings((0,1))
elif isManagerRunning():
DIALOG.notificationDialog(LANGUAGE(32057)%(LANGUAGE(30107)))
return openAddonSettings(0,1)

with busy_dialog():
setManagerRunning(True)
self.cntrlStates = {}
self.showingList = True
self.startChannel = kwargs.get('channel',-1)
self.log('Manager, startChannel = %s'%(self.startChannel))

self.cache = Cache(mem_cache=True)
self.channels = Channels()
self.jsonRPC = JSONRPC()
self.rules = RulesList()
self.xsp = XSP()
self.m3u = M3U()
self.resources = Resources(self.jsonRPC, self.cache)

self.newChannel = self.channels.getTemplate()
self.channelList = sorted(self.createChannelList(self.buildArray(), self.channels.getChannels()), key=lambda k: k['number'])
self.channelList.extend(self.channels.getPredefinedChannels())
self.newChannels = self.channelList.copy()

if self.startChannel == -1: self.startChannel = self.getFirstAvailChannel()
self.focusIndex = (self.startChannel - 1) #Convert from Channel number to array index

try:
if not kwargs.get('start',True): raise Exception('Bypassed doModal')
self.doModal()
except Exception as e:
self.log('Manager failed! %s'%(e), xbmc.LOGERROR)
self.closeManager()
return openAddonSettings((0,1))
else:
with busy_dialog():
self.cntrlStates = {}
self.showingList = True
self.startChannel = kwargs.get('channel',-1)
self.log('Manager, startChannel = %s'%(self.startChannel))

self.cache = Cache(mem_cache=True)
self.channels = Channels()
self.jsonRPC = JSONRPC()
self.rules = RulesList()
self.xsp = XSP()
self.m3u = M3U()
self.resources = Resources(self.jsonRPC, self.cache)

self.newChannel = self.channels.getTemplate()
self.channelList = sorted(self.createChannelList(self.buildArray(), self.channels.getChannels()), key=lambda k: k['number'])
self.channelList.extend(self.channels.getPredefinedChannels())
self.newChannels = self.channelList.copy()

if self.startChannel == -1: self.startChannel = self.getFirstAvailChannel()
self.focusIndex = (self.startChannel - 1) #Convert from Channel number to array index

try:
if kwargs.get('start',True):
self.doModal()
except Exception as e:
self.log('Manager failed! %s'%(e), xbmc.LOGERROR)
self.closeManager()


def log(self, msg, level=xbmc.LOGDEBUG):
Expand All @@ -135,6 +134,7 @@ def log(self, msg, level=xbmc.LOGDEBUG):

def onInit(self):
try:
setManagerRunning(True)
self.spinner = self.getControl(4)
self.chanList = self.getControl(5)
self.itemList = self.getControl(6)
Expand Down Expand Up @@ -628,18 +628,18 @@ def saveChannels(self):
difference = sorted(diffLSTDICT(self.channelList,self.newChannels), key=lambda k: k['number'])
self.log('saveChannels, difference = %s\n%s'%(len(difference),difference))

pDialog = DIALOG.progressDialog(message=LANGUAGE(32075))
for idx, citem in enumerate(difference):
print(idx,citem,citem in self.channelList,citem in self.newChannels)
pDialog = DIALOG.progressDialog(int(((idx + 1)*100)//len(difference)),pDialog,message="%s: %s"%(LANGUAGE(32074),citem.get('name')),header='%s, %s'%(ADDON_NAME,LANGUAGE(30152)))
#remove abandoned or stale settings.
if citem in self.channelList:
self.channels.delChannel(citem)
#add new or updated settings
elif citem in self.newChannels:
self.channels.addChannel(citem)
# pDialog = DIALOG.progressDialog(message=LANGUAGE(32075))
# for idx, citem in enumerate(difference):
# print(idx,citem,citem in self.channelList,citem in self.newChannels)
# pDialog = DIALOG.progressDialog(int(((idx + 1)*100)//len(difference)),pDialog,message="%s: %s"%(LANGUAGE(32074),citem.get('name')),header='%s, %s'%(ADDON_NAME,LANGUAGE(30152)))
# #remove abandoned or stale settings.
# if citem in self.channelList:
# self.channels.delChannel(citem)
# #add new or updated settings
# elif citem in self.newChannels:
# self.channels.addChannel(citem)

self.channels.setChannels()
self.channels.setChannels(self.newChannels)
self.toggleSpinner(self.chanList,False)
self.closeManager()

Expand Down
2 changes: 0 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,6 @@ def _stop(self):
self._server.socket.close()
if self._httpd_thread.is_alive():
self._httpd_thread.join(5.5)
if self.startThread.is_alive():
self.startThread.join(5.5)
except Exception as e: self.log("_stop, Failed! %s"%(e), xbmc.LOGERROR)
self.isRunning = False

Expand Down
Binary file not shown.

0 comments on commit 0e33526

Please sign in to comment.