PageRenderTime 27ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/repository/plugin.video.p2psport/default.py

https://gitlab.com/billyprice1/husham.com
Python | 280 lines | 221 code | 50 blank | 9 comment | 33 complexity | c4ceaea00c6c22062e1d0ff6f3e16846 MD5 | raw file
  1. # -*- coding: utf-8 -*-
  2. import re
  3. import urllib2
  4. import HTMLParser
  5. import urllib,urlparse
  6. import xbmcgui
  7. import xbmcplugin
  8. import xbmcaddon
  9. import requests
  10. from BeautifulSoup import BeautifulSoup as bs
  11. from utils.webutils import *
  12. from scrapers import *
  13. try:
  14. from addon.common.addon import Addon
  15. from addon.common.net import Net
  16. except:
  17. print 'Failed to import script.module.addon.common'
  18. xbmcgui.Dialog().ok("Import Failure", "Failed to import addon.common", "A component needed by P2P Sport is missing on your system", "Please visit www.tvaddons.ag.com for support")
  19. base_url = sys.argv[0]
  20. addon_handle = int(sys.argv[1])
  21. args = urlparse.parse_qs(sys.argv[2][1:])
  22. params=urlparse.parse_qs(sys.argv[2][1:])
  23. addon = Addon('plugin.video.p2psport', sys.argv)
  24. AddonPath = addon.get_path()
  25. def build_url(query):
  26. return base_url + '?' + urllib.urlencode(query)
  27. mode = args.get('mode', None)
  28. my_addon = xbmcaddon.Addon()
  29. if mode is None:
  30. url = build_url({'mode': 'av'})
  31. li = xbmcgui.ListItem('Arenavision.in',iconImage='http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg')
  32. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  33. listitem=li, isFolder=True)
  34. url = build_url({'mode': 'roja'})
  35. li = xbmcgui.ListItem('Rojadirecta.tn.my',iconImage='http://www.rojadirecta.me/static/roja.jpg')
  36. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  37. listitem=li, isFolder=True)
  38. url = build_url({'mode': 'ws'})
  39. li = xbmcgui.ListItem('Livefootball.ws',iconImage='http://www.userlogos.org/files/logos/clubber/football_ws___.PNG')
  40. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  41. listitem=li, isFolder=True)
  42. url = build_url({'mode': 'livefootballvideo.com'})
  43. li = xbmcgui.ListItem('Livefootballvideo.com',iconImage='https://pbs.twimg.com/profile_images/3162217818/2ee4b2f728ef9867d4e1d86e17bb2ef5.jpeg')
  44. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  45. listitem=li, isFolder=True)
  46. url = build_url({'mode': 'livefooty'})
  47. li = xbmcgui.ListItem('Livefootballol.com',iconImage='http://www.livefootballol.com/images/logo.png')
  48. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  49. listitem=li, isFolder=True)
  50. # url = build_url({'mode': 'livefootF1'})
  51. # li = xbmcgui.ListItem('Livefootballol.com (F1)',iconImage='http://www.livefootballol.com/images/logo.png')
  52. # xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  53. # listitem=li, isFolder=True)
  54. url = build_url({'mode': 'phace'})
  55. li = xbmcgui.ListItem('Sport Channels 1',iconImage='http://cdn.streamcentral.netdna-cdn.com/images/software/acestreamlogo.jpg')
  56. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  57. listitem=li, isFolder=True)
  58. url = build_url({'mode': 'serbplus'})
  59. li = xbmcgui.ListItem('Sport Channels 2',iconImage='http://cdn.streamcentral.netdna-cdn.com/images/software/acestreamlogo.jpg')
  60. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  61. listitem=li, isFolder=True)
  62. url = build_url({'mode': 'ttv', 'url':'http://livehdstreams.com/trash/ttv-list/ttv.sport.player.m3u'})
  63. li = xbmcgui.ListItem('Sport Channels 3',iconImage='http://cdn.streamcentral.netdna-cdn.com/images/software/acestreamlogo.jpg')
  64. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  65. listitem=li, isFolder=True)
  66. url = build_url({'mode': '1ttv'})
  67. li = xbmcgui.ListItem('1torrent.tv',iconImage='http://s3.hostingkartinok.com/uploads/images/2013/06/6e4452212490ac0a66e358c97707ef77.png')
  68. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  69. listitem=li, isFolder=True)
  70. url = build_url({'mode': 'ttv_sport', 'url':'http://livehdstreams.com/trash/ttv-list/ttv.sport.player.m3u'})
  71. li = xbmcgui.ListItem('Torrent-tv.ru (Sport)',iconImage='http://addons.tvaddons.ag/cache/images/bc591d6d5ec442d4ddb43a347a8be6_icon.png')
  72. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  73. listitem=li, isFolder=True)
  74. url = build_url({'mode': 'ttv_all', 'url':'http://livehdstreams.com/trash/ttv-list/ttv.sport.player.m3u'})
  75. li = xbmcgui.ListItem('Torrent-tv.ru',iconImage='http://addons.tvaddons.ag/cache/images/bc591d6d5ec442d4ddb43a347a8be6_icon.png')
  76. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  77. listitem=li, isFolder=True)
  78. # url = build_url({'mode': '247'})
  79. # li = xbmcgui.ListItem('Livesports 24/7',iconImage='http://i.imgur.com/Mv5ySt4.jpg')
  80. # xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  81. # listitem=li, isFolder=True)
  82. xbmcplugin.endOfDirectory(addon_handle)
  83. elif mode[0]=='ttv_sport':
  84. ttv_sport()
  85. elif mode[0]=='serbplus':
  86. serbplus()
  87. elif mode[0]=='play_serb':
  88. url=params['url'][0]
  89. name=params['name'][0]
  90. resolve_roja(url,name)
  91. elif mode[0]=='phace':
  92. phace()
  93. elif mode[0]=='247':
  94. url = build_url({'mode': 'schedule_247'})
  95. li = xbmcgui.ListItem('Event schedule',iconImage='http://i.imgur.com/Mv5ySt4.jpg')
  96. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  97. listitem=li, isFolder=True)
  98. url = build_url({'mode': 'all_247'})
  99. li = xbmcgui.ListItem('All channels',iconImage='http://i.imgur.com/Mv5ySt4.jpg')
  100. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  101. listitem=li, isFolder=True)
  102. xbmcplugin.endOfDirectory(addon_handle)
  103. elif mode[0]=='open_247_event':
  104. url=params['url'][0]
  105. open_247_event(url)
  106. elif mode[0]=='all_247':
  107. all_live247()
  108. elif mode[0]=='schedule_247':
  109. schedule247()
  110. elif mode[0]=='open_247_stream':
  111. url='http://pilkalive.weebly.com'+params['url'][0]
  112. name=params['name'][0]
  113. play247(url,name)
  114. elif mode[0]=='livefootballvideo.com':
  115. livefoot_com()
  116. elif mode[0]=='ttv_all':
  117. ttv_cats()
  118. elif mode[0]=='open_ttv_cat':
  119. cat=params['cat'][0]
  120. tag=params['channels'][0]
  121. get_ttv_cat(cat,tag)
  122. elif mode[0]=='1ttv':
  123. one_ttv_cats()
  124. elif mode[0]=='open_1ttv_cat':
  125. tag=params['tag'][0]
  126. name=params['name'][0]
  127. open_1ttv_cat(tag,name)
  128. elif mode[0]=='open_1ttv_channel':
  129. url=params['url'][0]
  130. open_1ttv_channel(url)
  131. elif mode[0]=='ws':
  132. livefootballws_events()
  133. elif mode[0]=='roja':
  134. rojadirecta_events()
  135. elif mode[0]=='ttv':
  136. get_ttv()
  137. elif mode[0]=='open_ttv_stream':
  138. url=params['url'][0]
  139. name=params['name'][0]
  140. open_ttv_stream(url,name)
  141. elif mode[0]=='av':
  142. url = build_url({'mode': 'av_schedule'})
  143. li = xbmcgui.ListItem('[COLOR orange]Schedule / Agenda[/COLOR]',iconImage='http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg')
  144. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  145. listitem=li, isFolder=True)
  146. for i in range(10):
  147. url = build_url({'mode': 'av_ace','url':'av%s'%(str(i+1)), 'name':'Arenavision %s'%(i+1)})
  148. li = xbmcgui.ListItem('Arenavision %s'%(i+1),iconImage='http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg')
  149. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  150. listitem=li, isFolder=True)
  151. for i in range(11,13):
  152. url = build_url({'mode': 'av_rand','url':'av%s'%(str(i+1)), 'name':'Arenavision %s'%(i)})
  153. li = xbmcgui.ListItem('Arenavision %s'%(i),iconImage='http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg')
  154. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  155. listitem=li, isFolder=True)
  156. for i in range(13,23):
  157. url = build_url({'mode': 'av_sop','url':'av%s'%(str(i+1)), 'name':'Arenavision %s'%(i)})
  158. li = xbmcgui.ListItem('Arenavision %s'%(i),iconImage='http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg')
  159. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  160. listitem=li, isFolder=True)
  161. for i in range(23,25):
  162. url = build_url({'mode': 'av_rand','url':'av%s'%(str(i+1)), 'name':'Arenavision %s'%(i)})
  163. li = xbmcgui.ListItem('Arenavision %s'%(i),iconImage='http://kodi.altervista.org/wp-content/uploads/2015/07/arenavision.jpg')
  164. xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
  165. listitem=li, isFolder=True)
  166. xbmcplugin.endOfDirectory(addon_handle)
  167. elif mode[0]=='av_ace':
  168. url='http://arenavision.in/'+params['url'][0]
  169. name=params['name'][0]
  170. play_arena(url,name)
  171. elif mode[0]=='av_sop':
  172. url='http://arenavision.in/'+params['url'][0]
  173. name=params['name'][0]
  174. play_arena_sop(url,name)
  175. elif mode[0]=='av_rand':
  176. url='http://arenavision.in/'+params['url'][0]
  177. name=params['name'][0]
  178. try:
  179. play_arena(url,name)
  180. except:
  181. play_arena_sop(url,name)
  182. elif mode[0]=='open_roja_stream':
  183. url='http://rojadirecta.tn.my/'+params['url'][0]
  184. name=params['name'][0]
  185. resolve_roja(url,name)
  186. elif mode[0]=='av_schedule':
  187. arenavision_schedule()
  188. elif mode[0]=='av_open':
  189. channels=((params['channels'][0]).replace('[','').replace(']','').replace("'",'').replace('u','').replace(' ','')).split(',')
  190. name=params['name'][0]
  191. sources=[]
  192. for i in range(len(channels)):
  193. title='AV%s'%channels[i]
  194. sources+=[title]
  195. dialog = xbmcgui.Dialog()
  196. index = dialog.select('Select a channel:', sources)
  197. if index>-1:
  198. url=sources[index]
  199. url='http://arenavision.in/'+url.lower()
  200. if (int(channels[index])<=10):
  201. play_arena(url,name)
  202. else:
  203. play_arena_sop(url,name)
  204. elif mode[0]=='livefooty':
  205. livefootballol()
  206. elif mode[0]=='open_livefoot':
  207. url='http://www.livefootballol.com'+params['url'][0]
  208. name=params['name'][0]
  209. get_livefoot(url,name)
  210. elif mode[0]=='open_livefoot_stream':
  211. url=params['url'][0]
  212. name=params['name'][0]
  213. play_livefoot(url,name)
  214. elif mode[0]=='livefootF1':
  215. livefootF1()
  216. elif mode[0]=='open_livefoot.com_stream':
  217. url=params['url'][0]
  218. name=params['name'][0]
  219. play_livefoot(url,name)
  220. open_com_event(name,url)
  221. elif mode[0]=='open_ws_stream':
  222. url=params['url'][0]
  223. livefootballws_streams(url)