Advertisement
Guest User

Kodi Kinoman.tv playback patch

a guest
May 31st, 2016
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 22.41 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import os, string, StringIO
  3. import urllib, urllib2, re, sys
  4. import xbmcaddon, xbmcgui, xbmcplugin
  5. import xbmc, traceback
  6.  
  7. scriptID = sys.modules[ "__main__" ].scriptID
  8. scriptname   = sys.modules[ "__main__" ].scriptname
  9. ptv = xbmcaddon.Addon(scriptID)
  10.  
  11. BASE_IMAGE_PATH = 'http://sd-xbmc.org/repository/xbmc-addons/'
  12. BASE_RESOURCE_PATH = os.path.join( ptv.getAddonInfo('path'), "../resources" )
  13. sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
  14.  
  15. import sdLog, sdParser, urlparser, sdCommon, sdNavigation, sdErrors, downloader
  16.  
  17. log = sdLog.pLog()
  18.  
  19. dstpath = ptv.getSetting('default_dstpath')
  20. dbg = sys.modules[ "__main__" ].dbg
  21.  
  22. username = ptv.getSetting('kinoman_login')
  23. password = ptv.getSetting('kinoman_password')
  24.  
  25. SERVICE = 'kinoman'
  26. MAINURL = 'http://www.kinoman.tv'
  27. VIP_URL = 'http://premium.kinoman.tv'
  28. LOGOURL = BASE_IMAGE_PATH + SERVICE + '.png'
  29. COOKIEFILE = ptv.getAddonInfo('path') + os.path.sep + "cookies" + os.path.sep + SERVICE + ".cookie"
  30. THUMB_NEXT = BASE_IMAGE_PATH + "dalej.png"
  31.  
  32. SEARCH_URL = MAINURL + '/szukaj?query='
  33. LIST_URL = MAINURL + '/filmy?'
  34. SERIAL_URL = MAINURL + '/seriale'
  35.  
  36. SERVICE_MENU_TABLE = {
  37.     1: "Kategorie filmowe",
  38.     2: "Typy filmów",
  39.     3: "Ostatnio dodane",
  40.     4: "Najwyżej ocenione",
  41.     5: "Najczęściej oceniane",
  42.     6: "Najczęściej oglądane",
  43.     7: "Ulubione",
  44.     8: "Najnowsze",
  45.     9: "Seriale",
  46.     10: "Wyszukaj",
  47.     11: "Historia wyszukiwania"
  48. }
  49.  
  50. class Kinoman:
  51.     def __init__(self):
  52.     log.info('Loading ' + SERVICE)
  53.     self.parser = sdParser.Parser()
  54.     self.up = urlparser.urlparser()
  55.     self.cm = sdCommon.common()
  56.     self.history = sdCommon.history()
  57.     self.exception = sdErrors.Exception()
  58.     self.gui = sdNavigation.sdGUI()
  59.  
  60.     def setTable(self):
  61.     return SERVICE_MENU_TABLE
  62.  
  63.     def listsMainMenu(self, table):
  64.     for num, val in table.items():
  65.         params = {'service': SERVICE, 'name': 'main-menu', 'title': val, 'category': val, 'icon':LOGOURL}
  66.         self.gui.addDir(params)
  67.     self.gui.endDir()
  68.  
  69.     def listsFiltersMenu(self, filter):
  70.     query_data = { 'url': MAINURL + '/filmy', 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  71.     try:
  72.         data = self.cm.getURLRequestData(query_data)
  73.     except Exception, exception:
  74.         traceback.print_exc()
  75.         self.exception.getError(str(exception))
  76.         exit()
  77.    
  78.     match = re.findall('<a[^>]+data-value="([^"]*)"[^>]*data-filter="' + filter + '[^"]*"[^>]*>(.*?)</a>\s*(?:<span[^>]*>(.*?)</span>)?', data, re.S)
  79.     if len(match) > 0:
  80.         for i in range(len(match)):
  81.         title = match[i][1]
  82.         if (len(match[i]) > 2):
  83.             title = title + ' [COLOR=white]' + match[i][2] + '[/COLOR]'
  84.         params = {'service': SERVICE, 'name': 'category', 'title': title, 'category': filter + '%5b0%5d=' + match[i][0], 'icon':LOGOURL}
  85.         self.gui.addDir(params)
  86.  
  87.     self.gui.endDir(True)
  88.  
  89.     def formatMatch(self, match):
  90.    
  91.     result = {}
  92.    
  93.     reClean = re.compile('<[^>]+>|^\s*|\s*$', re.S)
  94.     reSpace = re.compile('\s+', re.S)
  95.     reComma = re.compile('\s+,\s*', re.S)
  96.    
  97.     for (name, value) in match.items():
  98.         if value:
  99.             if name == 'title' or name == 'plot' or name == 'genre':
  100.                 value = reSpace.sub(' ', reClean.sub('', value))
  101.                 if name == 'genre':
  102.                     value = reComma.sub(', ', value)
  103.             if name == 'icon':
  104.                 value = value.replace('m.jpg', 'o.jpg')
  105.             if  name == 'page':
  106.                 value = MAINURL + value
  107.             if name == 'code':
  108.                 if value == 'PL':
  109.                     color = 'lime'
  110.                 elif value == 'Dubbing':
  111.                     color = 'blue'
  112.                 elif value == 'Lektor':
  113.                     color = 'green'
  114.                 elif value == 'Napisy':
  115.                     color = 'yellow'
  116.                 else:
  117.                     color = 'red'
  118.                 value = '[COLOR=' + color + ']' + value + '[/COLOR]';
  119.            
  120.             result[name] = self.cm.html_entity_decode(value)
  121.        
  122.     return result
  123.  
  124.     def endDir(self, type):
  125.    
  126.     if type == 'movies':
  127.         listMask = '%P [[COLOR=white]%Y[/COLOR]] %R'
  128.         viewMode = 'MediaInfo'
  129.     elif type == 'episodes':
  130.         listMask = '[[COLOR=white]%H [/COLOR]]%Z'
  131.         viewMode = 'List'
  132.     else:
  133.         listMask = None
  134.         viewMode = None
  135.    
  136.     if listMask:
  137.         xbmcplugin.addSortMethod(int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE, label2Mask = listMask )
  138.    
  139.     self.gui.endDir(False, type, viewMode)
  140.  
  141.     def getFilmTab(self, url, category, pager):
  142.         #xbmcgui.Dialog().ok('url', url)
  143.     query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  144.     try:
  145.         data = self.cm.getURLRequestData(query_data)
  146.     except Exception, exception:
  147.         traceback.print_exc()
  148.         self.exception.getError(str(exception))
  149.         exit()
  150.    
  151.     matches = re.compile('<div[^>]+class="[^"]*movie-item[^"]*"[^>]*>.*?<img[^>]+src="(?P<icon>[^"]*)"[^>]*>.*?<a[^>]+class="[^"]*title[^"]*"[^>]*href="(?P<page>[^"]+)"[^>]*>\s*(?P<title>.+?)(?:\((?P<year>\d{4})\).*?)?\s*(?:\[\s*(?P<code>\w+)\s*\].*?)?\s*</a>.*?<p[^>]+class="[^"]*cats[^"]*"[^>]*>\s*(?P<genre>[^\|]+)\|\s*Ocena:\s*(?P<rating>[0-9\.]+).*?</p>.*?<p[^>]+class="[^"]*desc[^"]*"[^>]*>\s*(?P<plot>.+?)\s*</p>.*?<div[^>]+class="[^"]*clearfix[^"]*"[^>]*>', re.S)
  152.    
  153.     for match in matches.finditer(data):
  154.         params = self.formatMatch(match.groupdict())
  155.         params.update({ 'service': SERVICE, 'dstpath': dstpath })
  156.        
  157.         self.gui.playVideo(params)
  158.    
  159.     if re.search('<li><a href="/filmy[^"]*" rel="next">&raquo;</a></li>', data, re.S):
  160.         params = {'service': SERVICE, 'name': 'nextpage', 'category': category, 'title': 'Następna strona', 'page': str(int(pager) + 1), 'icon': THUMB_NEXT }
  161.         self.gui.addDir(params)
  162.    
  163.     self.endDir('movies')
  164.  
  165.     def getSerialCategories(self, url, category):
  166.     query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  167.     try:
  168.         data = self.cm.getURLRequestData(query_data)
  169.     except Exception, exception:
  170.         traceback.print_exc()
  171.         self.exception.getError(str(exception))
  172.         exit()
  173.     if category == '0 - 9':
  174.         matchAll = re.compile('id="letter_0-9"(.+?)<div class="offset1', re.S).findall(data);
  175.     else:
  176.         matchAll = re.compile('id="letter_' + category + '"(.+?)<div class="offset1', re.S).findall(data);
  177.     if len(matchAll) > 0:
  178.         match = re.compile('<a href="(.+?)" class="pl-corners">(.+?)<span class="subtitle".+?</span></a>').findall(matchAll[0]);
  179.         if len(matchAll) > 0:
  180.         for i in range(len(match)):
  181.             title = match[i][1].replace('<span class="label label-important">NOWE</span> ', '')
  182.             params = { 'service': SERVICE, 'name': 'getSeason', 'tvshowtitle': title, 'title': self.cm.html_entity_decode(title), 'page': MAINURL + match[i][0], 'icon': LOGOURL }
  183.             self.gui.addDir(params)
  184.     self.gui.endDir(False, 'tvshows')
  185.  
  186.     def listsABCMenu(self, table):
  187.     for i in range(len(table)):
  188.         params = {'service': SERVICE, 'name': 'abc-menu','category': table[i], 'title': table[i], 'icon':'' }
  189.         self.gui.addDir(params)
  190.     self.gui.endDir()
  191.  
  192.     def listsHistory(self, table, ser):
  193.     for i in range(len(table)):
  194.         if table[i] <> '':
  195.         params = {'service': SERVICE, 'name': 'history', 'category': ser, 'title': table[i],'icon':'' }
  196.         self.gui.addDir(params)
  197.     self.gui.endDir()
  198.  
  199.     def searchTab(self, url, sType):
  200.         print url
  201.     query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  202.     try:
  203.         data = self.cm.getURLRequestData(query_data)
  204.     except Exception, exception:
  205.         traceback.print_exc()
  206.         self.exception.getError(str(exception))
  207.         exit()
  208.    
  209.     if sType == 'movies':
  210.         reLabel = 'Filmy'
  211.         reTitle = '(?P<title>.+?)(?:\((?P<year>\d{4}(?:-\d{4})?)\).*?)?\s*(?:\[\s*(?P<code>\w+)\s*\].*?)?'
  212.     elif sType == 'tvshows':
  213.         reLabel = 'Seriale'
  214.         reTitle = '(?P<title>.+?)'
  215.     else:
  216.         exit()
  217.  
  218.     matchIn = re.findall('<div[^>]+class="[^"]*results_title[^"]*"[^>]*>[^<]*' + reLabel + '[^<]*</div>.*?<div[^>]+class="[^"]*results_title[^"]*"[^>]*>', data, re.S)[0]
  219.     matches = re.compile('<div[^>]+class="[^"]*result box[^"]*"[^>]*>.*?<img[^>]+src="(?P<icon>[^"]*)"[^>]*>.*?<a[^>]+href="(?P<page>[^"]+)"[^>]*class="[^"]*pl-white[^"]*"[^>]*>\s*' + reTitle + '\s*</a>.*?<span[^>]+class="[^"]*small-bread[^"]*"[^>]*>\s*(?P<genre>[^<]+).*?Ocena[^\d]+(?P<rating>[\d\.]+).*?<p[^>]*>\s*(?P<plot>.+?)\s*</p>.*?</button>', re.S)
  220.    
  221.     for match in matches.finditer(matchIn):
  222.         params = self.formatMatch(match.groupdict())
  223.         if sType == 'movies':
  224.             params.update({'service': SERVICE, 'dstpath': dstpath })
  225.             self.gui.playVideo(params)
  226.         elif sType == 'tvshows':
  227.             params.update({ 'service': SERVICE, 'name': 'getSeason', 'tvshowtitle': params['title'] })
  228.             self.gui.addDir(params)
  229.    
  230.     self.endDir(sType)
  231.  
  232.     def getSeasonTab(self, url, serial):
  233.     query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  234.     try:
  235.         data = self.cm.getURLRequestData(query_data)
  236.     except Exception, exception:
  237.         traceback.print_exc()
  238.         self.exception.getError(str(exception))
  239.         exit()
  240.     icon = re.compile('<img src="(.+?)" alt=""/>').findall(data)
  241.     img = icon[0].replace('m.jpg', 'o.jpg')
  242.     match = re.compile('<button data-action="scrollTo" data-scroll="(.+?)"').findall(data)
  243.     if len(match) > 0:
  244.         for i in range(len(match)):
  245.                 title = match[i].replace('_', ' ').capitalize()
  246.         params = {'service': SERVICE, 'name': 'getEpisodes', 'season': match[i], 'tvshowtitle': serial, 'title': title, 'page': url, 'icon': img}
  247.         self.gui.addDir(params)
  248.     self.gui.endDir(True)
  249.  
  250.     def getEpisodesTab(self, url, serial, sezon, icon):
  251.     query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  252.     try:
  253.         data = self.cm.getURLRequestData(query_data)
  254.     except Exception, exception:
  255.         traceback.print_exc()
  256.         self.exception.getError(str(exception))
  257.         exit()
  258.     matchAll = re.compile('style="margin:0;margin-top:10px;" id="'+sezon+'">(.+?)<div class="p10"></div>', re.DOTALL).findall(data)
  259.     if len(matchAll) > 0:
  260.         match = re.compile('<a class="o" href="(.+?)/(.+?)/(.+?)">[^(]+\(([^)]+).*?</a>').findall(matchAll[0])
  261.         if len(match) > 0:
  262.         for i in range(len(match)):
  263.             page = MAINURL + match[i][0]+'/'+match[i][1]+'/'+match[i][2]
  264.             print page
  265.             #title = '%s - %s - %s' % (serial, match[i][1], self.cm.html_entity_decode(match[i][3]))
  266.             title = self.cm.html_entity_decode(match[i][3])
  267.             temp = re.findall('\w0*(\d+)', match[i][1])
  268.             print title
  269.             params = {'service': SERVICE, 'dstpath': dstpath, 'season': temp[0], 'episode': temp[1], 'tvshowtitle': serial, 'title': title, 'page': page, 'icon': icon}
  270.             self.gui.playVideo(params)
  271.     self.endDir('episodes')
  272.  
  273.     def getHostTable(self,url):
  274.     videoID = ''
  275.     query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  276.     try:
  277.         link = self.cm.getURLRequestData(query_data)
  278.     except Exception, exception:
  279.         traceback.print_exc()
  280.         self.exception.getError(str(exception))
  281.         exit()
  282.     match = re.compile('class="player-wrapper" id="player_(.+?)"').findall(link)
  283.     if len(match) > 0:
  284.         for i in range(len(match)):
  285.             query_data = { 'url': MAINURL+'/players/init/' + match[i], 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True}
  286.             try:
  287.                 link = self.cm.getURLRequestData(query_data)
  288.             except Exception, exception:
  289.                 traceback.print_exc()
  290.                 self.exception.getError(str(exception))
  291.                 exit()
  292.             data = link.replace('\\', '')
  293.             match = re.compile('"data":"(.+?)"').findall(data)
  294.             if len(match) > 0:
  295.                         query_data = { 'url': MAINURL+'/players/get', 'use_host': False, 'use_cookie': False, 'use_post': True, 'return_data': True}
  296.                         post_data = { 'hash' : match[0] }
  297.                         try:
  298.                             link = self.cm.getURLRequestData(query_data, post_data)
  299.                         except Exception, exception:
  300.                             traceback.print_exc()
  301.                             self.exception.getError(str(exception))
  302.                             exit()
  303.                         #ShowNormalPlayer('http://static-kinoman.tv:8989/balancer/vip/123088',
  304.                         #match = re.compile('src="(.+?)"').findall(link)
  305.                         #<iframe src="http://www.vidzer.net/e/902b9f6ff61fb13e8768aa1a65d760a1?w=631&h=425&name=Elle.s'en.va" width="631" height="425" scrolling="no" frameborder="0"></iframe>
  306.                        
  307.                         match = re.search('src="([^"]+?)"', link)
  308.                         if match:
  309.                             videoID = self.getURLForNonPremiumUser( match.group(1))
  310.                         else:
  311.                             match = re.search("""ShowNormalPlayer\('([^']+?)',""", link)
  312.                             if match:
  313.                                 videoID = match.group(1)
  314.                                 log.info("final url: " + videoID)
  315.                                 break          
  316.        
  317.             return videoID
  318.  
  319.     def getResolvedURL(self, url):
  320.         url = self.up.getVideoLink( url )
  321.         if isinstance(url, basestring):
  322.             return url
  323.         else:
  324.             return ""
  325.  
  326.     def getURLForNonPremiumUser(self, url):
  327.         query_data = {'url': url, 'use_host': False, 'use_cookie': False, 'use_post': True, 'return_data': True}
  328.         post_data = {'ok': 'yes', 'confirm': 'Close+Ad+and+Watch+as+Free+User', 'submited': 'true'}
  329.         data = self.cm.getURLRequestData(query_data, post_data)
  330.         # Extract URL from following HTML code:
  331.         # <a
  332.         #     href="http://95.211.139.24/speed/80k/C8/B6/IICDCOHR.flv?md5=dEuiAAbqKf2TxQx69rasQg&expires=1464640010&w=631&h=425&name=Christmas.Comes.But.Once.a.Year&action=page%2Findex&query=e%2Fe151fae060d03e19e03bc4cd82141af8%3Fw%3D631%26h%3D425%26name%3DChristmas.Comes.But.Once.a.Year&code=e151fae060d03e19e03bc4cd82141af8"
  333.         #     style="display:block;width:100%;height:400px"
  334.         #     id="player">
  335.         match = re.search('href="([^"]+?)"(.*\n){2}.*id="player"', data, re.MULTILINE)
  336.         if match:
  337.             return match.group(1)
  338.         else:
  339.             log.info("Unable to extract video URL")
  340.             return ""
  341.  
  342.     def getHostingTable(self,url):
  343.     videoID = ''
  344.     query_data = { 'url': url.replace(MAINURL, VIP_URL), 'use_host': False, 'use_cookie': True, 'save_cookie': False, 'load_cookie': True, 'cookiefile': COOKIEFILE, 'use_post': False, 'return_data': True}
  345.     try:
  346.         link = self.cm.getURLRequestData(query_data)
  347.     except Exception, exception:
  348.         traceback.print_exc()
  349.         self.exception.getError(str(exception))
  350.         exit()
  351.     match = re.compile('class="player-wrapper" id="player_(.+?)"').findall(link)
  352.     if len(match) > 0:
  353.         for i in range(len(match)):
  354.                 query_data = { 'url': VIP_URL+'/players/init/' + match[i], 'use_host': False, 'use_cookie': True, 'save_cookie': False, 'load_cookie': True, 'cookiefile': COOKIEFILE, 'use_post': False, 'return_data': True}
  355.         try:
  356.             link = self.cm.getURLRequestData(query_data)
  357.         except Exception, exception:
  358.             traceback.print_exc()
  359.             self.exception.getError(str(exception))
  360.             exit()
  361.         data = link.replace('\\', '')
  362.         match = re.compile('"data":"(.+?)"').findall(data)
  363.         if len(match) > 0:
  364.                     query_data = { 'url': VIP_URL+'/players/get', 'use_host': False, 'use_cookie': True, 'save_cookie': False, 'load_cookie': True, 'cookiefile': COOKIEFILE, 'use_post': True, 'return_data': True}
  365.                     post_data = { 'hash' : match[0], 'type' : 'vip' }
  366.                     try:
  367.                         link = self.cm.getURLRequestData(query_data, post_data)
  368.                     except Exception, exception:
  369.                         traceback.print_exc()
  370.                         self.exception.getError(str(exception))
  371.                         exit()
  372.                     match = re.compile("ShowNormalPlayer.+?'(.+?)',").findall(link)
  373.                     if len(match) > 0:
  374.                         videoID = match[0] + '|Referer=http://www.kinoman.tv/assets/kinoman.tv/swf/flowplayer-3.2.7.swf'
  375.                         log.info("final link: " + videoID)
  376.                         return videoID
  377.  
  378.     def mobileAuth(self):
  379.         if username == '' or password == '':
  380.             return False
  381.        
  382.         try:
  383.             data = { 'use_host': False, 'use_post': False, 'return_data': True, 'use_cookie': True, 'save_cookie': True, 'load_cookie': True, 'cookiefile': COOKIEFILE }
  384.            
  385.             data['url'] = 'http://m.kinoman.tv/account/login'
  386.             form = self.cm.getURLRequestData(data)
  387.             vals = re.compile('<input.*?name=".*?time.*?".*?value="(\d+)"[^>]*?>.*?<input.*?name=".*?hash.*?".*?value="(\w+)"[^>]*?>', re.S).findall(form)
  388.            
  389.             data['url'] = 'http://www.kinoman.tv/auth/mobileLogin?time=' + vals[0][0] + '&hash=' + vals[0][1] + '&login=' + username + '&password=' + password
  390.             init = self.cm.getURLRequestData(data)
  391.            
  392.             data['url'] = 'http://www.kinoman.tv/tool/getUser?time=' + vals[0][0]
  393.             user = self.cm.getURLRequestData(data)
  394.             code = re.compile('"(\w+)"', re.S).findall(user)
  395.            
  396.             data['url'] = 'http://m.kinoman.tv/account/login'
  397.             data['use_post'] = True
  398.             auth = self.cm.getURLRequestData(data, { 'hash': code[0] })
  399.            
  400.             return auth.index('success') > 0
  401.            
  402.         except Exception, exception:
  403.             return False
  404.  
  405.     def getHostingMobile(self, page):
  406.         try:
  407.             data = { 'use_host': False, 'use_post': False, 'return_data': True, 'use_cookie': True, 'save_cookie': True, 'load_cookie': True, 'cookiefile': COOKIEFILE }
  408.            
  409.             data['url'] = 'http://m.kinoman.tv/filmy' + page[page.rindex('/'):]
  410.             init = self.cm.getURLRequestData(data)
  411.             base = re.compile('<div[^>]*?role="[^"]*?main[^"]*?"[^>]*?class="[^"]*?ui-content[^"]*?jqm-content[^"]*?"[^>]*?>.*?<a.*?href="([^"]+)"[^>]*?>', re.S).findall(init)
  412.            
  413.             data['url'] = base[0]
  414.             show = self.cm.getURLRequestData(data)
  415.             link = re.compile('<a.*?href="([^"]+)"[^>]*?id="player"[^>]*?>', re.S).findall(show)
  416.            
  417.             return link[0]
  418.            
  419.         except Exception, exception:
  420.             return ''
  421.  
  422.     def getMediaType(self):
  423.     mediaTypes = { 'movies': 'Filmy', 'tvshows': 'Seriale' }
  424.     typeIndex = xbmcgui.Dialog().select("Co chcesz znaleść?", mediaTypes.values())
  425.     if typeIndex >= 0:
  426.         return mediaTypes.keys()[typeIndex]
  427.     return None
  428.  
  429.     def handleService(self):
  430.     params = self.parser.getParams()
  431.     name = self.parser.getParam(params, "name")
  432.     title = self.parser.getParam(params, "title")
  433.     category = self.parser.getParam(params, "category")
  434.     page = self.parser.getParam(params, "page")
  435.     icon = self.parser.getParam(params, "icon")
  436.     link = self.parser.getParam(params, "url")
  437.     service = self.parser.getParam(params, "service")
  438.     action = self.parser.getParam(params, "action")
  439.     path = self.parser.getParam(params, "path")
  440.     sezon = self.parser.getParam(params, "season")
  441.     epizod = self.parser.getParam(params, "episode")
  442.     serial = self.parser.getParam(params, "tvshowtitle")
  443.  
  444.     self.parser.debugParams(params, dbg)
  445.  
  446.     if str(page) == 'None' or page == '': page = '1'
  447.  
  448.     #MAIN MENU
  449.     if name == None:
  450.         #logowanie
  451.         if username == '' or password == '': loginData = {}
  452.         else: loginData = { 'username': username, 'password': password, "submit_login": "login", "submit": "" }
  453.         self.cm.requestLoginData(MAINURL + "/auth/login", '<a href="/auth/logout">wyloguj', COOKIEFILE, loginData)
  454.         self.mobileAuth()
  455.         self.listsMainMenu(SERVICE_MENU_TABLE)
  456.     #KATEGORIE FILMOWE
  457.     elif category == self.setTable()[1]:
  458.         self.listsFiltersMenu('genres')
  459.     #TYPY FILMÓW
  460.     elif category == self.setTable()[2]:
  461.         self.listsFiltersMenu('types')
  462.     #OSTATNIO DODANE
  463.     elif category == self.setTable()[3]:
  464.         url = LIST_URL + 'p=' + page
  465.         self.getFilmTab(url, category, page)
  466.     #NAJWYŻEJ OCENIONE
  467.     elif category == self.setTable()[4]:
  468.         url = LIST_URL + 'sorting=movie.rate&p=' + page
  469.         self.getFilmTab(url, category, page)
  470.     #NAJCZĘŚCIEJ OCENIANE
  471.     elif category == self.setTable()[5]:
  472.         url = LIST_URL + 'sorting=total_rates&p=' + page
  473.         self.getFilmTab(url, category, page)
  474.     #NAJCZĘŚCIEJ OGLĄDANE
  475.     elif category == self.setTable()[6]:
  476.         url = LIST_URL + 'sorting=movie.views&p=' + page
  477.         self.getFilmTab(url, category, page)
  478.     #ULUBIONE
  479.     elif category == self.setTable()[7]:
  480.         url = LIST_URL + 'sorting=total_favs&p=' + page
  481.         self.getFilmTab(url, category, page)
  482.     #NAJNOWSZE
  483.     elif category == self.setTable()[8]:
  484.         url = LIST_URL + 'sorting=movie.created&p=' + page
  485.         self.getFilmTab(url, category, page)
  486.     #SERIALE
  487.     elif category == self.setTable()[9]:
  488.         self.listsABCMenu(self.cm.makeABCList())
  489.     #WYSZUKAJ
  490.     elif category == self.setTable()[10]:
  491.         sType = self.getMediaType()
  492.         if sType:
  493.             sText = self.gui.searchInput(SERVICE + sType)
  494.             if sText:
  495.                 self.searchTab(SEARCH_URL + sText, sType)
  496.     #HISTORIA WYSZUKIWANIA
  497.     elif category == self.setTable()[11]:
  498.         sType = self.getMediaType()
  499.         if sType:
  500.             sText = self.history.loadHistoryFile(SERVICE + sType)
  501.             self.listsHistory(sText, sType)
  502.     if name == 'history':
  503.         self.searchTab(SEARCH_URL + title, category)
  504.     #LISTA SERIALI
  505.     if name == 'abc-menu':
  506.         self.getSerialCategories(SERIAL_URL, category)
  507.     if name == 'getSeason':
  508.         self.getSeasonTab(page, title)
  509.     if name == 'getEpisodes':
  510.         self.getEpisodesTab(page, serial, sezon, icon)
  511.     #LISTA FILMÓW
  512.     if name == 'category' or name == 'nextpage':
  513.         if category not in self.setTable().values():
  514.         self.getFilmTab(LIST_URL + category + '&p=' + page, category, page)
  515.     #ODTWÓRZ VIDEO
  516.     if name == 'playSelectedVideo':
  517.         linkVideo = None
  518.         if username != '' and password != '':
  519.         linkVideo = self.getHostingTable(page)
  520.         if linkVideo == None:
  521.         videoID = self.getHostTable(page)
  522.         if videoID != False:
  523.                     linkVideo = videoID                  
  524.                     #linkVideo = self.up.getVideoLink(videoID)
  525.         else:
  526.                     d = xbmcgui.Dialog()
  527.             d.ok(SERVICE + ' - przepraszamy', 'Ten materiał nie został jeszcze dodany,', 'albo jest dostępny tylko dla konta Standard lub Premium', 'Zapraszamy w innym terminie.')
  528.             return False
  529.         if linkVideo == None or linkVideo == '':
  530.             linkVideo = self.getHostingMobile(page)
  531.         self.gui.LOAD_AND_PLAY_VIDEO(linkVideo, title)
  532.     #POBIERZ
  533.     if action == 'download' and link != '':
  534.         self.cm.checkDir(os.path.join(dstpath, SERVICE))
  535.         if link.startswith('http://'):
  536.         linkVideo = None
  537.         if username != '' and password != '':
  538.             linkVideo = self.getHostingTable(link)
  539.         if linkVideo == None:
  540.             linkVideo = self.up.getVideoLink(self.getHostTable(link))
  541.         if linkVideo != False:
  542.             dwnl = downloader.Downloader()
  543.             dwnl.getFile({ 'title': title, 'url': linkVideo, 'path': path })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement