/addons/plugin.video.filmibynature/default.py
Python | 1123 lines | 1091 code | 25 blank | 7 comment | 10 complexity | 077e894ade5a42db95ec5d3d3d6e6278 MD5 | raw file
Possible License(s): GPL-3.0
Large files files are truncated, but you can click here to view the full file
- import urllib, urllib2, re, sys, xbmcplugin, xbmcgui
- import cookielib, os, string, cookielib, StringIO
- import os, time, base64, logging, calendar, binascii
- import xbmcaddon
- from xml.dom.minidom import parse, parseString
- from datetime import datetime
- try:
- import json
- except ImportError:
- import simplejson as json
-
- #Filmi by nature
- fbn = xbmcaddon.Addon(id=re.compile("plugin://(.+?)/").findall(sys.argv[0])[0])
- addonPath = fbn.getAddonInfo('path')
- artPath = addonPath + '/resources/art'
- resourcePath = addonPath + '/resources'
- defaultIconImg = os.path.join(xbmc.translatePath(addonPath), "icon.png")
- addonDataPath = fbn.getAddonInfo('profile')
- movieImgUrlJsonFile = 'MovieImgUrl_V2.json'
- octoshapeChannelsFile = 'Octoshape-Channels.json'
- yeahChannelsFile = 'Yeah-Channels.json'
- cachedImgUrlJsonObj = {}
- maxLinksPerPageOption = [15, 25, 50]
- oldMovieImgUrlJsonFile = ['MovieImgUrl.json', 'MovieImgUrl_V1.json']
-
-
- def TV():
- #addDir('TV SHOWS','http://www.filmitown.com/forums/forumdisplay.php?f=18',1,os.path.join(xbmc.translatePath( artPath ), "TV_Shows_V1.png"))
- addDir('MOVIES', 'http://www.sominaltvtheater.com/', 20, os.path.join(xbmc.translatePath(artPath), "Movies_V1.png"))
- addDir('MUSIC VIDEOS', 'http://www.sominaltvtheater.com/', 40, os.path.join(xbmc.translatePath(artPath), "Music_V1.png"))
- addDir('YouTube CHANNELS', 'http://www.youtube.com/', 60, os.path.join(xbmc.translatePath(artPath), "YouTube_V1.png"))
- #addDir('LIVE TV','LIVE',80,os.path.join(xbmc.translatePath( artPath ), "Live_V1.png"))
- #addDir('NEW ADD-ON :: [B]VEOH[/B] [I]beta[/I]', 'http://code.google.com/p/apple-tv2-xbmc/', 50, os.path.join(xbmc.translatePath( artPath ), "AJ_V1.png"))
-
- def WHAT_IS_COMING(url):
- d = xbmcgui.Dialog()
- d.ok('Do you like this add-on and AJ work?', '', 'DONATE today: \n[B]http://code.google.com/p/apple-tv2-xbmc/[/B]')
-
- def CHANNELS(url):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- web = ''.join(link.splitlines())
- match = re.compile('<td><img src="(.+?)" alt="" border="0" /></td> <td class="alt1Active" align="left" id="(.+?)" style="border-left-width: 0;"> <div> <a href="(.+?)" class="forum-link"><strong>(.+?)</strong></a>').findall(web)
- for thumbnail, id, url, name in match:
- addDir(unescape(name), 'http://www.filmitown.com/forums/' + unescape(url), 2, 'http://www.filmitown.com/forums/' + thumbnail)
-
-
- def SHOWS(url):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- web = ''.join(link.splitlines())
- match = re.compile('<div> <a href="(.+?)" class="forum-link"><strong>(?!<font color="blue">)(.+?)</strong></a> </div>').findall(web)
- for url, name in match:
- newName = unescape(name).replace('<img src="http://www.filmitown.com/forums/forums/images/mainlogo/hot.jpg" border="0">', ' @@HOT@@')
- newName = newName.replace('<img src="http://www.filmitown.com/forums/forums/images/mainlogo/hot.jpg" border="0"', ' @@HOT@@')
- newName = newName.replace('<img src="http://www.filmitown.com/forums/forums/images/mainlogo/hot.jpg" border=', ' @@HOT@@')
- newName = newName.replace('<img src="/forums/images/mainlogo/hot.jpg" border="0">', ' @@HOT@@')
- newName = newName.replace('<img src="/forums/images/mainlogo/hot.jpg" border="0"', ' @@HOT@@')
- newName = newName.replace('<img src="/forums/images/mainlogo/hot.jpg" border=', ' @@HOT@@')
- newName = newName.replace('<img src="http://www.filmitown.com/forums/forums/images/mainlogo/new.gif" border="0">', ' **NEW**')
- newName = newName.replace('<img src="http://www.filmitown.com/forums/forums/images/mainlogo/new.gif" border="0"', ' **NEW**')
- newName = newName.replace('<img src="http://www.filmitown.com/forums/forums/images/mainlogo/new.gif" border=', ' **NEW**')
- newName = newName.replace('<img src="/forums/images/mainlogo/new.jpg" border="0">', ' **NEW**')
- newName = newName.replace('<img src="/forums/images/mainlogo/new.gif" border="0">', ' **NEW**')
- addDir(newName, 'http://www.filmitown.com/forums/' + unescape(url), 3, '')
- match = re.compile('<div> <a href="(.+?)" class="forum-link"><strong><font color="blue">(.+?)</font></strong></a> </div>').findall(web)
- if(len(match) != 0):
- splitted = match[0][0].split('<a href="')
- if(len(splitted) != 0):
- archivedLink = splitted[len(splitted) - 1]
- addDir('**>>**' + match[0][1] + '**>>**', 'http://www.filmitown.com/forums/' + unescape(archivedLink), 2, '')
-
- def EPISODES(url):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- web = ''.join(link.splitlines())
- match = re.compile('<div> (.+?) <a href="(.+?)" id="thread_title_(.+?)">(.+?)</a>').findall(web)
- for extraChars, url, id, name in match:
- addDir(unescape(name), 'http://www.filmitown.com/forums/' + unescape(url), 4, '')
-
- #SUPPORT FOR PAGES
- web = web.replace('\t', '').split('<td class="tcat" width="100%">Threads in Forum<span class="normal">');
- match = re.compile('<td class="alt2"><span class="smallfont" title="Showing results (.+?)"><strong>(.+?)</strong></span></td>').findall(web[0])
- if(len(match) != 0):
- currentPage = int(match[0][1])
- match = re.compile('<td class="alt1" nowrap="nowrap"><a rel="start" class="smallfont" href="(.+?)" title="First Page - Results (.+?)"><strong>«</strong> First</a></td>').findall(web[0])
- if(len(match) != 0):
- addDir('<<<< FIRST PAGE <<', 'http://www.filmitown.com/forums/' + unescape(match[0][0]), 3, os.path.join(xbmc.translatePath(artPath), "first-icon.png"))
- match = re.compile('<td class="alt1"><a class="smallfont" href="(.+?)" title="Show results (.+?)">(.+?)</a>').findall(web[0])
- for url, title, page in match:
- thisPage = 0
- try:
- thisPage = int(page)
- except:
- continue
- if(thisPage < currentPage):
- addDir('<<<< PREVIOUS PAGE - ' + page + ' <<', 'http://www.filmitown.com/forums/' + unescape(url), 3, os.path.join(xbmc.translatePath(artPath), "prev-icon.png"))
- elif(thisPage > currentPage):
- addDir('>> NEXT PAGE - ' + page + ' >>>>', 'http://www.filmitown.com/forums/' + unescape(url), 3, os.path.join(xbmc.translatePath(artPath), "next-icon.png"))
- match = re.compile('<td class="alt1" nowrap="nowrap"><a class="smallfont" href="(.+?)" title="Last Page - Results (.+?)">Last <strong>»</strong></a></td>').findall(web[0])
- if(len(match) != 0):
- addDir('>> LAST PAGE >>>>', 'http://www.filmitown.com/forums/' + unescape(match[0][0]), 3, os.path.join(xbmc.translatePath(artPath), "last-icon.png"))
-
- def PARTS(url):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- web = ''.join(link.splitlines())
- web = web.replace('</div><br />', '</div><br /><br />')
- web = web.replace('color="red"', 'color="Red"')
- web = web.replace('*DVD Quality* (DailyMotion)</b>', 'DailyMotion *DVD Quality*:-</b>')
- web = web.replace('<font color="Red"><b>', '<b><font color="Red">')
- web = web.replace('</b></font>', '</font></b>')
- web = web.replace('<br />Watch Online', '<b>Watch Online')
- web = web.replace('Online/Download', 'Online')
- match = re.compile('<b>Watch Online (.+?):(.+?)</b><br />(.+?)<br /><br />').findall(web)
- if(len(match) != 0):
- arr = web.split(match[len(match) - 1][2])
- extraMatch = re.compile('<b>Watch Online (.+?):(.+?)</b><br />(.+?)</div>').findall(arr[1])
- match.extend(extraMatch)
- else:
- extraMatch = re.compile('<b>Watch Online (.+?):(.+?)</b><br />(.+?)<br /></div>').findall(web)
- match.extend(extraMatch)
- extraMatch = re.compile('<b><font color="Red">Watch Online (.+?)</font>(.+?)<br /><br />(.+?)<br /><br />').findall(web)
- match.extend(extraMatch)
-
- for name, extraChars, links in match:
- #print match
- matching = re.compile('Part (.+?) : <a href="(.+?)" target="_blank">Watch</a>').findall(links)
- playList = ''
- i = 1
- matchCount = len(matching)
- for part, url in matching:
- addPlayableLink(unescape(name) + ' - Part: ' + part, unescape(url), 13, '')
- playList = playList + unescape(url)
- if(i < matchCount):
- playList = playList + ':;'
- i = i + 1
- if(i > matchCount and matchCount > 0):
- addPlayListLink('[B]Direct PLAY - ' + unescape(name) + '[/B] [I]Playlist of above ' + str(matchCount) + ' videos[/I]', playList, 6, '')
- if(matchCount == 0):
- extraMatch = re.compile('<a href="http://www.hostingcup.com/(.+?)" target="_blank">(.+?)</a>').findall(links)
- matchCount = len(extraMatch)
- if(matchCount == 1):
- addPlayableLink(unescape(name), unescape(extraMatch[0][1]), 13, '')
- if(matchCount == 0):
- extraMatch = re.compile('<a href="http://hostingbulk.com/(.+?)" target="_blank">(.+?)</a>').findall(links)
- matchCount = len(extraMatch)
- if(matchCount == 1):
- addPlayableLink(unescape(name), unescape(extraMatch[0][1]), 13, '')
- def PLAYLIST_VIDEOLINKS(url, name):
- #xbmc.executebuiltin("XBMC.Notification(PLease Wait!,Loading video links into XBMC Media Player,5000)")
- ok = True
- playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
- playList.clear()
- #time.sleep(2)
- links = url.split(':;')
-
- pDialog = xbmcgui.DialogProgress()
- ret = pDialog.create('Loading playlist...')
- totalLinks = len(links)
- loadedLinks = 0
- remaining_display = 'Videos loaded :: [B]' + str(loadedLinks) + ' / ' + str(totalLinks) + '[/B] into XBMC player playlist.'
- pDialog.update(0, 'Please wait for the process to retrieve video link.', remaining_display)
- for videoLink in links:
- loadVideos(videoLink, name, True, True)
-
- loadedLinks = loadedLinks + 1
- percent = (loadedLinks * 100) / totalLinks
- #print percent
- remaining_display = 'Videos loaded :: [B]' + str(loadedLinks) + ' / ' + str(totalLinks) + '[/B] into XBMC player playlist.'
- pDialog.update(percent, 'Please wait for the process to retrieve video link.', remaining_display)
- if (pDialog.iscanceled()):
- return False
-
- xbmcPlayer = xbmc.Player()
- xbmcPlayer.play(playList)
- if not xbmcPlayer.isPlayingVideo():
- d = xbmcgui.Dialog()
- d.ok('INVALID VIDEO PLAYLIST', 'The playlist videos were removed due to copyright issue.', 'Check other links.')
- return ok
- def LOAD_AND_PLAY_VIDEO(url, name):
- ok = True
- print url
- videoUrl = loadVideos(url, name, True, False)
- if videoUrl == None:
- d = xbmcgui.Dialog()
- d.ok('NO VIDEO FOUND', 'This video was removed due to copyright issue.', 'Check other links.')
- return False
- xbmcPlayer = xbmc.Player()
- xbmcPlayer.play(videoUrl)
- return ok
- def VIDEOLINKS(url, name):
- loadVideos(url, name, False, False)
- def loadVideos(url, name, isRequestForURL, isRequestForPlaylist):
- LinkFill = True
- print url
- #DAILYMOTION
- try:
- p = re.compile('/daily.php\?url\=(.+?)&AJ;')
- match = p.findall(url + '&AJ;')
- link = 'http://www.dailymotion.com/video/' + str(match[0])
- req = urllib2.Request(link)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- sequence = re.compile('"sequence", "(.+?)"').findall(link)
- newseqeunce = urllib.unquote(sequence[0]).decode('utf8').replace('\\/', '/')
- imgSrc = re.compile('og:image" content="(.+?)"').findall(link)
- if(len(imgSrc) == 0):
- imgSrc = re.compile('/jpeg" href="(.+?)"').findall(link)
- dm_low = re.compile('"sdURL":"(.+?)"').findall(newseqeunce)
- dm_high = re.compile('"hqURL":"(.+?)"').findall(newseqeunce)
- if(isRequestForURL):
- videoUrl = ''
- if(len(dm_high) == 0):
- videoUrl = dm_low[0]
- else:
- videoUrl = dm_high[0]
- if(isRequestForPlaylist):
- liz = xbmcgui.ListItem('EPISODE', thumbnailImage=imgSrc[0])
- playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
- playlist.add(url=videoUrl, listitem=liz)
- return videoUrl
- else:
- return videoUrl
-
- else:
- if(len(dm_low) > 0):
- addLink ('PLAY Standard Quality ', dm_low[0], imgSrc[0])
- if(len(dm_high) > 0):
- addLink ('PLAY High Quality ', dm_high[0], imgSrc[0])
- except: pass
-
- #YOUTUBE
- try:
- p = re.compile('/yt.php\?url\=(.+?)&AJ;')
- match = p.findall(url + '&AJ;')
- print match
- code = match[0]
- linkImage = 'http://i.ytimg.com/vi/' + code + '/default.jpg'
- req = urllib2.Request('http://www.youtube.com/watch?v=' + code + '&fmt=18')
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
-
- if len(re.compile('shortlink" href="http://youtu.be/(.+?)"').findall(link)) == 0:
- if len(re.compile('\'VIDEO_ID\': "(.+?)"').findall(link)) == 0:
- req = urllib2.Request('http://www.youtube.com/get_video_info?video_id=' + code + '&asv=3&el=detailpage&hl=en_US')
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- map = None
- link = link.replace('\\u0026', '&')
- match = re.compile('url_encoded_fmt_stream_map=(.+?)&').findall(link)
- if len(match) == 0:
- map = (re.compile('url_encoded_fmt_stream_map": "(.+?)"').findall(link)[0]).replace('\\/', '/').split('url=')
- else:
- map = urllib.unquote(match[0]).decode('utf8').split('url=')
- if re.search('status=fail', link):
- return
- if map == None:
- return
- #print map
- highResoVid = ''
- youtubeVideoQual = fbn.getSetting('videoQual')
- for attr in map:
- if attr == '':
- continue
- parts = attr.split('&qual')
- url = urllib.unquote(parts[0]).decode('utf8')
- print url
- qual = re.compile('&itag=(\d*)').findall(url)[0]
- print qual
- if(qual == '13'):
- if(not(isRequestForURL)):
- addLink ('PLAY 3GP Low Quality - 176x144', url, linkImage)
- elif(highResoVid == ''):
- highResoVid = url
- if(qual == '17'):
- if(not(isRequestForURL)):
- addLink ('PLAY 3GP Medium Quality - 176x144', url, linkImage)
- elif(highResoVid == ''):
- highResoVid = url
- if(qual == '36'):
- if(not(isRequestForURL)):
- addLink ('PLAY 3GP High Quality - 320x240', url, linkImage)
- elif(highResoVid == ''):
- highResoVid = url
- if(qual == '5'):
- if(not(isRequestForURL)):
- addLink ('PLAY FLV Low Quality - 400\\327226', url, linkImage)
- elif(highResoVid == ''):
- highResoVid = url
- if(qual == '34'):
- if(not(isRequestForURL)):
- addLink ('PLAY FLV Medium Quality - 480x360', url, linkImage)
- elif(highResoVid == ''):
- highResoVid = url
- if(qual == '6'):
- if(not(isRequestForURL)):
- addLink ('PLAY FLV Medium Quality - 640\\327360', url, linkImage)
- elif(highResoVid == ''):
- highResoVid = url
- if(qual == '35'):
- if(not(isRequestForURL)):
- addLink ('PLAY FLV High Quality - 854\\327480', url, linkImage)
- else:
- highResoVid = url
- if(qual == '18'):
- if(not(isRequestForURL)):
- addLink ('PLAY MP4 High Quality - 480x360', url, linkImage)
- else:
- highResoVid = url
-
- if(qual == '22'):
- if(not(isRequestForURL)):
- addLink ('PLAY MP4 High Quality - 1280x720', url, linkImage)
- else:
- highResoVid = url
- if youtubeVideoQual == '1' or youtubeVideoQual == '2':
- break
- if(qual == '37'):
- if(not(isRequestForURL)):
- addLink ('PLAY MP4 High-2 Quality - 1920x1080', url, linkImage)
- else:
- highResoVid = url
- if youtubeVideoQual == '2':
- break
- if(qual == '38'):
- if(not(isRequestForURL)):
- addLink ('PLAY MP4 Epic Quality - 4096\\3272304', url, linkImage)
- else:
- highResoVid = url
- if youtubeVideoQual == '2':
- break
- if(qual == '43'):
- if(not(isRequestForURL)):
- addLink ('PLAY WEBM Medium Quality - 4096\\3272304', url, linkImage)
- else:
- highResoVid = url
- if(qual == '44'):
- if(not(isRequestForURL)):
- addLink ('PLAY WEBM High Quality - 4096\\3272304', url, linkImage)
- else:
- highResoVid = url
- if youtubeVideoQual == '1' or youtubeVideoQual == '2':
- break
- if(qual == '45'):
- if(not(isRequestForURL)):
- addLink ('PLAY WEBM High-2 Quality - 4096\\3272304', url, linkImage)
- else:
- highResoVid = url
- if youtubeVideoQual == '2':
- break
- print highResoVid
- if(isRequestForURL):
- if(isRequestForPlaylist):
- liz = xbmcgui.ListItem('VIDEO PART', thumbnailImage=linkImage)
- xbmc.PlayList(xbmc.PLAYLIST_VIDEO).add(url=highResoVid, listitem=liz)
- return highResoVid
- else:
- return highResoVid
- except: pass
-
- #Z-SHARE
- try:
-
- p = re.compile('/watch.php\?url\=(.+?)/')
- match = p.findall(url)
- url = 'http://www.zshare.net/video/' + match[0]
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- match = re.compile('iframe src\="http://www.zshare.net/videoplayer(.+?)"').findall(link)
- req = urllib2.Request('http://www.zshare.net/videoplayer' + match[0].replace(' ', '%20'))
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- videoUrl = re.compile('file: "(.+?)"').findall(link)[0]
- videoUrl = videoUrl.replace(' ', '%20') + '|User-Agent=' + urllib.quote_plus('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/534.48.3 (KHTML, like Gecko) Version/5.1 Safari/534.48.3' + '&Accept=' + urllib.quote_plus('text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8') + '&Accept_Encoding=' + urllib.quote_plus('gzip, deflate'))
-
- if(isRequestForURL):
- if(isRequestForPlaylist):
- liz = xbmcgui.ListItem('EPISODE', thumbnailImage='')
- xbmc.PlayList(xbmc.PLAYLIST_VIDEO).add(url=videoUrl, listitem=liz)
- return videoUrl
- else:
- return videoUrl
- else:
- addLink ('PLAY High Quality Video', videoUrl, '')
- except: pass
- #HOSTING CUP
- try:
- chkUrl = url + '&AJ;'
- id = re.compile('http://www.hostingcup.com/(.+?)&AJ;').findall(chkUrl)[0]
- url = 'http://www.hostingcup.com/' + id
- webLink = ''.join(link.splitlines()).replace('\t', '')
- #Trying to find out easy way out :)
- paramSet = re.compile("return p\}\(\'(.+?)\',36,(.+?),\'(.+?)\'").findall(webLink)
-
- result = parseValue(paramSet[0][0], 36, int(paramSet[0][1]), paramSet[0][2].split('|'))
- result = result.replace('\\', '').replace('"', '\'')
- print result
- imgUrl = re.compile("s1.addVariable\(\'image\',\'(.+?)\'\);").findall(result)[0]
- videoUrl = re.compile("s1.addVariable\(\'file\',\'(.+?)\'\);").findall(result)[0]
-
- print 'HOSTING CUP url = ' + videoUrl
- if(isRequestForURL):
- if(isRequestForPlaylist):
- liz = xbmcgui.ListItem(name, thumbnailImage=imgUrl)
- playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
- playlist.add(url=videoUrl, listitem=liz)
- return videoUrl
- else:
- return videoUrl
- else:
- addLink ('[B]PLAY VIDEO[/B]: ' + name, videoUrl, imgUrl)
- except: pass
- #HOSTING BULK
- try:
- chkUrl = url + '&AJ;'
- id = re.compile('http://hostingbulk.com/(.+?)&AJ;').findall(chkUrl)[0]
- url = 'http://hostingbulk.com/' + id
- webLink = ''.join(link.splitlines()).replace('\t', '')
- #Trying to find out easy way out :)
- paramSet = re.compile("return p\}\(\'(.+?)\',36,(.+?),\'(.+?)\'").findall(webLink)
-
- result = parseValue(paramSet[0][0], 36, int(paramSet[0][1]), paramSet[0][2].split('|'))
- result = result.replace('\\', '').replace('"', '\'')
- print result
- imgUrl = re.compile("s1.addVariable\(\'image\',\'(.+?)\'\);").findall(result)[0]
- videoUrl = re.compile("s1.addVariable\(\'file\',\'(.+?)\'\);").findall(result)[0]
-
- print 'HOSTING BULK url = ' + videoUrl
- if(isRequestForURL):
- if(isRequestForPlaylist):
- liz = xbmcgui.ListItem(name, thumbnailImage=imgUrl)
- playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
- playlist.add(url=videoUrl, listitem=liz)
- return videoUrl
- else:
- return videoUrl
- else:
- addLink ('[B]PLAY VIDEO[/B]: ' + name, videoUrl, imgUrl)
- except: pass
- #MOVIES
- def MOVIES_MENU(url, name):
- addDir('*[B]High Definition[/B]* Collection', 'http://www.sominaltvtheater.com/2010/11/bluray-movies-collection.html', 21, os.path.join(xbmc.translatePath(artPath), "HD_Movies_V1.png"))
- addDir('[B]HINDI[/B] MOVIES', 'http://www.sominaltvtheater.com/2010/11/hindi-movies.html', 23, os.path.join(xbmc.translatePath(artPath), "Hindi_Movies_V1.png"))
- addDir('[B]TELUGU[/B] MOVIES', 'http://www.sominaltvtheater.com/2010/11/telugu-movies.html', 24, os.path.join(xbmc.translatePath(artPath), "Telugu_Movies_V1.png"))
- addDir('[B]TAMIL[/B] MOVIES', 'http://www.sominaltvtheater.com/2010/11/tamil-movies.html', 25, os.path.join(xbmc.translatePath(artPath), "Tamil_Movies_V1.png"))
-
- # addDir('[B]HINDI[/B] MOVIES','hindi',22,os.path.join(xbmc.translatePath( artPath ), "Hindi_Movies_V1.png"))
- # addDir('[B]TELUGU[/B] MOVIES','telugu',22,os.path.join(xbmc.translatePath( artPath ), "Telugu_Movies_V1.png"))
- # addDir('[B]TAMIL[/B] MOVIES','tamil',22,os.path.join(xbmc.translatePath( artPath ), "Tamil_Movies_V1.png"))
- # addDir('[B]MALAYALAM[/B] MOVIES','malayalam',22,os.path.join(xbmc.translatePath( artPath ), "Malayalam_Movies_V1.png"))
- # addDir('[B]KANNADA[/B] MOVIES','kannada',22,os.path.join(xbmc.translatePath( artPath ), "Kannada_Movies_V1.png"))
- # addDir('[B]BENGALI[/B] MOVIES','bengali',22,os.path.join(xbmc.translatePath( artPath ), "Bengali_Movies_V1.png"))
- # addDir('[B]MARATHI[/B] MOVIES','marathi',22,os.path.join(xbmc.translatePath( artPath ), "Marathi_Movies_V1.png"))
-
- #BharatMovies
- def BM_MOVIES_BY_LANG(lang, name):
- url = 'http://www.bharatmovies.com/' + lang + '/watch/movies.htm'
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '').replace('ilactive', 'ila')
- index = re.compile('<a id=ila href=(.+?)>(.+?)</a>').findall(link)
- indexCount = len(index)
- if indexCount > 0:
- indexURL = ''
- i = 0
- for indexLink, indexChar in index:
- print indexChar + ' <--> ' + indexLink
- indexURL = indexURL + indexChar + '<-->' + 'http://www.bharatmovies.com/' + lang + '/watch/' + indexLink
- i = i + 1
- if i < indexCount:
- indexURL = indexURL + '&AJ;'
- addDir('A-Z DIRECTORIES', indexURL, 26, os.path.join(xbmc.translatePath(artPath), "AZ_Dir_V1.png"))
-
- if re.search('Movie Index By Release Year', link):
- addDir('Browse by RELEASE DECADES', lang, 27, os.path.join(xbmc.translatePath(artPath), "Release_Decades_V1.png"))
-
- if lang == 'hindi':
- addDir('Browse MORE [B]HINDI[/B] MOVIES', 'http://www.sominaltvtheater.com/2010/11/hindi-movies.html', 23, os.path.join(xbmc.translatePath(artPath), "Hindi_Movies_V1.png"))
- elif lang == 'telugu':
- addDir('Browse MORE [B]TELUGU[/B] MOVIES', 'http://www.sominaltvtheater.com/2010/11/telugu-movies.html', 24, os.path.join(xbmc.translatePath(artPath), "Telugu_Movies_V1.png"))
- elif lang == 'tamil':
- addDir('Browse MORE [B]TAMIL[/B] MOVIES', 'http://www.sominaltvtheater.com/2010/11/tamil-movies.html', 25, os.path.join(xbmc.translatePath(artPath), "Tamil_Movies_V1.png"))
-
- else:
- xbmc.executebuiltin("XBMC.Notification(PLease Wait!,Loading ALL MOVIES in this category,5000)")
- BM_LIST(url, name)
- def BM_MOVIES_A_Z_DIR(indexMap, name):
- indexNameList = []
- indexUrlList = []
- indexEntries = indexMap.split('&AJ;')
- for indexEntry in indexEntries:
- index = indexEntry.split('<-->')
- #imgUrl = os.path.join(xbmc.translatePath( artPath ), "alpha/red-"+index[0]+".png")
- indexNameList.append('[B]' + index[0] + '[/B]')
- indexUrlList.append(index[1])
- #if index[0] == '#':
- # imgUrl = os.path.join(xbmc.translatePath( artPath ), "alpha/red-hash.png")
- #addDir(index[0], index[1], 28, imgUrl)
- d = xbmcgui.Dialog()
- indexSelect = d.select('A-Z Directories:', indexNameList)
- if indexSelect == -1:
- indexSelect = 0
- url = indexUrlList[indexSelect]
- name = indexNameList[indexSelect]
- BM_LIST(url, name)
-
- def BM_MOVIES_BY_DECADES(lang, name):
- indexNameList = []
- indexUrlList = []
- url = 'http://www.bharatmovies.com/' + lang + '/watch/' + lang + '-movies-new.htm'
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '').replace('ilactive', 'ila')
- index = re.compile('<a id=ila href=(.+?)>(.+?)</a>').findall(link)
- for indexLink, indexChar in index:
- print indexChar + ' <--> ' + indexLink
- indexUrl = 'http://www.bharatmovies.com/' + lang + '/watch/' + indexLink
- indexNameList.append('[B]' + indexChar + '[/B]')
- indexUrlList.append(indexUrl)
- #addDir(indexChar, indexUrl, 28, '')
- d = xbmcgui.Dialog()
- indexSelect = d.select('Decades:', indexNameList)
- if indexSelect == -1:
- indexSelect = 0
- url = indexUrlList[indexSelect]
- name = indexNameList[indexSelect]
- BM_LIST(url, name)
-
- def BM_LIST(url, name):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '').replace('ilactive', 'ila').replace('<i>', '').replace('</i>', '')
- movies = re.compile('<div id=L[1,2]><a href=(.+?)>(.+?)</a><span>(.+?)</span></div>').findall(link)
- if len(movies) > 0 and fbn.getSetting('load_image_from_tmdb') == 'true':
- xbmc.executebuiltin("XBMC.Notification(PLease Wait!,Loading MOVIE image from themoviedb.org, Check add-on settings for more information, 5000)")
-
- for movieLink, movieName, movieCast in movies:
-
- movieNameParts = re.compile('(.+?)<font color=red>(.+?)</font>').findall(movieName)
- if len(movieNameParts) > 0:
- movieName = movieNameParts[0][0] + ' ' + movieNameParts[0][1]
-
- #print movieName + ' --> '+movieLink + ' -->CASTING--> '+movieCast
- movieLink = url[0 : url.rindex('/') + 1] + movieLink
- addDirAndLoadImg(movieName, movieLink, 29)
-
-
- def BM_VIDEO_SOURCES(url, name):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '')
- sourceNames = re.compile('<br> Source: [2,3,4,5,6,7,8,9,10] <br>').findall(link)
- sourceNames.append('<br> Source: 1 <br>')
- sourceVideoLinks = link.split('<br> Source:')
-
- partHeading = 'Part'
- if re.search('/songs/', url):
- partHeading = 'Song'
-
- index = 0
- sourceNbr = 1
- for sourceName in sourceNames:
- try:
- sourceName = re.compile('<div id=source>Source: (.+?)</div>').findall(sourceVideoLinks[index])[0]
- except:
- index = index + 1
- continue
- print sourceName
- if sourceName == 'YouKu' or sourceName == 'Rajshri':
- index = index + 1
- xbmc.executebuiltin("XBMC.Notification(Skipped Source: YouKu,Not yet supported,5000)")
- continue
- sourceVideos = re.compile('<embed(.+?)>').findall(sourceVideoLinks[index])
- matchCount = len(sourceVideos)
- if matchCount == 1:
- try:
- if re.search('http://www.youtube.com/p/', sourceVideos[0]):
- videoLink = sourceVideos[0] + '&'
- playlistID = re.compile('http://www.youtube.com/p/(.+?)&').findall(videoLink)[0]
- print 'retreiveYouTubePlayList ' + playlistID
- retreiveYouTubePlayList(playlistID, '', 'Source #' + str(sourceNbr) + ' ' + sourceName, 'Part')
- sourceNbr = sourceNbr + 1
- index = index + 1
- continue
-
- elif re.search('http://www.youtube.com/view_play_list', videoLink):
- videoLink = sourceVideos[0] + '&'
- playlistID = re.compile('http://www.youtube.com/view_play_list\?p=(.+?)&').findall(videoLink)[0]
- print 'retreiveYouTubePlayList ' + playlistID
- retreiveYouTubePlayList(playlistID, '', 'Source #' + str(sourceNbr) + ' ' + sourceName, 'Part')
- sourceNbr = sourceNbr + 1
- index = index + 1
- continue
- except: pass
-
- if matchCount > 1:
- playList = ''
- i = 1
- for sourceVideo in sourceVideos:
- sourceVideo = re.compile(' src=(.+?) ').findall(' ' + sourceVideo + ' ')[0].replace('\'', '').replace('"', '')
- addPlayableMovieLink('Source #' + str(sourceNbr) + ' ' + sourceName + ' - ' + partHeading + ': ' + str(i), unescape(sourceVideo), 31, '')
- playList = playList + unescape(sourceVideo)
- if(i < matchCount):
- playList = playList + ':;'
- i = i + 1
- if(i > matchCount and matchCount > 0):
- addPlayListLink('[B]Direct PLAY - ' + sourceName + '[/B] [I]Playlist of above ' + str(matchCount) + ' videos[/I]', playList, 32, '')
- else:
- sourceVideo = re.compile(' src=(.+?) ').findall(' ' + sourceVideos[0] + ' ')[0].replace('\'', '').replace('"', '')
- addPlayableMovieLink('[B]SINGLE LINK[/B] Source #' + str(sourceNbr) + ' ' + sourceName, unescape(sourceVideo), 31, '')
- sourceNbr = sourceNbr + 1
- index = index + 1
-
- #SominalTVTheater
- def MORE_MOVIES_HINDI(url, name):
- MoviesList(url, 30)
-
- def MORE_MOVIES_TELUGU(url, name):
- MoviesList(url, 30)
-
- def MORE_MOVIES_TAMIL(url, name):
- MoviesList(url, 30)
- def MOVIES_BLURAY(url, name):
- BlurayMoviesList(url)
- def BlurayMoviesList(url):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '').replace('\'', '"').replace(' ', '')
- moviesContentArray = re.compile('<div class="cover"><div class="entry">(.+?)<div style="clear:both;"></div><div class="clear"></div>').findall(link)
- moviesArray = re.compile('<a href="(.+?)"><img alt="" class="ethumb" src="(.+?)" style="cursor: move;" /></a>').findall(moviesContentArray[0])
- movieIndex = 1
- for movieLink, movieImg in moviesArray:
- #movieTitle = 'MOVIE #' + str(movieIndex)
- movieTitle = movieLink[movieLink.rindex('/') + 1 : movieLink.rindex('.')]
-
- addDir(unescape(movieTitle), movieLink, 30, movieImg)
- movieIndex = movieIndex + 1
- def MoviesList(url, mode):
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '').replace('\'', '"').replace(' ', '')
- moviesContentArray = re.compile('<br /><br />(.+?)<div class="clear"></div>').findall(link)
- if(len(moviesContentArray) == 0):
- moviesContentArray = re.compile('</div><br /><div style="text-align: center;">(.+?)<div style="clear:both;"></div>').findall(link)
-
- moviesContent = moviesContentArray[0]
-
- moviesContent = moviesContent.replace('<a href="http://adf.ly/377117/http://www.sominaltvtheater.com/2010/11/bluray-movies-collection.html"><b>(Hindi, Telugu, & Tamil)</b></a>', '')
- moviesContent = moviesContent.replace('<span class="Apple-style-span" style="font-size: xx-small;"></span>', '')
- moviesContent = moviesContent.replace('<a href="http://www.sominaltvtheater.com/2010/11/apaharan-2005-bluray.html"></a>', '')
- moviesContent = moviesContent.replace('</a><a href="http://www.sominaltvtheater.com/2011/04/teen-thay-bhai-2011-dvdscr.html">', '')
- moviesContent = moviesContent.replace('</a><span class="Apple-style-span" style="color: blue; font-size: xx-small;">*BluRay*</span>', ' *BluRay*</a>')
- moviesContent = moviesContent.replace('</a><b><span class="Apple-style-span" style="color: blue; font-size: xx-small;">*BluRay*</span></b>', ' *BluRay*</a>')
- moviesContent = moviesContent.replace('</a><b><span class="Apple-style-span" style="color: blue; font-size: xx-small;">*HD*</span></b>', ' *HD*</a>')
-
- moviesContent = moviesContent.replace('</a><span class="Apple-style-span" style="font-size: xx-small;">DVD</span>', ' ~DVD~</a>')
- moviesContent = moviesContent.replace('</a><span class="Apple-style-span" style="font-size: xx-small;">DVDSCR</span>', ' --DVDSCR--</a>')
- moviesContent = moviesContent.replace('</a><span class="Apple-style-span" style="font-size: xx-small;">TS</span>', ' --TS--</a>')
- moviesContent = moviesContent.replace('</a><span class="Apple-style-span" style="font-size: xx-small;">TC</span>', ' --TC--</a>')
- moviesContent = moviesContent.replace('</a><span class="Apple-style-span" style="font-size: xx-small;">DVD <span class="Apple-style-span" style="color: blue;"><b>*HD*</b></span></span>', ' *HD*</a>')
-
- moviesContent = moviesContent.replace('</a><b><span class="Apple-style-span" style="color: blue; font-size: xx-small;">Telugu</span></b>', ' (Telugu)</a>')
- moviesContent = moviesContent.replace('</a><b><span class="Apple-style-span" style="color: blue; font-size: xx-small;">Tamil</span></b>', ' (Tamil)</a>')
- moviesContent = moviesContent.replace('</a><a href="http://www.sominaltvtheater.com/2011/05/laaga-chunari-mein-daag-2007-dvd.html">', '')
- moviesContent = moviesContent.replace('></a>', '>SKIP ME</a>')
- movies = re.compile('<a href="(.+?)">(.+?)</a>').findall(moviesContent)
- i = 0
-
- for movieLink, movieTitle in movies:
- if movieTitle == 'SKIP ME':
- continue
- if re.search('Hindi, Telugu, & Tamil', unescape(movieTitle)) or re.search('<b>\(Click Here\)</b>', unescape(movieTitle)):
- continue
- if movieTitle == '*HD*' or movieTitle == '(Click Here)':
- continue
- i = i + 1
- #print str(i) + ': ' + movieTitle + ' LINK = ' + movieLink.replace('" target="_blank','')
- addDirAndLoadImg(unescape(movieTitle), movieLink.replace('" target="_blank', ''), mode)
- xbmcplugin.setContent(handle=int(sys.argv[1]), content='movies')
- def MOVIE_VIDEO_PARTS(url, name):
-
- if re.search('http://www.youtube.com/', url):
- url = url.replace('?&', '?').replace('?f&', '?').replace('?f&', '?').replace('?&', '?') + '&'
- playlistID = re.compile('http://www.youtube.com/view_play_list\?p=(.+?)&').findall(url)[0]
- print ' ALREADY GOT DIRECT URL retreiveYouTubePlayList ' + playlistID
- retreiveYouTubePlayList(playlistID, '', name, 'Part')
- return
- print url
- req = urllib2.Request(url)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '').replace('\'', '"').replace('<b><b>', '<b>').replace('</b></b>', '</b>').replace(' font-weight: normal;', '')
- imgUrl = ''
- videoContentLink = re.compile('<div class="cover"><div class="entry">(.+?)<div style="clear:both;"></div><div class="clear"></div>').findall(link)
- try:
- imgUrl = re.compile('src="(.+?)"').findall(videoContentLink[0])[0]
- print imgUrl
- except: pass
- videoLinkSources = re.compile('<a href="(.+?)">(.+?)</a>').findall(videoContentLink[0])
-
- moreVideoLinks = re.compile('<iframe(.+?)src="(.+?)"(.+?)>').findall(videoContentLink[0])
- for temp1, videoLink, temp2 in moreVideoLinks:
- videoLinkSources.append([videoLink, 'Full Movie'])
-
- moreVideoLinks = re.compile('<param name="movie" value="(.+?)">').findall(videoContentLink[0])
- for videoLink in moreVideoLinks:
- videoLinkSources.append([videoLink, 'Full Movie'])
-
-
- sourcePart = 1
- for videoLink, videoName in videoLinkSources:
- videoName = videoName.replace('(Click Here)', '')
- if re.search('<img', videoName) or videoLink == 'http://www.youtube.com/user/SominalTvTheaters' or re.search('Click Here', videoName):
- print "SKIP IMG or unwanted URL"
- continue
- if re.search('DOWNLOAD', videoName):
- videoName = 'Full Movie '
- videoLink = videoLink.replace('" target="_blank', '')
- sourceName = videoName + ' :: SOURCE# ' + str(sourcePart)
- sourcePart = sourcePart + 1
- if re.search('http://adf\.ly/', videoLink):
- videoLink = videoLink + '&AJ;'
- videoLink = re.compile('http://adf.ly/(.+?)/(.+?)&AJ;').findall(videoLink)[0][1]
- if not re.search('http://', videoLink):
- videoLink = 'http://' + videoLink
- if re.search('http://sominaltvmovies', videoLink):
- req = urllib2.Request(videoLink)
- req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
- response = urllib2.urlopen(req)
- link = response.read()
- response.close()
- link = ''.join(link.splitlines()).replace('\t', '').replace('\'', '"')
- videoContent = re.compile('<div class="post-body entry-content">(.+?)<div style="clear: both;"></div>').findall(link)
- if(len(videoContent) == 1):
- videoParts = re.compile('src="(.+?)"').findall(videoContent[0])
-
- if(len(videoParts) > 1):
- i = 1
- playList = ''
- matchCount = len(videoParts)
- for videoPartLink in videoParts:
- addPlayableMovieLink(sourceName + ' - Part: ' + str(i), unescape(videoPartLink), 31, imgUrl)
- playList = playList + unescape(videoPartLink)
- if(i < matchCount):
- playList = playList + ':;'
- i = i + 1
- if(i > matchCount and matchCount > 0):
- addPlayListLink('[B]Direct PLAY - ' + sourceName + '[/B] [I]Playlist of above ' + str(matchCount) + ' videos[/I]', playList, 32, imgUrl)
-
- elif(len(videoParts) == 1):
- videoPartLink = videoParts[0]
- if re.search('http://www.dailymotion.com/widget/jukebox', videoPartLink):
- matching = re.compile('\%2Fplaylist\%2F(.+?)&').findall(videoPartLink)
- if len(matching) == 0:
- …
Large files files are truncated, but you can click here to view the full file