Skip to content

Commit

Permalink
v.0.5.6t
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunatixz committed Dec 25, 2024
1 parent 3332f8c commit edb8cd0
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 65 deletions.
2 changes: 2 additions & 0 deletions language_report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Language IDS not found in py files, possibly only in xml: {
"30114": "Add to PseudoTV Live",
"30115": "Add to Recordings",
"30117": "Remove Recording",
"30120": "[COLOR=red][B]Warning!! [/B][/COLOR]%s\\nAlready Exists, override it?.",
"30123": "Two Shows",
"30124": "Three Shows",
"30128": "Searching for %s logo",
Expand Down Expand Up @@ -174,6 +175,7 @@ Language IDS not found in py files, possibly only in xml: {
"32033": "Offline",
"32048": "Select Servers",
"32049": "Restarting...",
"32052": "Copying Failed!",
"32053": "Settings",
"32054": "Initializing...",
"32057": "%s is busy, try again later...",
Expand Down
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.6t" name="PseudoTV Live" provider-name="Lunatixz">
<addon id="plugin.video.pseudotv.live" version="0.5.6u" 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: 2 additions & 0 deletions plugin.video.pseudotv.live/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
v.0.5.7
-Fixed Channel Manager path duplication.
-Improved file migration when changing centralized file location.
-Changed Even show distributions global default value to 0.
-Moved Custom user groups out of settings and into group select list in channel manager.
-Fixed PseudoTV not respecting user subtitle preference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ msgid "Copying"
msgstr ""

msgctxt "#32052"
msgid "Copying %s Failed!"
msgid "Copying Failed!"
msgstr ""

msgctxt "#32053"
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/cqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def __start(self):
self.popThread.start()


def __run(self, func, args=None, kwargs=None):
def __run(self, func, *args, **kwargs):
self.log("__run, func = %s"%(func.__name__))
try: return self.pool.executor(func, None, *args, *kwargs)
try: return self.pool.executor(func, None, *args, **kwargs)
except Exception as e: self.log("__run, func = %s failed! %s\nargs = %s, kwargs = %s"%(func.__name__,e,args,kwargs), xbmc.LOGERROR)


Expand Down Expand Up @@ -131,7 +131,7 @@ def __pop(self):
self.log("__pop, heappop failed! %s\nmin_heap = %s"%(e,self.min_heap), xbmc.LOGERROR)
continue
self.qsize -= 1
self.__run(*package)
self.__run(package[0],*package[1],**package[2])

elif self.fifo or self.lifo:
curr_node = self.head if self.fifo else self.tail
Expand Down
40 changes: 32 additions & 8 deletions plugin.video.pseudotv.live/resources/lib/fileaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ def open(filename, mode, encoding=DEFAULT_ENCODING):
return fle


@staticmethod
def _getFolderPath(path):
head, tail = os.path.split(path)
last_folder = os.path.basename(head)
return os.path.join(last_folder, tail)


@staticmethod
def listdir(path):
return xbmcvfs.listdir(path)
Expand All @@ -46,16 +53,33 @@ def translatePath(path):


@staticmethod
def copyFolder(path, newpath, verbose=None):
log('FileAccess: copying folder %s to %s'%(path,newpath))
return shutil.copytree(xbmcvfs.translatePath(path), xbmcvfs.translatePath(newpath), copy_function=verbose)

def copyFolder(src, dir, dia=None):
log('FileAccess: copyFolder %s to %s'%(src,dir))
if not FileAccess.exists(dir): FileAccess.makedirs(dir)
if dia:
from kodi import Dialog
DIALOG = Dialog()

subs, files = FileAccess.listdir(src)
pct = 0
if dia: dia = DIALOG.progressDialog(pct, control=dia, message='%s\n%s'%(LANGUAGE(32051),src))
for fidx, file in enumerate(files):
if dia: dia = DIALOG.progressDialog(pct, control=dia, message='%s: (%s%)\n%s'%(LANGUAGE(32051),(int(fidx*100)//len(files)),FileAccess._getFolderPath(file)))
FileAccess.copy(os.path.join(src, file), os.path.join(dir, file))

for sidx, sub in enumerate(subs):
pct = int(sidx)//len(subs)
FileAccess.copyFolder(os.path.join(src, sub), os.path.join(dir, sub), dia)


@staticmethod
def moveFolder(path, newpath):
log('FileAccess: moving folder %s to %s'%(path,newpath))
return shutil.move(xbmcvfs.translatePath(path), xbmcvfs.translatePath(newpath))

def moveFolder(src, dir):
log('FileAccess: moving folder %s to %s'%(src,dir))
if not FileAccess.exists(dir): FileAccess.makedirs(dir)
for subs, files in FileAccess.listdir(src):
for file in files: FileAccess.movie(os.path.join(src, file), dir)
for sub in subs: FileAccess.moveFolder(os.path.join(src, sub), dir)


@staticmethod
def copy(orgfilename, newfilename):
Expand Down
6 changes: 3 additions & 3 deletions plugin.video.pseudotv.live/resources/lib/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ def __setCache(key,data,json_data,cache,checksum,life):
if results and cache: return __setCache(cacheKey,results,json_data,cache,checksum,life)
else: return results
except requests.exceptions.ConnectionError as e:
log("Globals: requestURL, failed! Error connecting to the server: %s"%('Returning cache' if cache else ''), xbmc.LOGERROR)
log("Globals: requestURL, failed! Error connecting to the server: %s"%('Returning cache' if cache else ''))
return __getCache(cacheKey,json_data,cache,checksum) if cache else __error(json_data)
except requests.exceptions.HTTPError as e:
log("Globals: requestURL, failed! HTTP error occurred: %s\n%s"%('Returning cache' if cache else '',e), xbmc.LOGERROR)
log("Globals: requestURL, failed! HTTP error occurred: %s\n%s"%('Returning cache' if cache else ''))
return __getCache(cacheKey,json_data,cache,checksum) if cache else __error(json_data)
except requests.exceptions.RequestException as e:
log("Globals: requestURL, failed! An error occurred: %s"%(e), xbmc.LOGERROR)
Expand Down Expand Up @@ -465,4 +465,4 @@ def percentDiff(org, new):

def pagination(list, end):
for start in range(0, len(list), end):
yield seq[start:start+end]
yield seq[start:start+end]
2 changes: 1 addition & 1 deletion plugin.video.pseudotv.live/resources/lib/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _parseXBT(resource):
walk.setdefault(path,[]).extend(nfiles)

for sub in subs:
if depth == 0:break
if depth == 0: break
depth -= 1
walk.update(self.walkListDirectory(os.path.join(path,sub), exts, depth, chkDuration, appendPath, checksum, expiration))
return walk
Expand Down
13 changes: 8 additions & 5 deletions plugin.video.pseudotv.live/resources/lib/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,8 @@ def setPVRPath(self, path, instance=ADDON_NAME, prompt=False, force=False):
'epgPath' :os.path.join(path,XMLTVFLE),
'genresPathType' :'0',
'genresPath' :os.path.join(path,GENREFLE),
'logoPathType' :'0',
'logoPath' :os.path.join(path,'logos'),
'kodi_addon_instance_name' : '%s - %s'%(ADDON_NAME,instance),
'kodi_addon_instance_enabled':'true'}
settings.update(nsettings)
Expand Down Expand Up @@ -1403,7 +1405,7 @@ def __getResources():


def browseSources(self, type=0, heading=ADDON_NAME, default='', shares='', mask='', useThumbs=True, treatAsFolder=False, multi=False, monitor=False, options=[], exclude=[]):
self.log('browseSources, type = %s, heading= %s, shares= %s, useThumbs= %s, treatAsFolder= %s, default= %s\nmask= %s, options= %s, exclude= %s'%(type,heading,shares,useThumbs,treatAsFolder,default,mask,len(options),exclude))
self.log('browseSources, type = %s, heading= %s, shares= %s, useThumbs= %s, treatAsFolder= %s, default= %s, mask= %s, options= %s, exclude= %s'%(type,heading,shares,useThumbs,treatAsFolder,default,mask,len(options),exclude))
def __buildMenuItem(option):
return self.listitems.buildMenuListItem(option['label'],option['label2'],DUMMY_ICON.format(text=getAbbr(option['label'])))

Expand All @@ -1423,17 +1425,18 @@ def __buildMenuItem(option):
{"idx":21, "label":LANGUAGE(32201) , "label2":"" , "default":"" , "shares":"pictures", "mask":xbmc.getSupportedMedia('picture') , "type":1 , "multi":False},
{"idx":22, "label":LANGUAGE(32202) , "label2":"Resource Plugin" , "default":"" , "shares":shares , "mask":mask , "type":type , "multi":multi}]

if len(exclude) > 0: options.extend([opt for opt in opts if not opt.get('idx',-1) in exclude])
options.extend([opt for opt in opts if not opt.get('idx',-1) in exclude])
options = setDictLST(options) #todo trakdown bug where options are being recalled back to function.
if default: options.insert(0,{"idx":0, "label":LANGUAGE(32203), "label2":default, "default":default, "shares":shares, "mask":mask, "type":type, "multi":multi})
lizLST = poolit(__buildMenuItem)(sorted(options, key=itemgetter('idx')))
select = self.selectDialog(lizLST, LANGUAGE(32089), multi=False)
if select is None: return

default = options[select]['default']
shares = options[select]['shares']
mask = options[select]['mask']
type = options[select]['type']
multi = options[select]['multi']

if type == 0:
if "resource." in default or options[select]["idx"] == 22: return self._resourcePath(default)
elif type == 1:
Expand Down Expand Up @@ -1478,7 +1481,7 @@ def __buildListItem(label: str="", label2: str="", icon: str=COLOR_LOGO, paths:
except: lastOPT = -1
if key == 'add':
with self.builtin.busy_dialog():
npath = self.browseSources(heading=LANGUAGE(32080),exclude=exclude,monitor=monitor)
npath = self.browseSources(heading=LANGUAGE(32080), exclude=exclude, monitor=monitor)
if npath: pathLST.append(npath)
elif key == 'save':
paths = pathLST
Expand All @@ -1488,7 +1491,7 @@ def __buildListItem(label: str="", label2: str="", icon: str=COLOR_LOGO, paths:
if retval in [1,2]: pathLST.pop(pathLST.index(path))
if retval == 2:
with self.builtin.busy_dialog():
npath = self.browseSources(heading=LANGUAGE(32080),default=path,monitor=monitor,exclude=exclude)
npath = self.browseSources(heading=LANGUAGE(32080), default=path, monitor=monitor, exclude=exclude)
pathLST.append(npath)
self.log('multiBrowse, OUT paths = %s'%(paths))
return paths
Expand Down
10 changes: 5 additions & 5 deletions plugin.video.pseudotv.live/resources/lib/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __loadChannels(self, name=''):
enabled = SETTINGS.getSettingList('Select_server')
friendly = SETTINGS.getFriendlyName()

if name == LANGUAGE(30022):
if name == LANGUAGE(30022):#Auto
if len(channels) > 0: return channels
elif len(enabled) > 0:
for name in enabled:
Expand Down Expand Up @@ -395,7 +395,7 @@ def getPaths(self, citem: dict={}, paths: list=[]):
except: lastOPT = None
if key == 'add':
with self.toggleSpinner(self.itemList):
retval = DIALOG.browseSources(heading=LANGUAGE(32080),exclude=[21],monitor=True)
retval = DIALOG.browseSources(heading=LANGUAGE(32080), exclude=[21], monitor=True)
if not retval is None:
npath, citem = self.validatePath(retval,citem)
if npath: pathLST.append(npath)
Expand All @@ -408,7 +408,7 @@ def getPaths(self, citem: dict={}, paths: list=[]):
if retval in [1,2]: pathLST.pop(pathLST.index(path))
if retval == 2:
with self.toggleSpinner(self.itemList):
npath, citem = self.validatePath(DIALOG.browseSources(heading=LANGUAGE(32080),default=path,monitor=True,exclude=[21]), citem)
npath, citem = self.validatePath(DIALOG.browseSources(heading=LANGUAGE(32080), default=path, monitor=True, exclude=[21]), citem)
pathLST.append(npath)
self.log('getPaths, paths = %s'%(paths))
return paths, citem
Expand All @@ -421,7 +421,7 @@ def getGroups(self, citem: dict={}, groups: list=[]):
selects = DIALOG.selectDialog(ngroups,header=LANGUAGE(32081),preselect=findItemsInLST(ngroups,groups),useDetails=False)
if 0 in selects:
SETTINGS.setSetting('User_Groups',DIALOG.inputDialog(LANGUAGE(32044), default=SETTINGS.getSetting('User_Groups')))
return self.getGroups(groups)
return self.getGroups(citem, groups)
elif len(ngroups) > 0: groups = [ngroups[idx] for idx in selects]
if not groups: groups = [LANGUAGE(30127)]
self.log('getGroups, groups = %s'%(groups))
Expand Down Expand Up @@ -766,7 +766,7 @@ def _build(logo):

def browse(chname):
with self.toggleSpinner(self.itemList):
retval = DIALOG.browseSources(type=1,heading='%s (%s)'%(LANGUAGE(32066).split('[CR]')[0],chname),default=channelData.get('icon',''), shares='files',mask=xbmc.getSupportedMedia('picture'),exclude=[12,13,14,15,16,17,21,22])
retval = DIALOG.browseSources(type=1,heading='%s (%s)'%(LANGUAGE(32066).split('[CR]')[0],chname), default=channelData.get('icon',''), shares='files', mask=xbmc.getSupportedMedia('picture'), exclude=[12,13,14,15,16,17,21,22])
if FileAccess.copy(cleanLogo(retval), os.path.join(LOGO_LOC,'%s%s'%(chname,retval[-4:])).replace('\\','/')):
if FileAccess.exists(os.path.join(LOGO_LOC,'%s%s'%(chname,retval[-4:])).replace('\\','/')):
return os.path.join(LOGO_LOC,'%s%s'%(chname,retval[-4:])).replace('\\','/')
Expand Down
4 changes: 2 additions & 2 deletions plugin.video.pseudotv.live/resources/lib/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ def __restart(self, wait=1.0) -> bool:


def _interrupt(self) -> bool: #break
pendingInterrupt = (self.pendingRestart | PROPERTIES.isInterruptActivity())
pendingInterrupt = (self.monitor.isSettingsOpened() | self.pendingRestart | PROPERTIES.isInterruptActivity())
if pendingInterrupt != self.monitor.pendingInterrupt:
self.monitor.pendingInterrupt = PROPERTIES.setPendingInterrupt(pendingInterrupt)
self.log('_interrupt, pendingInterrupt = %s'%(self.monitor.pendingInterrupt))
Expand All @@ -456,7 +456,7 @@ def _interrupt(self) -> bool: #break

def _suspend(self) -> bool: #continue
if self.monitor.pendingInterrupt: pendingSuspend = False
else: pendingSuspend = (self.monitor.isSettingsOpened() | self.__playing() | PROPERTIES.isSuspendActivity())
else: pendingSuspend = (self.__playing() | PROPERTIES.isSuspendActivity())
if pendingSuspend != self.monitor.pendingSuspend:
self.monitor.pendingSuspend = PROPERTIES.setPendingSuspend(pendingSuspend)
self.log('_suspend, pendingSuspend = %s'%(self.monitor.pendingSuspend))
Expand Down
42 changes: 12 additions & 30 deletions plugin.video.pseudotv.live/resources/lib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _chkChannelUpdate(self):
citem = builder.sortChannels([citem for citem in builder.verify() if citem.get('id') == id])
del builder
self.log('_chkChannelUpdate, id = %s, citem = %s'%(id,citem))
return self._que(self.chkChannels,1,citem)
return self._que(self.chkChannels,3,citem)


@cacheit(expiration=datetime.timedelta(minutes=10))
Expand Down Expand Up @@ -258,15 +258,17 @@ def chkJSONQUE(self):

def chkPVRRefresh(self):
self.log('chkPVRRefresh')
self._que(self.chkPVRToggle,1)
timerit(self._que)(self.chkPVRToggle)(FIFTEEN,[1])


def chkPVRToggle(self):
isIdle = self.service.monitor.isIdle
isPlaying = self.service.player.isPlaying()
isIdle = self.service.monitor.isIdle
isPlaying = self.service.player.isPlaying()
isScanning = BUILTIN.getInfoBool('IsScanningVideo','Library')
isRecording = BUILTIN.getInfoBool('IsRecording','Pvr')
self.log('chkPVRToggle, isIdle = %s, isPlaying = %s'%(isIdle,isPlaying))
if isIdle and not isPlaying: togglePVR(False,True)
else: self.chkPVRRefresh()
if isIdle and not (isPlaying | isScanning | isRecording): togglePVR(False,True)
else: self.chkPVRRefresh()


def chkFillers(self, channels=None):
Expand Down Expand Up @@ -333,7 +335,7 @@ def chkChannelChange(self, channels=[]):
nChannels = self.getChannels()
if channels != nChannels:
self.log('chkChannelChange, channels changed %s => %s: queueing chkChannels'%(len(channels),len(nChannels)))
self._que(self.chkChannels,1,diffLSTDICT(channels,nChannels))
self._que(self.chkChannels,3,diffLSTDICT(channels,nChannels))
return nChannels
return channels

Expand All @@ -350,33 +352,13 @@ def chkSettingsChange(self, settings={}):
return nSettings


def setUserPath(self, old, new, overwrite=False):
def setUserPath(self, old, new):
with PROPERTIES.interruptActivity():
self.log('setUserPath, old = %s, new = %s'%(old,new))
dia = DIALOG.progressDialog(message='%s\n%s'%(LANGUAGE(32050),old))
with BUILTIN.busy_dialog():
fileItems = self.jsonRPC.walkListDirectory(old, depth=-1, appendPath=True)

cnt = 0
for dir, files in list(fileItems.items()):
ndir = dir.replace(old,new)
dia = DIALOG.progressDialog(int(((cnt)*100)//len(list(fileItems.keys()))), dia, message='%s\n%s'%(LANGUAGE(32051),ndir))
if ndir and not FileAccess.exists(os.path.join(ndir,'')):
if not FileAccess.makedirs(os.path.join(ndir,'')): continue

pnt = 0
for idx, file in enumerate(files):
pnt = int(((idx)*100)//len(files))
nfile = file.replace(old,new)
if FileAccess.exists(nfile) and not overwrite:
retval = DIALOG.yesnoDialog((LANGUAGE(30120)%nfile),customlabel='Overwrite All')
if retval in [1,2]: FileAccess.delete(nfile)
else: continue
if retval == 2: overwrite = True
if FileAccess.copy(file,nfile): dia = DIALOG.progressDialog(pnt, dia, message='%s\n%s\n%s'%(LANGUAGE(32051),ndir,nfile))
else: dia = DIALOG.progressDialog(pnt, dia, message=LANGUAGE(32052)%(nfile))
DIALOG.progressDialog(100, dia)
FileAccess.copyFolder(old, new, dia)
SETTINGS.setPVRPath(new,prompt=True,force=True)
PROPERTIES.setPendingRestart()
DIALOG.progressDialog(100, dia)


Loading

0 comments on commit edb8cd0

Please sign in to comment.