Skip to content

Commit

Permalink
v.0.4.2j
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Aug 18, 2023
1 parent 87b0533 commit 6ced252
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 29 deletions.
4 changes: 2 additions & 2 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.2i" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.2j" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="script.module.six" version="1.0.0"/>
Expand All @@ -27,7 +27,7 @@
</item>
<item library="resources/lib/context_record.py" args="del">
<label>30117</label>
<visible>Window.IsVisible(tvrecordings)</visible>
<visible>[Window.IsVisible(tvrecordings)]</visible>
</item>
<item library="resources/lib/context_play.py">
<label>30077</label>
Expand Down
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fcd1f25d71617612b1923d7a4973171e
fbed62e04a4407ac77d12779f53452ab
4 changes: 2 additions & 2 deletions 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.2i" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.2j" name="PseudoTV Live" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="script.module.six" version="1.0.0"/>
Expand All @@ -26,7 +26,7 @@
</item>
<item library="resources/lib/context_record.py" args="del">
<label>30117</label>
<visible>Window.IsVisible(tvrecordings)</visible>
<visible>[Window.IsVisible(tvrecordings)]</visible>
</item>
<item library="resources/lib/context_play.py">
<label>30077</label>
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/autotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def buildAvailableRange(existing):
"radio" : music,
"favorite": True})

match, eitem = self.channels.findAutotune(citem, channels=existingAUTOTUNE)
match, eitem = self.channels.findAutotuned(citem, channels=existingAUTOTUNE)
if match is None:
citem['number'] = next(usesableNUMBERS,0)
citem['id'] = getChannelID(citem['name'],citem['path'],citem['number'])
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 @@ -396,8 +396,8 @@ def buildFileList(self, citem, path, media='video', limit=SETTINGS.getSettingInt
if not sort: sort = osort #add default sorts by db

if not self.incExtras and type.startswith(tuple(TV_TYPES)):
filter.get("and",[]).extend([{"field":"season","operator":"greaterthan","value":"0"},
{"field":"episode","operator":"greaterthan","value":"0"}])
filter.setdefault("and",[]).extend([{"field":"season" ,"operator":"greaterthan","value":"0"},
{"field":"episode","operator":"greaterthan","value":"0"}])

if sort: param["order"] = sort
if filter: param["rules"] = filter
Expand Down Expand Up @@ -494,7 +494,7 @@ def buildList(self, citem, path, media='video', page=SETTINGS.getSettingInt('Pag
episode = int(item.get("episode","0"))
if not file.startswith(tuple(VFS_TYPES)) and not self.incExtras and (season == 0 or episode == 0):
self.pErrors.append('%s Extras'%(LANGUAGE(32027)))
self.log("buildLibraryList, id: %s skipping extras!"%(citem['id']),xbmc.LOGINFO)
self.log("buildList, id: %s skipping extras!"%(citem['id']),xbmc.LOGINFO)
continue

label = tvtitle
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def findChannel(self, citem, channels=[]):
return None, {}


def findAutotune(self, citem, channels=[]):
def findAutotuned(self, citem, channels=[]):
if len(channels) == 0: 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()):
Expand Down
4 changes: 2 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def addWhiteList(self, addonid):
self.log('addWhiteList, addonid = %s'%(addonid))
whiteList = self.getWhiteList()
whiteList.append(addonid)
whiteList = list(set(whiteList))
whiteList = sorted(set(whiteList))
if len(whiteList) > 0: PROPERTIES.setEXTProperty('plugin.video.pseudotv.live.has.WhiteList',len(whiteList) > 0)
return self.setWhiteList(whiteList)

Expand All @@ -418,7 +418,7 @@ def addBlackList(self, addonid):
self.log('addBlackList, addonid = %s'%(addonid))
blackList = self.getBlackList()
blackList.append(addonid)
blackList = list(set(blackList))
blackList = sorted(set(blackList))
return self.setBlackList(blackList)


Expand Down
5 changes: 3 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/m3u.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ def delStation(self, citem):
def delRecording(self, ritem):
self.log('delRecording id = %s'%((ritem.get('id') or ritem.get('label'))))
idx, line = self.findRecording(ritem)
if idx is not None:self.M3UDATA['recordings'].pop(idx)
return self._save()
if idx is not None:
self.M3UDATA['recordings'].pop(idx)
return self._save()


def getRecordItem(self, fitem):
Expand Down
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def buildChannelItem(self, channelData, selkey='path'):
value = channelData.get(key)
if key in ["number","type","logo","id","catchup"]: continue # keys to ignore, internal use only.
elif isinstance(value,list):
if key == "group" : value = ' / '.join(list(set(value)))
if key == "group" : value = ' / '.join(sorted(set(value)))
elif key == "path" : value = '|'.join(value)
elif isinstance(value,bool): value = str(value)
if not value: value = ''
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def getLocalLogo(self, chname, select=False):

def getLogoResources(self, chname, type, select=False):
self.log('getLogoResources, chname = %s, type = %s'%(chname, type))
resources = SETTINGS.getSetting('Resource_Logos').split('|')
resources = SETTINGS.getSetting('Resource_Logos').split('|').copy()
if type in ["TV Genres","Movie Genres"]:
resources.extend(GENRE_RESOURCE)
elif type in ["TV Networks","Movie Studios"]:
Expand All @@ -79,12 +79,12 @@ def getLogoResources(self, chname, type, select=False):
resources.extend(GENRE_RESOURCE)
resources.extend(STUDIO_RESOURCE)
resources.extend(MUSIC_RESOURCE)

logos = []
cacheName = 'getLogoResources.%s.%s'%(getMD5(chname),select)
cacheResponse = self.cache.get(cacheName, checksum=getMD5('|'.join(resources)))
if not cacheResponse:
for id in list(set(resources)):
for id in list(dict.fromkeys(resources)):
if MONITOR.waitForAbort(0.001):
self.log('getLogoResources, waitForAbort')
break
Expand Down
22 changes: 11 additions & 11 deletions plugin.video.pseudotv.live/resources/lib/xmltvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,13 @@ def loadStopTimes(self, channels=None, programmes=None, fallback=None):
if channels is None: channels = self.getChannels()
if programmes is None: programmes = self.getProgrammes()
if fallback is None: fallback = datetime.datetime.fromtimestamp(roundTimeDown(getLocalTime(),offset=60)).strftime(DTFORMAT)

for channel in channels:
try:
stopTimes = [program['start'] for program in programmes if program['channel'] == channel['id']]
firstStop = min(stopTimes, default=fallback)
lastStop = max(stopTimes, default=fallback)
self.log('loadStopTimes, channel = %s, first-stop = %s, last-stop = %s, fallback = %s'%(channel['id'],firstStop,lastStop,fallback))
if firstStop > fallback: raise Exception('First stop-time in future, rebuild channel with fallback')
firstStart = min([program['start'] for program in programmes if program['channel'] == channel['id']], default=fallback)
lastStop = max([program['stop'] for program in programmes if program['channel'] == channel['id']], default=fallback)
self.log('loadStopTimes, channel = %s, first-start = %s, last-stop = %s, fallback = %s'%(channel['id'],firstStart,lastStop,fallback))
if firstStart > fallback: raise Exception('First start-time in the future, rebuild channel with fallback')
yield channel['id'],datetime.datetime.timestamp(strpTime(lastStop, DTFORMAT))
except Exception as e:
self.log("loadStopTimes, channel = %s failed!\nMalformed XMLTV channel/programmes %s! rebuilding channel with default stop-time %s"%(channel.get('id'),e,fallback), xbmc.LOGWARNING)
Expand Down Expand Up @@ -186,7 +185,7 @@ def cleanChannels(self, channels, programmes): # remove stations with no guideda

def cleanProgrammes(self, programmes): # remove expired content, ignore "recordings" ie. media=True
try:
now = (datetime.datetime.fromtimestamp(float(getLocalTime()))) - datetime.timedelta(days=SETTINGS.getSettingInt('Min_Days')) #allow some old programmes to avoid empty cells.
now = (datetime.datetime.fromtimestamp(float(getLocalTime())) - datetime.timedelta(days=SETTINGS.getSettingInt('Min_Days'))) #allow some old programmes to avoid empty cells.
tmpProgrammes = [program for program in programmes if (strpTime(program['stop'].rstrip(),DTFORMAT) > now)]
except Exception as e:
self.log("cleanProgrammes, Failed! %s"%(e), xbmc.LOGERROR)
Expand Down Expand Up @@ -338,10 +337,11 @@ def delRecording(self, ritem):
recordings = self.XMLTVDATA['recordings'].copy()
programmes = self.XMLTVDATA['programmes'].copy()
idx, recording = self.findRecording(ritem)
if idx is not None: self.XMLTVDATA['recordings'].pop(idx)
if not ritem.get('id'): ritem['id'] = recording['id']
self.XMLTVDATA['programmes'] = list([program for program in programmes if program.get('channel') != ritem.get('id')])
return self._save()
if idx is not None:
self.XMLTVDATA['recordings'].pop(idx)
if not ritem.get('id'): ritem['id'] = recording['id']
self.XMLTVDATA['programmes'] = list([program for program in programmes if program.get('channel') != ritem.get('id')])
return self._save()


def importXMLTV(self, file, m3uChannels={}):
Expand Down
Binary file not shown.

0 comments on commit 6ced252

Please sign in to comment.