Beispiel #1
0
 def PlayMethod(self, url):
     if url.startswith('plugin://plugin'):
         playmethod = 'plugin'
     elif url.startswith('http'):
         playmethod = 'http'
     else:
         xbmc_executebuiltin.Notify(message='url format not correct',
                                    times=5000)
         koding.dolog('url format not correct %s' % url, line_info=True)
         playmethod = 'false'
     koding.dolog('PlayMethod = %s  %s' % (playmethod, url), line_info=True)
     return url, playmethod
Beispiel #2
0
 def httpplay(self, url, name):
     liz = xbmcgui.ListItem(name)
     liz.setInfo(type='Video', infoLabels={'Title': name})
     hmf = resolveurl.HostedMediaFile(url)
     koding.dolog('resolveurl HostedMediaFile = %s' % hmf.valid_url(),
                  line_info=True)
     if hmf.valid_url() == True:
         try:
             stream_url = hmf.resolve()
         except Exception as e:
             koding.dolog('{} {}'.format(url, e), line_info=True)
             xbmc_executebuiltin.Notify('{}'.format(e), times=5000)
             return
     else:
         stream_url = url
     try:
         xbmc.Player().play(stream_url, liz)
     except Exception as e:
         koding.dolog('{} {}'.format(url, e), line_info=True)
         xbmc_executebuiltin.Notify('{}'.format(e), times=5000)
         return
Beispiel #3
0
 def httpplay(self, url):
     hmf = resolveurl.HostedMediaFile(url)
     koding.dolog('resolveurl HostedMediaFile = %s' % hmf.valid_url(),
                  line_info=True)
     if hmf.valid_url() == True:
         stream_url = hmf.resolve()
     else:
         stream_url = stream_url
     try:
         xbmc.Player().play(stream_url)
     except:
         koding.dolog('httpplay method raised a error url = %s' %
                      stream_url,
                      line_info=True)
         xbmc_executebuiltin.Notify('Unable to play via httpplay method',
                                    times=5000)
Beispiel #4
0
def xml_item_count(source, block, tag_to_count):
	''' source == route to file can either be a url or special path
	block == master tag 
	tag_to_count == tag you wish to count
	returns a int value of count
	'''
	count = 0 
	if source.startswith('http'):
		source = koding.Open_URL(url=source,cookiejar=source)
	elif source.startswith('special'):
		source = koding.Physical_Path(source)
		source = koding.Text_File(source,'r')
	else:
		message = 'xml %s source not correct unable to count'%source
		koding.dolog(message,line_info=True)
		xbmc_executebuiltin.Notify(message=message)
	source_details = koding.Parse_XML(source, block, tag_to_count)
	for items in source_details:
		count += 1
	return count
 def play(self, url, name=''):
     url = xbmc_player().UrlDefine(url)
     url, playmethod = xbmc_player().PlayMethod(url)
     if not playmethod == 'false':
         if playmethod == 'plugin':
             koding.dolog('plugin PlayMethod = %s  %s' % (playmethod, url),
                          line_info=True)
             xbmc_player().pluginplay(url)
         elif playmethod == 'http':
             koding.dolog('http PlayMethod = %s  %s' % (playmethod, url),
                          line_info=True)
             xbmc_player().httpplay(url, name)
         else:
             xbmc_executebuiltin.Notify(message='PlayMethod not correct',
                                        times=5000)
             koding.dolog('PlayMethod not correct  %s' % url,
                          line_info=True)
             pass
     else:
         pass