I am working on a plugin that pulls streaming info, metadata, channel and program info and images from ServerWMC backend. I currently can populate a list of channels and stream those channels via DLNA as long as your Tuner card supports DLNA. I currently use an HD Home Run Prime.
My current problem is when I click on the Channel object I want it to show a listing of everything coming up along with what is playing. I also want them to be functional objects so I can put code in to handle scheduling recordings if you click on a future program. Right now when I click on the Channel it will only show me the initial program in the array because it is not putting it all in one container to return. Below is the code that handles that and I can't for the life of me figure out why it is not working as intended. the problem seems to be in the function CreateEO. It is not including_container even though in the internal callback I have it doing so. Any help on this is greatly appreciated.
####################################################################################################
@route(PREFIX +'/submenu/{title}')
def SubMenu(menu):
oc = ObjectContainer(title2=menu, no_cache=True)
#Connect and Get Channel List
resultsArray = socketClient('GetChannels', '')
if DEBUG=='Verbose':
Log.Debug(resultsArray)
#Loop through resultsArray to build Channel objects
for result in resultsArray:
channelArray = result.split('|')
channelID = channelArray[0]
try:
channelImageFile = channelArray[5].split('/')[-1] #'file://' + channelArray[5].split('@')[-1]
except:
channelImageFile = ''
channelNumber = channelArray[2]
channelName = channelArray[8]
channelTitle = channelName + '(' + channelNumber + ')'
channelURL = channelArray[9]
Thumb = channelImageFile
summaryData = getChannelInfo(chID=channelID, progItem='programName', infoType='nowPlaying')
summaryData = summaryData + ' : ' + getChannelInfo(chID=channelID, progItem='programOverview', infoType='nowPlaying')
Summary='Now Playing : ' + summaryData
if DEBUG=='Normal' or DEBUG=='Verbose':
Log.Debug(channelImageFile + ' - ' + channelArray[5])
Log.Debug(channelTitle + ', ' + channelURL + ', ' + channelImageFile + ', '
+ channelNumber + ', ' + channelName)
if menu=='Channels':
oc.add(CreateCO(url=channelURL, chID=channelID, title=channelTitle, summary=Summary, thumb=R(Thumb)))
return oc
####################################################################################################
@route(PREFIX + ‘/CreateCO’)
def CreateCO(url, chID, title, summary, thumb):
#check preferences for DLNA playback - *put in for future use currently uses DLNA no matter what*
co = TVShowObject(
rating_key = url,
key = Callback(CreateChannel, url=url, chID=chID, title=title, summary=summary, thumb=thumb),
title = title,
summary = summary,
thumb = thumb
)
if DEBUG=='Verbose':
Log.Debug(title + ', ' + url + ', ' + str(thumb))
return co
####################################################################################################
@route(PREFIX + ‘/CreateChannel’)
def CreateChannel(url, chID, title, summary, thumb, include_container=False):
Log.Debug(title)
oc = ObjectContainer(title2=title, no_cache=True)
#Get Start and end datetime and convert to seconds
startDt = getTime(datetime.datetime.utcnow())
endDt = int(startDt + (timedelta(days=(EPGDAYS))).total_seconds())
#build request string
sendCommand = 'GetEntries|{0}|{1}|{2}'.format(chID, startDt, endDt)
#Connect and get channel/program info
resultsArray = socketClient(sendCommand, '')
if DEBUG=='Normal' or DEBUG=='Verbose':
Log.Debug('Request sent: ' + sendCommand)
if DEBUG=='Verbose':
Log.Debug(resultsArray)
#Loop through resultsArray to build Channel objects
for result in resultsArray:
infoArray = result.split('|')
programID = infoArray[0] + '-' + infoArray[16]
programName = infoArray[1]
programStartDt = infoArray[3]
programEndDt = infoArray[4]
programOverview = infoArray[5]
programImage = infoArray[14]
programEpisodeTitle = infoArray[15]
try:
programRating = getRating(infoArray[8])
except:
programRating = 'NR'
if DEBUG=='Verbose':
Log.Debug(programID + ',' + programName + ',' + programStartDt + ',' + programEndDt +
',' + programOverview + ',' + programRating)
oc.add(
CreateEO(
url=url,
title=programName,
summary=programOverview,
thumb=programImage
))
return oc
####################################################################################################
@route(PREFIX + ‘/CreateEO/{title}’)
def CreateEO(url, title, summary, thumb, include_container=False):
#check preferences for DLNA playback - *put in for future use, currently uses DLNA no matter what*
if Prefs['serverwmc_playback']=='DLNA':
eo = EpisodeObject(
rating_key = url,
key = Callback(CreateEO, url=url, title=title, summary=summary, thumb=thumb, include_container=True),
title = title,
summary = summary,
duration = DURATION,
thumb=thumb,
items = [
MediaObject(
parts = [PartObject(key=(url))],
container = 'mpegts',
video_resolution = 1080,
bitrate = 20000,
video_codec = 'mpeg2video',
audio_codec = 'AC3',
optimized_for_streaming = True
)
]
)
else:
eo = EpisodeObject(
rating_key = url,
key = Callback(CreateEO, url=url, title=title, summary=summary, thumb=thumb, include_container=True),
title = title,
summary = summary,
duration = DURATION,
thumb=thumb,
items = [
MediaObject(
parts = [PartObject(key=(url))],
container = 'mpegts',
video_resolution = 1080,
bitrate = 20000,
video_codec = 'mpeg2video',
audio_codec = 'AC3',
optimized_for_streaming = True
)
]
)
if DEBUG=='Verbose':
Log.Debug(title + ', ' + url + ', ' + str(thumb))
if include_container:
return ObjectContainer(objects=[eo])
Log.Debug('ADDED CONTAINER - ' + title)
else:
Log.Debug('ADDED OBJECT - ' + title)
return eo