Skip to content

Commit

Permalink
[Updated] Sync some of the code between distros to allow cross plugin… (
Browse files Browse the repository at this point in the history
#4062)

* [Updated] Sync some of the code between distros to allow cross plugin usage

* [Fixed] Compile issue
  • Loading branch information
DimitarCC authored and WanWizard committed Oct 24, 2024
1 parent 37a9db7 commit 639f6f2
Show file tree
Hide file tree
Showing 9 changed files with 212 additions and 127 deletions.
10 changes: 10 additions & 0 deletions lib/dvb/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ RESULT eDVBService::getName(const eServiceReference &ref, std::string &name)
name = m_service_name;
else
name = "(...)";

std::string res_name = "";
std::string res_provider = "";
eServiceReference::parseNameAndProviderFromName(name, res_name, res_provider);
name = res_name;

if (!res_provider.empty() && m_provider_name.empty()) {
m_provider_name = res_provider;
}

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/dvb/metaparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class eDVBMetaParser

eServiceReferenceDVB m_ref;
int m_data_ok, m_time_create, m_packet_size, m_scrambled;
std::string m_name, m_description, m_tags, m_service_data;
std::string m_name, m_description, m_tags, m_service_data, m_prov;
long long m_filesize, m_length;
};

Expand Down
219 changes: 112 additions & 107 deletions lib/python/Components/Converter/PliExtraInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,110 +360,113 @@ def getText(self):
if not info:
return ""

if self.type == "CryptoInfo":
self.getCryptoInfo(info)
if config.usage.show_cryptoinfo.value:
return addspace(self.createCryptoBar(info)) + self.createCryptoSpecial(info)
try:
if self.type == "CryptoInfo":
self.getCryptoInfo(info)
if config.usage.show_cryptoinfo.value:
return addspace(self.createCryptoBar(info)) + self.createCryptoSpecial(info)
else:
return addspace(self.createCryptoBar(info)) + addspace(self.current_source) + self.createCryptoSpecial(info)

if self.type == "CurrentCrypto":
self.getCryptoInfo(info)
return self.createCurrentCaidLabel(info)

if self.type == "CryptoBar":
self.getCryptoInfo(info)
return self.createCryptoBar(info)

if self.type == "CryptoSpecial":
self.getCryptoInfo(info)
return self.createCryptoSpecial(info)

if self.type == "Resolution":
return self.createResolution(info)

if self.type == "ResolutionString":
return addspace(self.createResolution(info)) + self.createGamma(info)

if self.type == "VideoCodec":
return self.createVideoCodec(info)

if self.type == "Gamma":
return self.createGamma(info)

if self.updateFEdata:
feinfo = service.frontendInfo()
if feinfo:
self.feraw = feinfo.getAll(config.usage.infobar_frontend_source.value == "settings")
if self.feraw:
self.fedata = ConvertToHumanReadable(self.feraw)

feraw = self.feraw
if not feraw:
feraw = info.getInfoObject(iServiceInformation.sTransponderData)
fedata = ConvertToHumanReadable(feraw)
else:
return addspace(self.createCryptoBar(info)) + addspace(self.current_source) + self.createCryptoSpecial(info)

if self.type == "CurrentCrypto":
self.getCryptoInfo(info)
return self.createCurrentCaidLabel(info)

if self.type == "CryptoBar":
self.getCryptoInfo(info)
return self.createCryptoBar(info)

if self.type == "CryptoSpecial":
self.getCryptoInfo(info)
return self.createCryptoSpecial(info)

if self.type == "Resolution":
return self.createResolution(info)
fedata = self.fedata

if self.type == "ResolutionString":
return addspace(self.createResolution(info)) + self.createGamma(info)
if self.type == "All":
self.getCryptoInfo(info)
if config.usage.show_cryptoinfo.value:
return addspace(self.createProviderName(info)) + self.createTransponderInfo(fedata, feraw, info) + "\n" \
+ addspace(self.createCryptoBar(info)) + addspace(self.createCryptoSpecial(info)) + "\n" \
+ addspace(self.createPIDInfo(info)) + addspace(self.createVideoCodec(info)) + addspace(self.createResolution(info)) + self.createGamma(info)
else:
return addspace(self.createProviderName(info)) + self.createTransponderInfo(fedata, feraw, info) + "\n" \
+ addspace(self.createCryptoBar(info)) + self.current_source + "\n" \
+ addspace(self.createCryptoSpecial(info)) + addspace(self.createVideoCodec(info)) + addspace(self.createResolution(info)) + self.createGamma(info)

if self.type == "VideoCodec":
return self.createVideoCodec(info)
if self.type == "PIDInfo":
return self.createPIDInfo(info)

if self.type == "Gamma":
return self.createGamma(info)

if self.updateFEdata:
feinfo = service.frontendInfo()
if feinfo:
self.feraw = feinfo.getAll(config.usage.infobar_frontend_source.value == "settings")
if self.feraw:
self.fedata = ConvertToHumanReadable(self.feraw)

feraw = self.feraw
if not feraw:
feraw = info.getInfoObject(iServiceInformation.sTransponderData)
fedata = ConvertToHumanReadable(feraw)
else:
fedata = self.fedata

if self.type == "All":
self.getCryptoInfo(info)
if config.usage.show_cryptoinfo.value:
return addspace(self.createProviderName(info)) + self.createTransponderInfo(fedata, feraw, info) + "\n" \
+ addspace(self.createCryptoBar(info)) + addspace(self.createCryptoSpecial(info)) + "\n" \
+ addspace(self.createPIDInfo(info)) + addspace(self.createVideoCodec(info)) + addspace(self.createResolution(info)) + self.createGamma(info)
else:
return addspace(self.createProviderName(info)) + self.createTransponderInfo(fedata, feraw, info) + "\n" \
+ addspace(self.createCryptoBar(info)) + self.current_source + "\n" \
+ addspace(self.createCryptoSpecial(info)) + addspace(self.createVideoCodec(info)) + addspace(self.createResolution(info)) + self.createGamma(info)

if self.type == "PIDInfo":
return self.createPIDInfo(info)

if not feraw:
return ""
if not feraw:
return ""

if self.type == "ServiceInfo":
return addspace(self.createProviderName(info)) + addspace(self.createTunerSystem(fedata)) + addspace(self.createFrequency(feraw)) + addspace(self.createPolarization(fedata)) \
+ addspace(self.createSymbolRate(fedata, feraw)) + addspace(self.createFEC(fedata, feraw)) + addspace(self.createModulation(fedata)) + addspace(self.createOrbPos(feraw)) \
+ addspace(self.createVideoCodec(info)) + addspace(self.createResolution(info)) + self.createGamma(info)
if self.type == "ServiceInfo":
return addspace(self.createProviderName(info)) + addspace(self.createTunerSystem(fedata)) + addspace(self.createFrequency(feraw)) + addspace(self.createPolarization(fedata)) \
+ addspace(self.createSymbolRate(fedata, feraw)) + addspace(self.createFEC(fedata, feraw)) + addspace(self.createModulation(fedata)) + addspace(self.createOrbPos(feraw)) \
+ addspace(self.createVideoCodec(info)) + addspace(self.createResolution(info)) + self.createGamma(info)

if self.type == "TransponderInfo":
return self.createTransponderInfo(fedata, feraw, info)
if self.type == "TransponderInfo":
return self.createTransponderInfo(fedata, feraw, info)

if self.type == "TransponderFrequency":
return self.createFrequency(feraw)
if self.type == "TransponderFrequency":
return self.createFrequency(feraw)

if self.type == "TransponderSymbolRate":
return self.createSymbolRate(fedata, feraw)
if self.type == "TransponderSymbolRate":
return self.createSymbolRate(fedata, feraw)

if self.type == "TransponderPolarization":
return self.createPolarization(fedata)
if self.type == "TransponderPolarization":
return self.createPolarization(fedata)

if self.type == "TransponderFEC":
return self.createFEC(fedata, feraw)
if self.type == "TransponderFEC":
return self.createFEC(fedata, feraw)

if self.type == "TransponderModulation":
return self.createModulation(fedata)
if self.type == "TransponderModulation":
return self.createModulation(fedata)

if self.type == "OrbitalPosition":
return self.createOrbPos(feraw)
if self.type == "OrbitalPosition":
return self.createOrbPos(feraw)

if self.type == "TunerType":
return self.createTunerType(feraw)
if self.type == "TunerType":
return self.createTunerType(feraw)

if self.type == "TunerSystem":
return self.createTunerSystem(fedata)
if self.type == "TunerSystem":
return self.createTunerSystem(fedata)

if self.type == "OrbitalPositionOrTunerSystem":
return self.createOrbPosOrTunerSystem(fedata, feraw)
if self.type == "OrbitalPositionOrTunerSystem":
return self.createOrbPosOrTunerSystem(fedata, feraw)

if self.type == "TerrestrialChannelNumber":
return self.createChannelNumber(fedata, feraw)
if self.type == "TerrestrialChannelNumber":
return self.createChannelNumber(fedata, feraw)

if self.type == "TransponderInfoMisPls":
return self.createMisPls(fedata)
if self.type == "TransponderInfoMisPls":
return self.createMisPls(fedata)

return _("invalid type")
return _("invalid type")
except:
return "FTA"

text = property(getText)

Expand All @@ -484,33 +487,35 @@ def getBool(self):

if request_caid is None:
return False
try:
if info.getInfo(iServiceInformation.sIsCrypted) != 1:
return False

if info.getInfo(iServiceInformation.sIsCrypted) != 1:
return False
data = self.ecmdata.getEcmData()

data = self.ecmdata.getEcmData()
if data is None:
return False

if data is None:
return False
current_caid = data[1]

current_caid = data[1]
available_caids = info.getInfoObject(iServiceInformation.sCAIDs)

available_caids = info.getInfoObject(iServiceInformation.sCAIDs)
for caid_entry in caid_data:
if caid_entry[3] == request_caid:
if request_selected:
if int(caid_entry[0], 16) <= int(current_caid, 16) <= int(caid_entry[1], 16):
return True
else: # request available
try:
for caid in available_caids:
if int(caid_entry[0], 16) <= caid <= int(caid_entry[1], 16):
return True
except:
pass

for caid_entry in caid_data:
if caid_entry[3] == request_caid:
if request_selected:
if int(caid_entry[0], 16) <= int(current_caid, 16) <= int(caid_entry[1], 16):
return True
else: # request available
try:
for caid in available_caids:
if int(caid_entry[0], 16) <= caid <= int(caid_entry[1], 16):
return True
except:
pass

return False
return False
except:
return False

boolean = property(getBool)

Expand Down
2 changes: 1 addition & 1 deletion lib/python/Components/Sources/CurrentService.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from Components.PerServiceDisplay import PerServiceBase
from enigma import iPlayableService, iPlayableService
from enigma import iPlayableService, iPlayableService, eServiceCenter
from Components.Sources.Source import Source
from Components.Element import cached
import NavigationInstance
Expand Down
45 changes: 30 additions & 15 deletions lib/python/Components/Sources/EventInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from Components.PerServiceDisplay import PerServiceBase
from Components.Element import cached
from enigma import iPlayableService, iServiceInformation, eServiceReference, eEPGCache
from enigma import iPlayableService, iServiceInformation, eServiceReference, eEPGCache, eServiceCenter
from Components.Sources.Source import Source


Expand All @@ -21,9 +21,9 @@ def __init__(self, info, now_or_next, service):
self.m_ExtendedDescriptionNow = ""
self.m_ExtendedDescriptionNext = ""
self.m_Duration = 0
self.m_Begin = int(time())

sTagTitle = info.getInfoString(iServiceInformation.sTagTitle)
self.m_Begin = time()
isPtr = not isinstance(service, eServiceReference)
sTagTitle = info.getInfoString(iServiceInformation.sTagTitle) if isPtr else info.getInfoString(service, iServiceInformation.sTagTitle)
if sTagTitle:
sTagTitleList = sTagTitle.split(" - ")
element1 = sTagTitleList[0] if len(sTagTitleList) >= 1 else ""
Expand All @@ -36,29 +36,29 @@ def __init__(self, info, now_or_next, service):
self.m_EventNameNow = element1 + " - " + element2
self.m_EventNameNext = element3

sTagGenre = info.getInfoString(iServiceInformation.sTagGenre)
sTagGenre = info.getInfoString(iServiceInformation.sTagGenre) if isPtr else info.getInfoString(service, iServiceInformation.sTagGenre)
if sTagGenre:
element4 = sTagGenre
self.m_ShortDescriptionNow = element4

sTagOrganization = info.getInfoString(iServiceInformation.sTagOrganization)
sTagOrganization = info.getInfoString(iServiceInformation.sTagOrganization) if isPtr else info.getInfoString(service, iServiceInformation.sTagOrganization)
if sTagOrganization:
element5 = sTagOrganization
self.m_ExtendedDescriptionNow = element5

sTagLocation = info.getInfoString(iServiceInformation.sTagLocation)
sTagLocation = info.getInfoString(iServiceInformation.sTagLocation) if isPtr else info.getInfoString(service, iServiceInformation.sTagLocation)
if sTagLocation:
element6 = sTagLocation
self.m_ExtendedDescriptionNow += "\n\n" + element6

seek = service and service.seek()
seek = service and isPtr and service.seek()
if seek:
length = seek.getLength()
if length[0] == 0:
self.m_Duration = length[1] // 90000
self.m_Duration = length[1] / 90000
position = seek.getPlayPosition()
if position[0] == 0:
self.m_Begin = int(time()) - position[1] // 90000
self.m_Begin = time() - position[1] / 90000

def getEventName(self):
return self.m_EventNameNow if self.now_or_next == self.NOW else self.m_EventNameNext
Expand Down Expand Up @@ -127,17 +127,23 @@ def __init__(self, navcore, now_or_next):
}, with_event=True)
self.now_or_next = now_or_next
self.epgQuery = eEPGCache.getInstance().lookupEventTime
self.__service = None

@cached
def getEvent(self):
service = self.navcore.getCurrentService()
info = service and service.info()
ret = info and info.getEvent(self.now_or_next)
isPtr = not isinstance(self.__service, eServiceReference)
service = self.navcore.getCurrentService() if isPtr else self.__service
if isPtr:
info = service and service.info()
ret = info and info.getEvent(self.now_or_next)
else:
info = eServiceCenter.getInstance().info(self.__service)
ret = info and info.getEvent(self.__service, self.now_or_next)
if info:
if not ret or ret.getEventName() == "":
refstr = info.getInfoString(iServiceInformation.sServiceref)
refstr = info.getInfoString(iServiceInformation.sServiceref) if isPtr else self.__service.toString()
ret = self.epgQuery(eServiceReference(refstr), -1, self.now_or_next and 1 or 0)
if not ret and refstr.split(':')[0] in ['4097', '5001', '5002', '5003']: # No EPG Try to get Meta
if not ret and refstr.split(':')[0] in ['4097', '5001', '5002', '5003']: # No EPG Try to get Meta
ev = pServiceEvent(info, self.now_or_next, service)
if ev.getEventName:
return ev
Expand All @@ -151,6 +157,15 @@ def gotEvent(self, what):
else:
self.changed((self.CHANGED_ALL,))

def updateSource(self, ref):
if not ref:
self.__service = None
self.changed((self.CHANGED_CLEAR,))
return
self.__service = ref
self.changed((self.CHANGED_ALL,))


def destroy(self):
PerServiceBase.destroy(self)
Source.destroy(self)
Loading

0 comments on commit 639f6f2

Please sign in to comment.