def convertList(self, cList): hostList = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if cItem['type'] == 'category': type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO page = cItem.get('page', '') if '' != page: hostLinks.append(CUrlItem("Link", page, 1)) title = cItem.get('title', '') description = cItem.get('plot', '') icon = cItem.get('icon', '') hostItem = CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon) hostList.append(hostItem) return hostList
def converItem(self, cItem): searchTypesOptions = [] # ustawione alfabetycznie hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO urls = cItem.get('urls', []) for urlItem in urls: hostLinks.append(CUrlItem(urlItem['name'], urlItem['url'], 0)) title = clean_html(cItem.get('title', '')) description = clean_html(cItem.get('plot', '')) icon = cItem.get('icon', '') hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=0, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) return hostItem
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append(("Seriale", "seriale")) searchTypesOptions.append(("Filmy", "filmy")) for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) elif cItem['type'] == 'article': type = CDisplayListItem.TYPE_ARTICLE url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = clean_html(cItem.get('title', '').decode("utf-8")).encode("utf-8") description = clean_html(cItem.get( 'plot', '').decode("utf-8")).encode("utf-8") icon = cItem.get('icon', '') hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def getResolvedURL(self, url): # resolve url to get direct url to video file retlist = [] urlList = self.host.getVideoLinks(url) for item in urlList: need_resolve = 0 retlist.append(CUrlItem(item["name"], item["url"], need_resolve)) return RetHost(RetHost.OK, value=retlist)
def getLinksForVideo(self, Index=0, selItem=None): retCode = RetHost.ERROR retlist = [] if not self.isValidIndex(Index): return RetHost(retCode, value=retlist) urlList = self.host.Search_videoclip(self.host.currList[Index].get( 'page', '')) for item in urlList: need_resolve = 0 retlist.append(CUrlItem(item["name"], item["url"], need_resolve)) return RetHost(RetHost.OK, value=retlist)
def getLinksForVideo(self, Index = 0, selItem = None): retCode = RetHost.ERROR retlist = [] if not self.isValidIndex(Index): return RetHost(retCode, value=retlist) urlList = self.host.getLinksForVideo(self.host.currList[Index]) for item in urlList: retlist.append(CUrlItem(item["name"], item["url"], item['need_resolve'])) return RetHost(RetHost.OK, value = retlist)
def convertList(self, cList): hostList = [] searchTypesOptions = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) elif cItem['type'] == 'article': type = CDisplayListItem.TYPE_ARTICLE url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = clean_html(cItem.get('desc', '')) icon = self.host.getFullUrl(cItem.get('icon', '')) hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] possibleTypesOfSearch = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if cItem['type'] in ['main', 'sub', 'subSub', 'subSubPage']: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO videoID = '' if 'url' in cItem: url = cItem['url'] hostLinks.append(CUrlItem('', url, 0)) elif cItem['type'] == 'search': type = CDisplayListItem.TYPE_SEARCH name = ' ' if 'name' in cItem: name = cItem['name'] opis = '' if 'opis' in cItem: opis = cItem['opis'] ilosc = '' if 'ilosc' in cItem: ilosc = '(' + cItem['ilosc'] + ')' ico = '' if 'ico' in cItem: ico = cItem['ico'] if ico == '': ico = 'http://mamrodzine.pl/wp-content/uploads/2011/06/logo_transparent.png' hostItem = CDisplayListItem( name=name + ' ' + ilosc, description=opis, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=ico, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) # end for return hostList #host = Spryciarze() #host.getMainCategory() #host.getVideoList('http://kulinaria.spryciarze.pl/kategorie/dania-miesne') #host.getVideoLinks('58763')
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie searchTypesOptions.append((_("Live now"), "live")) searchTypesOptions.append((_("Recordings"), "video")) for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO if type in [ CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO ]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = self.host._getStr(cItem.get('title', '')) description = self.host._getStr(cItem.get('desc', '')).strip() icon = self.host._getStr(cItem.get('icon', '')) hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def getLinksForVideo(self, Index=0, selItem=None): listLen = len(self.host.currList) if listLen < Index and listLen > 0: printDBG( "ERROR getLinksForVideo - current list is to short len: %d, Index: %d" % (listLen, Index)) return RetHost(RetHost.ERROR, value=[]) if self.host.currList[Index]["type"] != 'video': printDBG("ERROR getLinksForVideo - current item has wrong type") return RetHost(RetHost.ERROR, value=[]) retlist = [] urlList = self.host.getHostingTable(self.host.currList[Index]["url"]) for item in urlList: retlist.append(CUrlItem(item["name"], item["url"], 0)) return RetHost(RetHost.OK, value=retlist)
def getLinksForVideo(self, Index = 0, selItem = None): listLen = len(self.host.currList) if listLen <= Index or Index < 0: printDBG( "ERROR getLinksForVideo - current list is to short len: %d, Index: %d" % (listLen, Index) ) return RetHost(RetHost.ERROR, value = []) if self.host.currList[Index]["type"] not in ['audio', 'video']: printDBG( "ERROR getLinksForVideo - current item has wrong type" ) return RetHost(RetHost.ERROR, value = []) retlist = [] urlList = self.host.getLinksForVideo(self.host.currList[Index]) for item in urlList: need_resolve = 0 name = self.host._getStr( item["name"] ) url = item["url"] retlist.append(CUrlItem(name, url, need_resolve)) return RetHost(RetHost.OK, value = retlist)
def converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append((_("Movies"), "movie")) #searchTypesOptions.append((_("TV Shows"), "series")) hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO if type in [CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = cItem.get('desc', '') icon = cItem.get('icon', '') if icon == '': icon = self.host.DEFAULT_ICON_URL isGoodForFavourites = cItem.get('good_for_fav', False) return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch, isGoodForFavourites=isGoodForFavourites)
def getLinksForVideo(self, Index=0, selItem=None): listLen = len(self.host.currList) if listLen < Index and listLen > 0: print "ERROR getLinksForVideo - current list is to short len: %d, Index: %d" % ( listLen, Index) return RetHost(RetHost.ERROR, value=[]) selItem = self.host.currList[Index] if selItem['type'] != 'video': print "ERROR getLinksForVideo - current item has wrong type" return RetHost(RetHost.ERROR, value=[]) retlist = [] if None != selItem and 'url' in selItem and 1 < len(selItem['url']): tmpList = self.host.getVideoLinks(selItem['url']) for item in tmpList: retlist.append(CUrlItem(item['name'], item['url'], 0)) return RetHost(RetHost.OK, value=retlist)
def getLinksForVideo(self, Index=0, selItem=None): listLen = len(self.host.currList) if listLen < Index and listLen > 0: printDBG( "ERROR getLinksForVideo - current list is to short len: %d, Index: %d" % (listLen, Index)) return RetHost(RetHost.ERROR, value=[]) retlist = [] if 'ekstraklasa.tv' in self.host.currList[Index].get('host', ''): tab = self.host.getLinks_ETV(self.host.currList[Index].get( 'url', '')) tmp = tab tab = [] for item in tmp: if item[0] == Ekstraklasa.ETV_FORMAT: tab.append(item) def __getLinkQuality(itemLink): return int(itemLink[2]) maxRes = int(config.plugins.iptvplayer.ekstraklasa_defaultformat. value) * 1.1 tab = CSelOneLink(tab, __getLinkQuality, maxRes).getSortedLinks() printDBG( ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. tab[%s]" % tab) if config.plugins.iptvplayer.ekstraklasa_usedf.value and 0 < len( tab): tab = [tab[0]] for item in tab: nameLink = "type: %s \t bitrate: %s" % (item[0], item[2]) url = item[1] retlist.append( CUrlItem(nameLink.encode('utf-8'), url.encode('utf-8'), 0)) elif 'ekstraklasa.org' in self.host.currList[Index].get('host', ''): pass return RetHost(RetHost.OK, value=retlist)
def converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO if type in [CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = cItem.get('desc', '') icon = cItem.get('icon', '') return CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 1, iconimage = icon, possibleTypesOfSearch = possibleTypesOfSearch)
def converItem(self, cItem): hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO elif 'picture' == cItem['type']: type = CDisplayListItem.TYPE_PICTURE if type in [ CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO, CDisplayListItem.TYPE_PICTURE ]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = clean_html(cItem.get('title', '')) description = clean_html(cItem.get('plot', '')) icon = cItem.get('icon', '') return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch)
def listsItems(self, Index, url, name=''): printDBG('Host listsItems begin') valTab = [] if name == 'main-menu': printDBG('Host listsItems begin name=' + name) #valTab.append(CDisplayListItem("Newest (HD-1080p)", "Newest (HD-1080p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/newest_1080p.xml'], 'appletrailers-movies', '', None)) #valTab.append(CDisplayListItem("Current (HD-1080p)", "Current (HD-1080p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/current_1080p.xml'], 'appletrailers-movies', '', None)) valTab.append( CDisplayListItem( "Newest (HD-720p)", "Newest (HD-720p)", CDisplayListItem.TYPE_CATEGORY, [ 'http://trailers.apple.com/trailers/home/xml/newest_720p.xml' ], 'appletrailers-movies', '', None)) valTab.append( CDisplayListItem( "Current (HD-720p)", "Current (HD-720p)", CDisplayListItem.TYPE_CATEGORY, [ 'http://trailers.apple.com/trailers/home/xml/current_720p.xml' ], 'appletrailers-movies', '', None)) valTab.append( CDisplayListItem( "Newest (HD-480p)", "Newest (HD-480p)", CDisplayListItem.TYPE_CATEGORY, [ 'http://trailers.apple.com/trailers/home/xml/newest_480p.xml' ], 'appletrailers-movies', '', None)) valTab.append( CDisplayListItem( "Current (HD-480p)", "Current (HD-480p)", CDisplayListItem.TYPE_CATEGORY, [ 'http://trailers.apple.com/trailers/home/xml/current_480p.xml' ], 'appletrailers-movies', '', None)) valTab.append( CDisplayListItem( "Newest (SD)", "Newest (SD)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/newest.xml'], 'appletrailers-movies', '', None)) valTab.append( CDisplayListItem( "Current (SD)", "Current (SD)", CDisplayListItem.TYPE_CATEGORY, [ 'http://trailers.apple.com/trailers/home/xml/current.xml' ], 'appletrailers-movies', '', None)) printDBG('Host listsItems end') return valTab # ########## # if 'appletrailers-movies' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://trailers.apple.com' query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True } try: data = self.cm.getURLRequestData(query_data) except Exception: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab printDBG('Host listsItems data: ' + data) phMovies = re.findall( '<movieinfo.*?<title>(.*?)</title>.*?<runtime>(.*?)</runtime>.*?<location>(.*?)</location>.*?<large filesize=".*?">(.*?)</large>', data, re.S) if phMovies: for (phTitle, phRuntime, phImage, phUrl) in phMovies: phUrl = urlparser.decorateUrl( phUrl, {'User-Agent': 'QuickTime/7.6.2'}) printDBG('Host listsItems phTitle: ' + phTitle) printDBG('Host listsItems phRuntime: ' + phRuntime) printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phUrl: ' + phUrl) valTab.append( CDisplayListItem(phTitle, '[' + phRuntime + '] ' + phTitle, CDisplayListItem.TYPE_VIDEO, [CUrlItem('', phUrl, 1)], 0, phImage, None)) printDBG('Host listsItems end') return valTab return valTab
def run(self): ret=None _temp = __import__('hosts.' + self.hostName, globals(), locals(), ['IPTVHost'], -1) self.title = _temp.gettytul() logState("Host title: %s\n" % self.title) self.host = _temp.IPTVHost() self.SelectedLink = '' try: if not isinstance(self.host, IHost): logState("Host [%r] inherits from IHost :)\n" % (self.hostName)) except: logState( 'Cannot import class IPTVHost for host [%r]\n' % self.hostName) self.stop() return hostconfig = __import__('hosts.' + self.hostName, globals(), locals(), ['GetConfigList'], -1) ConfList = hostconfig.GetConfigList() configureHOST(self.hostName) monitor = xbmc.Monitor() while not monitor.abortRequested() or xbmcgui.Window(10000).getProperty('plugin.video.IPTVplayer.HOST') == self.hostName: #logState("plugin.video.IPTVplayer.HOST=%s self.hostName=%s\n" %(xbmcgui.Window(10000).getProperty('plugin.video.IPTVplayer.HOST'),self.hostName)) timestamp = long(myTime()) xbmcgui.Window(10000).setProperty("kodiIPTVserviceHeartBeat", str(timestamp)) # Sleep/wait for abort for 10 seconds if monitor.waitForAbort(1): break # Abort was requested while waiting. We should exit self.myCommand = getCMD() if self.myCommand == '': continue elif self.myCommand == 'STOPservice': self.stop() return elif self.myCommand == 'Title': myAnswer(self.title) continue elif self.myCommand == 'LogoPath': myAnswer(self.host.getLogoPath().value) continue elif self.myCommand == 'SupportedTypes': myAnswer(self.host.getSupportedFavoritesTypes().value) continue elif self.myCommand == 'InitList': ret = self.host.getInitList() if len(ConfList) > 0: #### TBC myAnswer(ToItemsListTable(ret.value, self.clientType) + ToConfigTable(ConfList, clientType)) #if host hasconfig, return it too myAnswer(ToItemsListTable(ret.value, self.clientType)) #if host hasconfig, return it too else: myAnswer(ToItemsListTable(ret.value, self.clientType)) continue elif self.myCommand == 'RefreshList': ret = self.host.getCurrentList() myAnswer(ToItemsListTable(ret.value, self.clientType)) continue elif self.myCommand == 'PreviousList': ret= self.host.getPrevList() myAnswer(ToItemsListTable(ret.value, self.clientType)) continue elif self.myCommand.startswith('ListForItem='): #Param: item ID myID = self.myCommand.split('=')[1] if myID.isdigit(): myID = int(myID) ret= self.host.getListForItem(myID,0,ret.value[myID]) myAnswer(ToItemsListTable(ret.value, self.clientType)) else: myAnswer('ERROR: wrong index') continue elif self.myCommand.startswith('getVideoLinks='): #Param: link ID myID = self.myCommand.split('=')[1] daemonLog("daemon:getVideoLinks=%s" % myID) if myID.isdigit(): myID = int(myID) self.movieTitle = ret.value[myID].name.replace('"', "'") try: links = ret.value[myID].urlItems except: links='NOVALIDURLS' try: retUrl= self.host.getLinksForVideo(myID,ret.value[myID]) #returns "NOT_IMPLEMENTED" when host is using curlitem myAnswer(ToUrlsTable(retUrl.value, self.clientType)) daemonLog("retUrl found") except: daemonLog("Exception running getLinksForVideo (means not implemented), using CUrlItem") retUrl = RetHost(RetHost.NOT_IMPLEMENTED, value = []) if retUrl.status == "NOT_IMPLEMENTED" and links != 'NOVALIDURLS': daemonLog("getLinksForVideo not implemented, using CUrlItem") tempUrls=[] daemonLog("Iterating links...") iindex=1 for link in links: if link.name == '': tempUrls.append(CUrlItem('link %d' % iindex, link.url, link.urlNeedsResolve)) else: tempUrls.append(CUrlItem(link.name, link.url, link.urlNeedsResolve)) iindex += 1 retUrl = RetHost(RetHost.OK, value = tempUrls) myAnswer(ToUrlsTable(tempUrls, self.clientType)) else: myAnswer('ERROR: wrong index') continue #### ResolveURL #### elif self.myCommand.startswith('ResolveURL='): #Param: selected quality link ID myParm = self.myCommand.split('=')[1] url = "NOVALIDURLS" linksList = [] if myParm.isdigit(): myID = int(myParm) #czasami jest zwracana lista linkow wiec trzeba ja sparsowac linksList = self.host.getResolvedURL(retUrl.value[myID].url).value daemonLog("myParm.isdigit and points to:%s" % retUrl.value[myID].url) else: linksList = self.host.getResolvedURL(myParm).value if len(linksList) == 0: #There is no free links for current video daemonLog("linksList has no items :(") elif len(linksList) >1: daemonLog('WARNING: more than one link returned, selecting first') if isinstance(linksList[0], CUrlItem): if int(linksList[0].urlNeedsResolve) == 1: daemonLog('ERROR: url should be already resolved. :(') else: url = linksList[0].url daemonLog("CUrlItem url:%s" %url) elif isinstance(linksList[0], basestring): url = linksList[0] daemonLog("basestring url:%s" %url) elif isinstance(linksList, (list, tuple)): url = linksList[0] daemonLog("list/tuple url:%s" %url) myAnswer( url ) #### Download movie #### elif self.myCommand.startswith('DownloadURL='): #Param: full download url url = self.myCommand[len('DownloadURL='):] #using split results in wrong links from Plugins.Extensions.IPTVPlayer.iptvdm.iptvdownloadercreator import IsUrlDownloadable, DownloaderCreator if IsUrlDownloadable(url): from Plugins.Extensions.IPTVPlayer.iptvdm.iptvdh import DMHelper url, downloaderParams = DMHelper.getDownloaderParamFromUrl(url) currentDownloader = DownloaderCreator(url) #correct downloader is assigned e.g. wget MovieRecordFileName = os.path.join(config.plugins.iptvplayer.NaszaSciezka.value , getValidFileName(self.movieTitle)) MovieRecordFileNameExt = MovieRecordFileName[-4:] if not MovieRecordFileNameExt in ('.mpg', '.flv', '.mp4'): MovieRecordFileName += ".mp4" currentDownloader.start(url, MovieRecordFileName, downloaderParams) myAnswer(MovieRecordFileName) else: myAnswer( 'ERROR:wrong url' ) #### buffer movie #### elif self.myCommand.startswith('BufferURL='): #Param: full download url url = self.myCommand[len('BufferURL='):] #using split results in wrong links from Plugins.Extensions.IPTVPlayer.iptvdm.iptvdownloadercreator import IsUrlDownloadable, DownloaderCreator if IsUrlDownloadable(url): from Plugins.Extensions.IPTVPlayer.iptvdm.iptvdh import DMHelper url, downloaderParams = DMHelper.getDownloaderParamFromUrl(url) currentDownloader = DownloaderCreator(url) #correct downloader is assigned e.g. wget MovieRecordFileName = config.plugins.iptvplayer.NaszaSciezka.value + "iptv_buffering.mp4" currentDownloader.start(url, MovieRecordFileName, downloaderParams) myAnswer(MovieRecordFileName) else: myAnswer( 'ERROR:wrong url' ) #### Search items #### elif self.myCommand.startswith('Search='): #Param: search pattern self.searchPattern = self.myCommand[len('Search='):] #param can contain '='. Using split function would brake everything ;) ret = self.host.getSearchResults(self.searchPattern) myAnswer(ToItemsListTable(ret.value, self.clientType)) #### doCommand - not finished#### elif self.myCommand.startswith('doCommand='): #Param: selected quality link ID execCMD = self.myCommand.replace('doCommand=','') try: exec(execCMD) myAnswer( 'OK' ) except Exception: myAnswer( 'ERROR executing command.') elif self.myCommand.startswith('doUnsafeCommand='): #Param: selected quality link ID execCMD = self.myCommand.replace('doUnsafeCommand=','') exec(execCMD) myAnswer( 'OK' ) else: daemonLog("Unknown command:'%s'\n" % self.myCommand) myAnswer("ERROR: Unknown command:'%s'\n" % self.myCommand) self.stop() return