Skip to content

Commit

Permalink
v.0.4.8d
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Apr 3, 2024
1 parent 3d8531b commit 55ca423
Show file tree
Hide file tree
Showing 18 changed files with 144 additions and 108 deletions.
8 changes: 4 additions & 4 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.8c" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.8d" 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 Expand Up @@ -29,11 +29,11 @@
<menu id="kodi.core.main">
<item library="resources/lib/context_record.py" args="add">
<label>30115</label>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
</item>
<item library="resources/lib/context_record.py" args="del">
<label>30117</label>
<visible>[Window.IsVisible(tvrecordings)]</visible>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.Path] + [Window.IsVisible(tvrecordings)]</visible>
</item>
<item library="resources/lib/context_play.py" args="playlist">
<label>30076</label>
Expand All @@ -45,7 +45,7 @@
</item>
<item library="resources/lib/context_info.py" args="match">
<label>30091</label>
<visible>[ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
</item>
<item library="resources/lib/context_info.py" args="browse">
<label>30087</label>
Expand Down
2 changes: 1 addition & 1 deletion addons.xml.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
110e17d5396279c111dc4d6c81908d1d
3d4ddd682a399fe0704ef641e30f68f6
8 changes: 4 additions & 4 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.8c" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.4.8d" 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 Expand Up @@ -28,11 +28,11 @@
<menu id="kodi.core.main">
<item library="resources/lib/context_record.py" args="add">
<label>30115</label>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
</item>
<item library="resources/lib/context_record.py" args="del">
<label>30117</label>
<visible>[Window.IsVisible(tvrecordings)]</visible>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.Path] + [Window.IsVisible(tvrecordings)]</visible>
</item>
<item library="resources/lib/context_play.py" args="playlist">
<label>30076</label>
Expand All @@ -44,7 +44,7 @@
</item>
<item library="resources/lib/context_info.py" args="match">
<label>30091</label>
<visible>[ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
<visible>[String.Contains(ListItem.Plot,"item=") + ListItem.HasEpg] + [Window.IsVisible(tvguide)|Window.IsVisible(tvsearch)|Window.IsVisible(tvchannels)]</visible>
</item>
<item library="resources/lib/context_info.py" args="browse">
<label>30087</label>
Expand Down
2 changes: 2 additions & 0 deletions plugin.video.pseudotv.live/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
v.0.4.9
-Fixed seasons returning incorrect holiday for the first week of April.
-Fixed seasonal logos disappearing.
-Improved playback error detection.

v.0.4.8
-Notice The following steps are required!.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ msgid "Player will be stop!"
msgstr ""

msgctxt "#32129"
msgid "Error detected! %s is out of sync with Kodi."
msgid "Error detected! %s is out of sync with Kodi.\nTry clearing Kodi's PVR & LiveTV guide data."
msgstr ""

msgctxt "#32130"
Expand Down
2 changes: 2 additions & 0 deletions plugin.video.pseudotv.live/resources/lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from m3u import M3U
from fillers import Fillers
from resources import Resources
from seasonal import Seasonal

class Builder:
loopback = {}
Expand Down Expand Up @@ -92,6 +93,7 @@ def verify(self, channels=None):
self.log('verify, skipping - missing channel id\n%s'%(citem))
continue
else:
citem['logo'] = self.resources.getLogo(citem['name'],citem['type'],logo=Seasonal().getHoliday().get('logo') if citem['name'] == LANGUAGE(32002) else None)
self.log('verify, channel %s: %s - %s'%(citem['number'],citem['name'],citem['id']))
yield self.runActions(RULES_ACTION_CHANNEL_VERIFY, citem, citem, inherited=self)

Expand Down
1 change: 1 addition & 0 deletions plugin.video.pseudotv.live/resources/lib/context_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self, sysARG, listitem):
channelData['type'] = 'Custom'
channelData['favorite'] = True
channelData['number'] = manager.getFirstAvailChannel()
channelData['radio'] = True if listitem.getPath().startswith('musicdb://') else False
channelData['name'], channelData = manager.validateLabel(cleanLabel(listitem.getLabel()),channelData)
path, channelData = manager.validatePath(listitem.getPath(),channelData,spinner=False)
if path is None: return
Expand Down
28 changes: 11 additions & 17 deletions plugin.video.pseudotv.live/resources/lib/context_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,41 @@
from xmltvs import XMLTVS

class Record:
def __init__(self, sysARG, listitem, plot):
log('Record: __init__, sysARG = %s, plot = %s\npath = %s'%(sysARG,plot,listitem.getPath()))
def __init__(self, sysARG, listitem, fitem):
log('Record: __init__, sysARG = %s, fitem = %s\npath = %s'%(sysARG,fitem,listitem.getPath()))
self.sysARG = sysARG
self.plot = plot
self.fitem = fitem
self.listitem = listitem


def add(self):
with suspendActivity():
self.plot['label'] = (self.plot.get('label') or self.listitem.getLabel())
self.fitem['label'] = (self.fitem.get('label') or self.listitem.getLabel())
m3u = M3U()
ritem = m3u.getRecordItem(self.plot)
ritem = m3u.getRecordItem(self.fitem)
if DIALOG.yesnoDialog('Would you like to add:\n[B]%s[/B]\nto recordings?'%(ritem['label'])):
with busy_dialog():
xmltv = XMLTVS()
if m3u.addRecording(ritem) and xmltv.addRecording(ritem,self.plot):
if (m3u.addRecording(ritem) and XMLTVS().addRecording(ritem,self.fitem)):
DIALOG.notificationWait('%s\n%s'%(ritem['label'],LANGUAGE(30116)),wait=2)
del xmltv
del m3u


def remove(self):
with suspendActivity():
self.plot['label'] = (self.plot.get('label') or self.listitem.getLabel())
self.fitem['label'] = (self.fitem.get('label') or self.listitem.getLabel())
m3u = M3U()
ritem = m3u.getRecordItem(self.plot)
ritem = m3u.getRecordItem(self.fitem)
if DIALOG.yesnoDialog('Would you like to remove:\n[B]%s[/B]\nfrom recordings?'%(ritem['label'])):
with busy_dialog():
xmltv = XMLTVS()
if m3u.delRecording(ritem) and xmltv.delRecording(ritem):
if (m3u.delRecording(ritem) and XMLTVS().delRecording(ritem)):
DIALOG.notificationWait('%s\n%s'%(ritem['label'],LANGUAGE(30118)),wait=2)
del xmltv
del m3u


if __name__ == '__main__':
try: param = sys.argv[1]
except: param = None
log('Record: __main__, param = %s'%(param))
if param == 'add':
Record(sys.argv,listitem=sys.listitem,plot=decodePlot(BUILTIN.getInfoLabel('Plot'))).add()
elif param == 'del':
Record(sys.argv,listitem=sys.listitem,plot=decodePlot(BUILTIN.getInfoLabel('Plot'))).remove()
if param == 'add': Record(sys.argv,listitem=sys.listitem,fitem=decodePlot(BUILTIN.getInfoLabel('Plot'))).add()
elif param == 'del': Record(sys.argv,listitem=sys.listitem,fitem=decodePlot(BUILTIN.getInfoLabel('Plot'))).remove()

4 changes: 2 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/fillers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def getTrailers(self, keys=['resources'], count=1):
except: return [(None, 0)]


def buildKodiTrailers(self, fileList):
def buildTrailers(self, fileList):
def _parse(fileItem):
if fileItem.get('trailer') and not fileItem.get('trailer','').startswith(('http','upnp','ftp')):
dur = self.jsonRPC.getDuration(fileItem.get('trailer'), accurate=True)
Expand All @@ -179,7 +179,7 @@ def injectBCTs(self, citem, fileList):
nfileList = []
if self.bctTypes['trailers']['enabled'] and SETTINGS.getSettingInt('Include_Trailers') < 2:
if self.builder.pDialog: self.builder.pDialog = DIALOG.progressBGDialog(self.builder.pCount, self.builder.pDialog, message='%s - Parsing Kodi for Trailers...'%(self.builder.pName),header='%s, %s'%(ADDON_NAME,self.builder.pMSG))
self.buildKodiTrailers(fileList)
if len(fileList) > 0: self.buildTrailers(fileList)

for idx, fileItem in enumerate(fileList):
if not fileItem: continue
Expand Down
5 changes: 5 additions & 0 deletions plugin.video.pseudotv.live/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,3 +612,8 @@ def hasFile(file):
def timeString2Seconds(string): #hh:mm:ss
try: return int(sum(x*y for x, y in zip(list(map(float, string.split(':')[::-1])), (1, 60, 3600, 86400))))
except: return 0

def getIDbyPath(path):
if path.startswith('special://'): return re.compile('special://home/addons/(.*?)/resources', re.IGNORECASE).search(path)
elif path.startswith('plugin://'): return re.compile('plugin://(.*?)/', re.IGNORECASE).search(path)

3 changes: 2 additions & 1 deletion plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def busy_dialog():
Builtin().executebuiltin('ActivateWindow(busydialognocancel)')
try: yield
finally:
Builtin().executebuiltin('Dialog.Close(busydialognocancel)')
if Builtin().getInfoBool('IsActive(busydialognocancel)','Window'):
Builtin().executebuiltin('Dialog.Close(busydialognocancel)')

@contextmanager
def sudo_dialog(msg):
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 @@ -234,7 +234,7 @@ def hasRecordings():
rules = [{"id":53,"values":{"0":LANGUAGE(32002)}}]
if self.enableEvenTV: rules.append({"id":54,"values":{"0":SETTINGS.getSettingInt('Enable_Even')}})
MixedList.append({'name':LANGUAGE(32002), 'type':"Mixed",'path':self.predefined.createSeasonal() ,'logo':self.resources.getLogo(LANGUAGE(32002),"Mixed"),'rules':rules}) #"Seasonal"

if hasRecordings():
MixedList.append({'name':LANGUAGE(32003), 'type':"Mixed",'path':self.predefined.createPVRRecordings(),'logo':self.resources.getLogo(LANGUAGE(32003),"Mixed")}) #"PVR Recordings"

Expand Down Expand Up @@ -353,7 +353,7 @@ def getMusicInfo(self, sortbycount=True):
if not self.parserDialog is None:
self.parserDialog = DIALOG.progressBGDialog(self.parserCount,self.parserDialog,'%s: %s'%(self.parserMSG,int((idx+1)*100//len(json_response)))+'%','%s, %s'%(ADDON_NAME,'%s %s'%(LANGUAGE(30014),LANGUAGE(32041))))

MusicGenreList.update([genre for genre in info.get('label','').split(';')])
MusicGenreList.update([genre.strip() for genre in info.get('label','').split(';')])

if sortbycount:
MusicGenreList = [x[0] for x in sorted(MusicGenreList.most_common(50))]
Expand Down
12 changes: 7 additions & 5 deletions plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ def validatePath(self, path, channelData, spinner=True):
self.log('validatePath, path = %s'%path)
if not path: return None, channelData
if spinner: self.toggleSpinner(self.itemList,True)
file = self.validateVFS(path, channelData)
if not file:
if not self.validateVFS(path, channelData):
path = None
DIALOG.notificationDialog(LANGUAGE(32030))
else:
Expand All @@ -513,9 +512,11 @@ def validateVFS(self, path, channelData):
for path in paths:
result = self.validateVFS(path, channelData)
if result: return result

items, limits, errors = self.jsonRPC.requestList(channelData, path, media, limits={"end": 5, "start": 0}) #todo use another means to verify or bypass autopage set limits.

items, limits, errors = self.jsonRPC.requestList(channelData, path, media, limits={"end": PAGE_LIMIT, "start": 0}) #todo use another means to verify or bypass autopage set limits.
print('validateVFS',path,items)
for idx, item in enumerate(items):
print('validateVFS item',path,item)
file = item.get('file', '')
fileType = item.get('filetype', 'file')
if fileType == 'file':
Expand All @@ -530,7 +531,8 @@ def validateVFS(self, path, channelData):
DIALOG.progressDialog(100,control=dia)
closeBusyDialog()
return file
else: dirs.append(file)
elif item.get('label','').lower() not in ['search','keyword']:
dirs.append(file) #filter any plugin vfs that triggers user input.

for dir in dirs:
result = self.validateVFS(dir, channelData)
Expand Down
Loading

0 comments on commit 55ca423

Please sign in to comment.