platform fix
This commit is contained in:
1 parent
30df420b4f
commit
ca92203b75
33 files changed
+1835
-1356
No files matched your search
@@ -18,7 +18,10 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
|
||||
import Content, re
|
||||
import re
|
||||
|
||||
import Content
|
||||
|
||||
|
||||
class EZTV(Content.Content):
|
||||
category_dict = {
|
||||
@@ -59,31 +62,31 @@ class EZTV(Content.Content):
|
||||
response = self.makeRequest(url, headers=self.headers)
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
# print response
|
||||
if category in ['hot']:
|
||||
contentList = self.mode(response)
|
||||
#print str(contentList)
|
||||
# print str(contentList)
|
||||
return contentList
|
||||
|
||||
def mode(self, response):
|
||||
contentList = []
|
||||
#print str(result)
|
||||
# print str(result)
|
||||
num = 51
|
||||
result = re.compile(
|
||||
r'''class="epinfo">(.+?)</a>.+?<a href="(magnet.+?)".+?<td align="center" class="forum_thread_post">(.+?) </td>''',
|
||||
re.DOTALL).findall(response)
|
||||
r'''class="epinfo">(.+?)</a>.+?<a href="(magnet.+?)".+?<td align="center" class="forum_thread_post">(.+?) </td>''',
|
||||
re.DOTALL).findall(response)
|
||||
for title, link, date in result:
|
||||
#main
|
||||
# main
|
||||
info = {}
|
||||
num = num - 1
|
||||
original_title = None
|
||||
year = 0
|
||||
img = ''
|
||||
#info
|
||||
# info
|
||||
|
||||
info['label'] = info['title'] = title
|
||||
info['link'] = link
|
||||
info['plot'] = info['title']+'\r\nAge: %s' % (date)
|
||||
info['plot'] = info['title'] + '\r\nAge: %s' % (date)
|
||||
|
||||
contentList.append((
|
||||
int(int(self.sourceWeight) * (int(num))),
|
||||
|
||||
@@ -18,19 +18,24 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
import re
|
||||
|
||||
import Content
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
|
||||
|
||||
class KickAssSo(Content.Content):
|
||||
category_dict = {
|
||||
'hot': ('Most Recent', '/new/?field=seeders&sorder=desc', {'page': '/new/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
|
||||
' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
|
||||
'hot': ('Most Recent', '/new/?field=seeders&sorder=desc',
|
||||
{'page': '/new/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
|
||||
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
|
||||
'anime': ('Anime', '/anime/', {'page': '/anime/%d/', 'increase': 1, 'second_page': 2,
|
||||
' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
|
||||
'tvshows': ('TV Shows', '/tv/?field=seeders&sorder=desc', {'page': '/tv/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
|
||||
' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
|
||||
'movies': ('Movies', '/movies/?field=seeders&sorder=desc', {'page': '/movies/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
|
||||
' ':[{'name':' ', 'url_after':'?field=seeders&sorder=desc'}]}),
|
||||
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
|
||||
'tvshows': ('TV Shows', '/tv/?field=seeders&sorder=desc',
|
||||
{'page': '/tv/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
|
||||
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
|
||||
'movies': ('Movies', '/movies/?field=seeders&sorder=desc',
|
||||
{'page': '/movies/%d/?field=seeders&sorder=desc', 'increase': 1, 'second_page': 2,
|
||||
' ': [{'name': ' ', 'url_after': '?field=seeders&sorder=desc'}]}),
|
||||
}
|
||||
|
||||
baseurl = "http://kat.cr"
|
||||
@@ -70,36 +75,37 @@ class KickAssSo(Content.Content):
|
||||
response = self.makeRequest(url, headers=self.headers)
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
# print response
|
||||
if category:
|
||||
contentList = self.mode(response)
|
||||
#print str(contentList)
|
||||
# print str(contentList)
|
||||
return contentList
|
||||
|
||||
def mode(self, response):
|
||||
contentList = []
|
||||
#print str(result)
|
||||
# print str(result)
|
||||
num = 51
|
||||
good_forums=['TV','Anime','Movies']
|
||||
good_forums = ['TV', 'Anime', 'Movies']
|
||||
result = re.compile(
|
||||
r'''title="Download torrent file" href="(.+?\.torrent).+?" class=".+?"><i.+?<a.+?<a.+?<a href="(.+?html)" class=".+?">(.+?)</a>.+? in <span.+?"><strong>.+?">(.+?)</a>.+?<td class="nobr center">(.+?)</td>.+?<td class="center">(\d+ .+?)</td>.+?<td class="green center">(\d+?)</td>.+?<td class="red lasttd center">(\d+?)</td>''',
|
||||
re.DOTALL).findall(response)
|
||||
for link,infolink,title,forum,size,date,seeds,leechers in result:
|
||||
#main
|
||||
r'''title="Download torrent file" href="(.+?\.torrent).+?" class=".+?"><i.+?<a.+?<a.+?<a href="(.+?html)" class=".+?">(.+?)</a>.+? in <span.+?"><strong>.+?">(.+?)</a>.+?<td class="nobr center">(.+?)</td>.+?<td class="center">(\d+ .+?)</td>.+?<td class="green center">(\d+?)</td>.+?<td class="red lasttd center">(\d+?)</td>''',
|
||||
re.DOTALL).findall(response)
|
||||
for link, infolink, title, forum, size, date, seeds, leechers in result:
|
||||
# main
|
||||
if forum in good_forums:
|
||||
info = {}
|
||||
num = num - 1
|
||||
original_title = None
|
||||
year = 0
|
||||
img = ''
|
||||
#info
|
||||
# info
|
||||
|
||||
info['label'] = info['title'] = self.unescape(title)
|
||||
info['link'] = link
|
||||
info['infolink']=self.baseurl+infolink
|
||||
info['infolink'] = self.baseurl + infolink
|
||||
size = self.unescape(self.stripHtml(size))
|
||||
date=self.unescape(self.stripHtml(date))
|
||||
info['plot'] = info['title']+'\r\n[I](%s) [S/L: %s/%s] [/I]\r\nAge: %s' % (size, seeds, leechers, date)
|
||||
date = self.unescape(self.stripHtml(date))
|
||||
info['plot'] = info['title'] + '\r\n[I](%s) [S/L: %s/%s] [/I]\r\nAge: %s' % (
|
||||
size, seeds, leechers, date)
|
||||
|
||||
contentList.append((
|
||||
int(int(self.sourceWeight) * (int(num))),
|
||||
@@ -108,8 +114,8 @@ class KickAssSo(Content.Content):
|
||||
return contentList
|
||||
|
||||
def get_info(self, url):
|
||||
movieInfo={}
|
||||
color='[COLOR blue]%s:[/COLOR] %s\r\n'
|
||||
movieInfo = {}
|
||||
color = '[COLOR blue]%s:[/COLOR] %s\r\n'
|
||||
response = self.makeRequest(url, headers=self.headers)
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
@@ -117,57 +123,59 @@ class KickAssSo(Content.Content):
|
||||
result = Soup.find('div', 'torrentMediaInfo')
|
||||
if not result:
|
||||
return None
|
||||
li=result.findAll('li')
|
||||
info,movieInfo={'Cast':''},{'desc':'','poster':'','title':'','views':'0','rating':'50','kinopoisk':''}
|
||||
li = result.findAll('li')
|
||||
info, movieInfo = {'Cast': ''}, {'desc': '', 'poster': '', 'title': '', 'views': '0', 'rating': '50',
|
||||
'kinopoisk': ''}
|
||||
try:
|
||||
img=result.find('a',{'class':'movieCover'}).find('img').get('src')
|
||||
movieInfo['poster']='http:'+img
|
||||
img = result.find('a', {'class': 'movieCover'}).find('img').get('src')
|
||||
movieInfo['poster'] = 'http:' + img
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
movie=re.compile('View all <strong>(.+?)</strong> episodes</a>').match(str(result))
|
||||
movie = re.compile('View all <strong>(.+?)</strong> episodes</a>').match(str(result))
|
||||
if movie:
|
||||
info['Movie']=movie.group(1)
|
||||
info['Movie'] = movie.group(1)
|
||||
except:
|
||||
pass
|
||||
for i in li:
|
||||
name=i.find('strong').text
|
||||
name = i.find('strong').text
|
||||
if name:
|
||||
info[name.rstrip(':')]=i.text.replace(name,'',1)
|
||||
plot=result.find('div',{'id':'summary'})
|
||||
info[name.rstrip(':')] = i.text.replace(name, '', 1)
|
||||
plot = result.find('div', {'id': 'summary'})
|
||||
if plot:
|
||||
cut=plot.find('strong').text
|
||||
info['plot']=plot.text.replace(cut,'',1).replace('report summary','')
|
||||
#print str(result)
|
||||
cast=re.compile('<a href="/movies/actor/.+?">(.+?)</a>').findall(str(result))
|
||||
cut = plot.find('strong').text
|
||||
info['plot'] = plot.text.replace(cut, '', 1).replace('report summary', '')
|
||||
# print str(result)
|
||||
cast = re.compile('<a href="/movies/actor/.+?">(.+?)</a>').findall(str(result))
|
||||
if cast:
|
||||
for actor in cast:
|
||||
info['Cast']+=actor+", "
|
||||
info['Cast'] += actor + ", "
|
||||
if 'Genres' in info:
|
||||
info['Genres']=info['Genres'].replace(', ',',').replace(',',', ')
|
||||
info['Genres'] = info['Genres'].replace(', ', ',').replace(',', ', ')
|
||||
for key in info.keys():
|
||||
if not 'Movie' in info and info[key]=='addto bookmarks':
|
||||
movieInfo['title']=self.unescape(key)
|
||||
info['TV Show']=self.unescape(key)
|
||||
if not 'Movie' in info and info[key] == 'addto bookmarks':
|
||||
movieInfo['title'] = self.unescape(key)
|
||||
info['TV Show'] = self.unescape(key)
|
||||
if not 'plot' in info and 'Summary' in key:
|
||||
info['plot']=info[key]
|
||||
info['plot'] = info[key]
|
||||
|
||||
for i in ['Movie','TV Show','Release date','Original run','Episode','Air date','Genres','Language','Director','Writers','Cast','Original run','IMDb rating','AniDB rating']:
|
||||
for i in ['Movie', 'TV Show', 'Release date', 'Original run', 'Episode', 'Air date', 'Genres', 'Language',
|
||||
'Director', 'Writers', 'Cast', 'Original run', 'IMDb rating', 'AniDB rating']:
|
||||
if info.get(i) and info.get(i) not in ['']:
|
||||
movieInfo['desc']+=color %(i,info.get(i))
|
||||
if i=='Movie':
|
||||
movieInfo['title']=info.get(i)
|
||||
movieInfo['desc'] += color % (i, info.get(i))
|
||||
if i == 'Movie':
|
||||
movieInfo['title'] = info.get(i)
|
||||
|
||||
for i in ['plot','IMDb link','RottenTomatoes']:
|
||||
for i in ['plot', 'IMDb link', 'RottenTomatoes']:
|
||||
if info.get(i) and info.get(i) not in ['']:
|
||||
if i=='plot':
|
||||
movieInfo['desc']+='\r\n[COLOR blue]Plot:[/COLOR]\r\n'+info.get(i)
|
||||
if i=='RottenTomatoes':
|
||||
movieInfo['rating']=str(info.get(i).split('%')[0])
|
||||
if i=='IMDb link':
|
||||
movieInfo['kinopoisk']='http://imdb.snick.ru/ratefor/02/tt%s.png' % info.get(i)
|
||||
if i == 'plot':
|
||||
movieInfo['desc'] += '\r\n[COLOR blue]Plot:[/COLOR]\r\n' + info.get(i)
|
||||
if i == 'RottenTomatoes':
|
||||
movieInfo['rating'] = str(info.get(i).split('%')[0])
|
||||
if i == 'IMDb link':
|
||||
movieInfo['kinopoisk'] = 'http://imdb.snick.ru/ratefor/02/tt%s.png' % info.get(i)
|
||||
|
||||
|
||||
#print str(info)
|
||||
# print str(info)
|
||||
|
||||
return movieInfo
|
||||
return movieInfo
|
||||
@@ -17,35 +17,41 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
import re
|
||||
import Content
|
||||
from BeautifulSoup import BeautifulSoup
|
||||
|
||||
|
||||
class SWESUB(Content.Content):
|
||||
category_dict = {
|
||||
'tvshows': ('TV Shows', '/senaste-tv-serier/', {'page': '/senaste-tv-serier/?page=%d',
|
||||
'increase': 1, 'second_page': 2,}),
|
||||
'movies': ('Movies', '/senaste-filmer/'),#, {'page': '/senaste-filmer/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'increase': 1, 'second_page': 2, }),
|
||||
'movies': ('Movies', '/senaste-filmer/'),
|
||||
# , {'page': '/senaste-filmer/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'genre': {'genre': 'by Genre',
|
||||
'action': ('Action', '/action/', {'page': '/action/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'adventure': ('Adventure', '/aventyr/', {'page': '/aventyr/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'animation': ('Animation', '/animerat/', {'page': '/animerat/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'comedy': ('Comedy', '/komedi/', {'page': '/komedi/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'crime': ('Crime', '/kriminal/', {'page': '/kriminal/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'documentary': ('Documentary', '/dokumentar/', {'page': '/dokumentar/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'drama': ('Drama', '/drama/', {'page': '/drama/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'family': ('Family', '/familj/', {'page': '/familj/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'fantasy': ('Fantasy', '/fantasy/', {'page': '/fantasy/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'horror': ('Horror', '/skrack/', {'page': '/skrack/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'music': ('Music', '/dans/', {'page': '/dans/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'musical': ('Musical', '/musikal/', {'page': '/musikal/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'romance': ('Romance', '/romantik/', {'page': '/romantik/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'sci_fi': ('Sci-Fi', '/sci-fi/', {'page': '/sci-fi/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'sport': ('Sport', '/sport/', {'page': '/sport/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'thriller': ('Thriller', '/thriller/', {'page': '/thriller/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'war': ('War', '/krig/', {'page': '/krig/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
'western': ('Western', '/western/', {'page': '/western/?page=%d', 'increase': 1, 'second_page': 2,}),
|
||||
}
|
||||
'action': ('Action', '/action/', {'page': '/action/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'adventure': (
|
||||
'Adventure', '/aventyr/', {'page': '/aventyr/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'animation': (
|
||||
'Animation', '/animerat/', {'page': '/animerat/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'comedy': ('Comedy', '/komedi/', {'page': '/komedi/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'crime': ('Crime', '/kriminal/', {'page': '/kriminal/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'documentary': (
|
||||
'Documentary', '/dokumentar/', {'page': '/dokumentar/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'drama': ('Drama', '/drama/', {'page': '/drama/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'family': ('Family', '/familj/', {'page': '/familj/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'fantasy': ('Fantasy', '/fantasy/', {'page': '/fantasy/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'horror': ('Horror', '/skrack/', {'page': '/skrack/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'music': ('Music', '/dans/', {'page': '/dans/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'musical': ('Musical', '/musikal/', {'page': '/musikal/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'romance': (
|
||||
'Romance', '/romantik/', {'page': '/romantik/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'sci_fi': ('Sci-Fi', '/sci-fi/', {'page': '/sci-fi/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'sport': ('Sport', '/sport/', {'page': '/sport/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'thriller': (
|
||||
'Thriller', '/thriller/', {'page': '/thriller/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'war': ('War', '/krig/', {'page': '/krig/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
'western': ('Western', '/western/', {'page': '/western/?page=%d', 'increase': 1, 'second_page': 2, }),
|
||||
}
|
||||
}
|
||||
|
||||
baseurl = "http://swesub.tv"
|
||||
@@ -83,42 +89,42 @@ class SWESUB(Content.Content):
|
||||
url = self.get_url(category, subcategory, apps_property)
|
||||
|
||||
response = self.makeRequest(url, headers=self.headers)
|
||||
response=response.decode('iso-8859-1')
|
||||
response = response.decode('iso-8859-1')
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
if category:
|
||||
contentList = self.mode(response)
|
||||
#print str(contentList)
|
||||
# print str(contentList)
|
||||
return contentList
|
||||
|
||||
def mode(self, response):
|
||||
contentList = []
|
||||
num = 51
|
||||
Soup = BeautifulSoup(response)
|
||||
result = Soup.findAll('article', {'class':'box'})
|
||||
#print str(result)
|
||||
result = Soup.findAll('article', {'class': 'box'})
|
||||
# print str(result)
|
||||
for article in result:
|
||||
#main
|
||||
# main
|
||||
info = {}
|
||||
num = num - 1
|
||||
original_title = None
|
||||
year = 0
|
||||
|
||||
div=article.find('div', {'class':'box-img'})
|
||||
title=div.find('img').get('alt')
|
||||
img=div.find('img').get('src')
|
||||
link=div.find('a').get('href').replace(self.baseurl,'').replace('.html','')
|
||||
div = article.find('div', {'class': 'box-img'})
|
||||
title = div.find('img').get('alt')
|
||||
img = div.find('img').get('src')
|
||||
link = div.find('a').get('href').replace(self.baseurl, '').replace('.html', '')
|
||||
|
||||
#info
|
||||
# info
|
||||
|
||||
info['label'] = info['title'] = self.unescape(title)
|
||||
info['link'] = '%s::%s' % ('Nyaa', self.baseurl+'/downloads'+link+'/')
|
||||
info['infolink']=self.baseurl+link+'.html'
|
||||
info['link'] = '%s::%s' % ('Nyaa', self.baseurl + '/downloads' + link + '/')
|
||||
info['infolink'] = self.baseurl + link + '.html'
|
||||
|
||||
info['plot'] = article.find('div',{'class':'item-content'}).text
|
||||
info['plot'] = article.find('div', {'class': 'item-content'}).text
|
||||
|
||||
contentList.append((
|
||||
int(int(self.sourceWeight) * (int(num))),
|
||||
original_title, title, int(year), img, info,
|
||||
))
|
||||
return contentList
|
||||
return contentList
|
||||
@@ -18,22 +18,24 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
'''
|
||||
import re
|
||||
|
||||
import Content
|
||||
|
||||
|
||||
class ThePirateBaySe(Content.Content):
|
||||
category_dict = {
|
||||
'tvshows': ('TV Shows', '/browse/205', {'page': '/browse/208/%d', 'increase': 1, 'second_page': 1,
|
||||
'sort':[{'name':'by Seeders', 'url_after':'/0/7/0'},
|
||||
{'name':'by Date', 'url_after':'/0/3/0'}]}),
|
||||
'sort': [{'name': 'by Seeders', 'url_after': '/0/7/0'},
|
||||
{'name': 'by Date', 'url_after': '/0/3/0'}]}),
|
||||
'tvshowshd': ('TV Shows [HD]', '/browse/208', {'page': '/browse/208/%d', 'increase': 1, 'second_page': 1,
|
||||
'sort':[{'name':'by Seeders', 'url_after':'/0/7/0'},
|
||||
{'name':'by Date', 'url_after':'/0/3/0'}]}),
|
||||
'sort': [{'name': 'by Seeders', 'url_after': '/0/7/0'},
|
||||
{'name': 'by Date', 'url_after': '/0/3/0'}]}),
|
||||
'movies': ('Movies', '/browse/201', {'page': '/browse/208/%d', 'increase': 1, 'second_page': 1,
|
||||
'sort':[{'name':'by Seeders', 'url_after':'/0/7/0'},
|
||||
{'name':'by Date', 'url_after':'/0/3/0'}]}),
|
||||
'sort': [{'name': 'by Seeders', 'url_after': '/0/7/0'},
|
||||
{'name': 'by Date', 'url_after': '/0/3/0'}]}),
|
||||
'movieshd': ('Movies [HD]', '/browse/207', {'page': '/browse/208/%d', 'increase': 1, 'second_page': 1,
|
||||
'sort':[{'name':'by Seeders', 'url_after':'/0/7/0'},
|
||||
{'name':'by Date', 'url_after':'/0/3/0'}]}),
|
||||
'sort': [{'name': 'by Seeders', 'url_after': '/0/7/0'},
|
||||
{'name': 'by Date', 'url_after': '/0/3/0'}]}),
|
||||
}
|
||||
|
||||
baseurl = "https://thepiratebay.se"
|
||||
@@ -73,19 +75,19 @@ class ThePirateBaySe(Content.Content):
|
||||
response = self.makeRequest(url, headers=self.headers)
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
# print response
|
||||
if category:
|
||||
contentList = self.mode(response)
|
||||
#print str(contentList)
|
||||
# print str(contentList)
|
||||
return contentList
|
||||
|
||||
def mode(self, response):
|
||||
contentList = []
|
||||
#print str(result)
|
||||
# print str(result)
|
||||
num = 31
|
||||
result = re.compile(
|
||||
r'''<div class="detName">.+?">(.+?)</a>.+?<a href="(.+?)".+?<font class="detDesc">Uploaded (.+?), Size (.+?), .+?</font>.+?<td align="right">(\d+?)</td>.+?<td align="right">(\d+?)</td>''',
|
||||
re.DOTALL).findall(response)
|
||||
r'''<div class="detName">.+?">(.+?)</a>.+?<a href="(.+?)".+?<font class="detDesc">Uploaded (.+?), Size (.+?), .+?</font>.+?<td align="right">(\d+?)</td>.+?<td align="right">(\d+?)</td>''',
|
||||
re.DOTALL).findall(response)
|
||||
for title, link, date, size, seeds, leechers in result:
|
||||
info = {}
|
||||
num = num - 1
|
||||
@@ -95,11 +97,11 @@ class ThePirateBaySe(Content.Content):
|
||||
size = size.replace(' ', ' ')
|
||||
date = self.stripHtml(date.replace(' ', ' '))
|
||||
|
||||
#info
|
||||
# info
|
||||
|
||||
info['label'] = info['title'] = self.unescape(title)
|
||||
info['link'] = link
|
||||
info['plot'] = info['title']+'\r\n[I](%s) [S/L: %s/%s] [/I]\r\n%s' % (size, seeds, leechers, date)
|
||||
info['plot'] = info['title'] + '\r\n[I](%s) [S/L: %s/%s] [/I]\r\n%s' % (size, seeds, leechers, date)
|
||||
contentList.append((
|
||||
int(int(self.sourceWeight) * (int(num))),
|
||||
original_title, title, int(year), img, info,
|
||||
|
||||
@@ -11,9 +11,12 @@
|
||||
# PyXBMCt framework module
|
||||
|
||||
import os
|
||||
import xbmc, xbmcgui, xbmcaddon
|
||||
|
||||
#_addon = xbmcaddon.Addon()
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
|
||||
|
||||
# _addon = xbmcaddon.Addon()
|
||||
_images = os.path.join(os.path.dirname(__file__), 'textures', 'default')
|
||||
|
||||
|
||||
@@ -82,6 +85,7 @@ class Label(xbmcgui.ControlLabel):
|
||||
Example:
|
||||
self.label = Label('Status', angle=45)
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
return super(Label, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||
|
||||
@@ -100,6 +104,7 @@ class FadeLabel(xbmcgui.ControlFadeLabel):
|
||||
Example:
|
||||
self.fadelabel = FadeLabel(textColor='0xFFFFFFFF')
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
return super(FadeLabel, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||
|
||||
@@ -117,6 +122,7 @@ class TextBox(xbmcgui.ControlTextBox):
|
||||
Example:
|
||||
self.textbox = TextBox(textColor='0xFFFFFFFF')
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
return super(TextBox, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||
|
||||
@@ -136,6 +142,7 @@ class Image(xbmcgui.ControlImage):
|
||||
Example:
|
||||
self.image = Image('d:\images\picture.jpg', aspectRatio=2)
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
return super(Image, cls).__new__(cls, -10, -10, 1, 1, *args, **kwargs)
|
||||
|
||||
@@ -163,6 +170,7 @@ class Button(xbmcgui.ControlButton):
|
||||
Example:
|
||||
self.button = Button('Status', font='font14')
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
textures = {'focusTexture': os.path.join(_images, 'Button', 'KeyboardKey.png'),
|
||||
'noFocusTexture': os.path.join(_images, 'Button', 'KeyboardKeyNF.png')}
|
||||
@@ -202,6 +210,7 @@ class RadioButton(xbmcgui.ControlRadioButton):
|
||||
Example:
|
||||
self.radiobutton = RadioButton('Status', font='font14')
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if int(xbmc.getInfoLabel('System.BuildVersion')[:2]) >= 13:
|
||||
textures = {'focusTexture': os.path.join(_images, 'RadioButton', 'MenuItemFO.png'),
|
||||
@@ -210,7 +219,7 @@ class RadioButton(xbmcgui.ControlRadioButton):
|
||||
'noFocusOnTexture': os.path.join(_images, 'RadioButton', 'radiobutton-focus.png'),
|
||||
'focusOffTexture': os.path.join(_images, 'RadioButton', 'radiobutton-nofocus.png'),
|
||||
'noFocusOffTexture': os.path.join(_images, 'RadioButton', 'radiobutton-nofocus.png')}
|
||||
else: # This is for compatibility with Frodo and earlier versions.
|
||||
else: # This is for compatibility with Frodo and earlier versions.
|
||||
textures = {'focusTexture': os.path.join(_images, 'RadioButton', 'MenuItemFO.png'),
|
||||
'noFocusTexture': os.path.join(_images, 'RadioButton', 'MenuItemNF.png'),
|
||||
'TextureRadioFocus': os.path.join(_images, 'RadioButton', 'radiobutton-focus.png'),
|
||||
@@ -242,6 +251,7 @@ class Edit(xbmcgui.ControlEdit):
|
||||
example:
|
||||
- self.edit = Edit('Status')
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
textures = {'focusTexture': os.path.join(_images, 'Edit', 'button-focus.png'),
|
||||
'noFocusTexture': os.path.join(_images, 'Edit', 'black-back2.png')}
|
||||
@@ -272,6 +282,7 @@ class List(xbmcgui.ControlList):
|
||||
Example:
|
||||
self.cList = List('font14', space=5)
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
textures = {'buttonTexture': os.path.join(_images, 'List', 'MenuItemNF.png'),
|
||||
'buttonFocusTexture': os.path.join(_images, 'List', 'MenuItemFO.png')}
|
||||
@@ -293,6 +304,7 @@ class Slider(xbmcgui.ControlSlider):
|
||||
Example:
|
||||
self.slider = Slider()
|
||||
"""
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
textures = {'textureback': os.path.join(_images, 'Slider', 'osd_slider_bg.png'),
|
||||
'texture': os.path.join(_images, 'Slider', 'osd_slider_nibNF.png'),
|
||||
@@ -302,7 +314,6 @@ class Slider(xbmcgui.ControlSlider):
|
||||
|
||||
|
||||
class _AbstractWindow(object):
|
||||
|
||||
"""
|
||||
Top-level control window.
|
||||
|
||||
@@ -340,8 +351,8 @@ class _AbstractWindow(object):
|
||||
self.x = pos_x
|
||||
self.y = pos_y
|
||||
else:
|
||||
self.x = 640 - self.width/2
|
||||
self.y = 360 - self.height/2
|
||||
self.x = 640 - self.width / 2
|
||||
self.y = 360 - self.height / 2
|
||||
self.setGrid()
|
||||
|
||||
def setGrid(self):
|
||||
@@ -351,8 +362,8 @@ class _AbstractWindow(object):
|
||||
"""
|
||||
self.grid_x = self.x
|
||||
self.grid_y = self.y
|
||||
self.tile_width = self.width/self.columns
|
||||
self.tile_height = self.height/self.rows
|
||||
self.tile_width = self.width / self.columns
|
||||
self.tile_height = self.height / self.rows
|
||||
|
||||
def placeControl(self, control, row, column, rowspan=1, columnspan=1, pad_x=5, pad_y=5):
|
||||
"""
|
||||
@@ -478,9 +489,9 @@ class _AbstractWindow(object):
|
||||
self.disconnect(ACTION_NAV_BACK)
|
||||
"""
|
||||
if type(event) == int:
|
||||
event_list = self.actions_connected
|
||||
event_list = self.actions_connected
|
||||
else:
|
||||
event_list = self.controls_connected
|
||||
event_list = self.controls_connected
|
||||
for index in range(len(event_list)):
|
||||
if event == event_list[index][0]:
|
||||
event_list.pop(index)
|
||||
@@ -525,7 +536,6 @@ class _AbstractWindow(object):
|
||||
|
||||
|
||||
class _AddonWindow(_AbstractWindow):
|
||||
|
||||
"""
|
||||
Top-level control window.
|
||||
|
||||
@@ -570,12 +580,14 @@ class _AddonWindow(_AbstractWindow):
|
||||
self.addControl(self.title_background)
|
||||
self.setAnimation(self.title_background)
|
||||
self.title_bar = xbmcgui.ControlLabel(-10, -10, 1, 1, title, alignment=ALIGN_CENTER, textColor='0xFFFFA500',
|
||||
font='font13_title')
|
||||
font='font13_title')
|
||||
self.addControl(self.title_bar)
|
||||
self.setAnimation(self.title_bar)
|
||||
self.window_close_button = xbmcgui.ControlButton(-100, -100, 60, 30, '',
|
||||
focusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton-focus.png'),
|
||||
noFocusTexture=os.path.join(_images, 'AddonWindow', 'DialogCloseButton.png'))
|
||||
focusTexture=os.path.join(_images, 'AddonWindow',
|
||||
'DialogCloseButton-focus.png'),
|
||||
noFocusTexture=os.path.join(_images, 'AddonWindow',
|
||||
'DialogCloseButton.png'))
|
||||
self.addControl(self.window_close_button)
|
||||
self.setAnimation(self.window_close_button)
|
||||
|
||||
@@ -614,9 +626,10 @@ class _AddonWindow(_AbstractWindow):
|
||||
"""
|
||||
self.grid_x = self.x + self.X_MARGIN + self.win_padding
|
||||
self.grid_y = self.y + self.Y_MARGIN + self.Y_SHIFT + self.HEADER_HEIGHT + self.win_padding
|
||||
self.tile_width = (self.width - 2 * (self.X_MARGIN + self.win_padding))/self.columns
|
||||
self.tile_width = (self.width - 2 * (self.X_MARGIN + self.win_padding)) / self.columns
|
||||
self.tile_height = (
|
||||
self.height - self.HEADER_HEIGHT - self.Y_SHIFT - 2 * (self.Y_MARGIN + self.win_padding))/self.rows
|
||||
self.height - self.HEADER_HEIGHT - self.Y_SHIFT - 2 * (
|
||||
self.Y_MARGIN + self.win_padding)) / self.rows
|
||||
|
||||
def setWindowTitle(self, title=''):
|
||||
"""
|
||||
@@ -632,8 +645,8 @@ class _AddonWindow(_AbstractWindow):
|
||||
"""Get window title."""
|
||||
return self.title_bar.getLabel()
|
||||
|
||||
class _FullWindow(xbmcgui.Window):
|
||||
|
||||
class _FullWindow(xbmcgui.Window):
|
||||
"""An abstract class to define window event processing."""
|
||||
|
||||
def onAction(self, action):
|
||||
@@ -659,7 +672,6 @@ class _FullWindow(xbmcgui.Window):
|
||||
|
||||
|
||||
class _DialogWindow(xbmcgui.WindowDialog):
|
||||
|
||||
"""An abstract class to define window event processing."""
|
||||
|
||||
def onAction(self, action):
|
||||
@@ -718,8 +730,8 @@ class BlankDialogWindow(_DialogWindow, _AbstractWindow):
|
||||
"""
|
||||
pass
|
||||
|
||||
class AddonFullWindow(_FullWindow, _AddonWindow):
|
||||
|
||||
class AddonFullWindow(_FullWindow, _AddonWindow):
|
||||
"""
|
||||
Addon UI container with a solid background.
|
||||
Control window is displayed on top of the main background image - self.main_bg.
|
||||
|
||||
@@ -12,7 +12,6 @@ import xbmcgui
|
||||
import Localization
|
||||
from net import HTTP
|
||||
|
||||
|
||||
try:
|
||||
from sqlite3 import dbapi2 as sqlite
|
||||
except:
|
||||
@@ -33,7 +32,7 @@ class Cache:
|
||||
|
||||
def get(self, token, callback, *param):
|
||||
cur = self.db.cursor()
|
||||
cur.execute('select expire,data from cache where id=? limit 1', (token, ))
|
||||
cur.execute('select expire,data from cache where id=? limit 1', (token,))
|
||||
row = cur.fetchone()
|
||||
cur.close()
|
||||
|
||||
@@ -67,7 +66,7 @@ class Cache:
|
||||
def expire(self, expire):
|
||||
# with rtrCache_lock:
|
||||
cur = self.db.cursor()
|
||||
cur.execute('delete from cache where addtime<?', (int(time.time()) - expire, ))
|
||||
cur.execute('delete from cache where addtime<?', (int(time.time()) - expire,))
|
||||
self.db.commit()
|
||||
cur.close()
|
||||
|
||||
@@ -77,7 +76,7 @@ class Cache:
|
||||
if os.path.getsize(self.filename) < size:
|
||||
break
|
||||
cur = self.db.cursor()
|
||||
cur.execute('select id from cache order by addtime asc limit ?', (step, ))
|
||||
cur.execute('select id from cache order by addtime asc limit ?', (step,))
|
||||
rows = cur.fetchall()
|
||||
if not rows:
|
||||
cur.close()
|
||||
@@ -129,7 +128,7 @@ class Cache:
|
||||
cur.execute('create table cache(id varchar(255) unique, addtime integer, expire integer, data blob)')
|
||||
cur.execute('create index time on cache(addtime asc)')
|
||||
cur.execute('create table db_ver(version real)')
|
||||
cur.execute('insert into db_ver(version) values(?)', (self.version, ))
|
||||
cur.execute('insert into db_ver(version) values(?)', (self.version,))
|
||||
self.db.commit()
|
||||
cur.close()
|
||||
|
||||
@@ -137,7 +136,7 @@ class Cache:
|
||||
scrapers = {'tvdb': 'TheTVDB.com', 'tmdb': 'TheMovieDB.org', 'kinopoisk': 'KinoPoisk.ru'}
|
||||
ok = xbmcgui.Dialog().yesno(Localization.localize('Content Lists'),
|
||||
Localization.localize('Do you want to preload full metadata?') + ' (%s)' % (
|
||||
scrapers[os.path.basename(self.filename).split('.')[0]]),
|
||||
scrapers[os.path.basename(self.filename).split('.')[0]]),
|
||||
Localization.localize('It is highly recommended!'))
|
||||
if ok:
|
||||
return self.download()
|
||||
@@ -146,7 +145,7 @@ class Cache:
|
||||
|
||||
def download(self):
|
||||
dirname = os.path.dirname(self.filename)
|
||||
zipname = os.path.basename(self.filename).replace('.db','') + '.zip'
|
||||
zipname = os.path.basename(self.filename).replace('.db', '') + '.zip'
|
||||
url = 'http://www.tat-store.ru/torrenter/' + zipname
|
||||
self.http = HTTP()
|
||||
response = self.http.fetch(url, download=os.path.join(dirname, zipname), progress=True)
|
||||
|
||||
@@ -27,10 +27,8 @@ import math
|
||||
import difflib
|
||||
|
||||
import translit
|
||||
import LOGGER as Log
|
||||
from HTTP import *
|
||||
|
||||
|
||||
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22'
|
||||
# USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22'
|
||||
ENCODING_PLEX = 'utf-8'
|
||||
@@ -230,7 +228,7 @@ def scoreMediaTitleMatch(mediaName, mediaYear, title, altTitle, year, itemIndex)
|
||||
elif yearDiff == 2:
|
||||
yearPenalty = 25
|
||||
score = score - yearPenalty
|
||||
#print str(mediaYear)+' '+str(year)+' '+str(yearPenalty)
|
||||
# print str(mediaYear)+' '+str(year)+' '+str(yearPenalty)
|
||||
|
||||
# Compute title penalty.
|
||||
titlePenalty = computeTitlePenalty(mediaName, title)
|
||||
@@ -364,8 +362,8 @@ def computeTitlePenalty(mediaName, title):
|
||||
penaltyAlt = penaltyAlt + int(penaltyPerPart * (1 - partDiffRatio))
|
||||
i = i + 1
|
||||
penalty = min(penalty, penaltyAlt)
|
||||
# print '++++++ DIFF("%s", "%s") = %g --> %d' % (mediaName.encode('utf8'), title.encode('utf8'), diffRatio, penalty)
|
||||
# Log.Debug('++++++ DIFF("%s", "%s") = %g --> %d' % (mediaName.encode('utf8'), title.encode('utf8'), diffRatio, penalty))
|
||||
# print '++++++ DIFF("%s", "%s") = %g --> %d' % (mediaName.encode('utf8'), title.encode('utf8'), diffRatio, penalty)
|
||||
# Log.Debug('++++++ DIFF("%s", "%s") = %g --> %d' % (mediaName.encode('utf8'), title.encode('utf8'), diffRatio, penalty))
|
||||
return penalty
|
||||
return 0
|
||||
|
||||
|
||||
@@ -32,9 +32,11 @@ import pluginsettings as S
|
||||
import translit
|
||||
|
||||
|
||||
|
||||
|
||||
# MATCHER_MOVIE_DURATION = re.compile('\s*(\d+).*?', re.UNICODE | re.DOTALL)
|
||||
#MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s*\(\s*([\s\d]+)\s*\)', re.UNICODE | re.DOTALL)
|
||||
#MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s?\((.*)\)', re.UNICODE)
|
||||
# MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s*\(\s*([\s\d]+)\s*\)', re.UNICODE | re.DOTALL)
|
||||
# MATCHER_IMDB_RATING = re.compile('IMDb:\s*(\d+\.?\d*)\s?\((.*)\)', re.UNICODE)
|
||||
|
||||
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22'
|
||||
'''
|
||||
@@ -171,5 +173,3 @@ class PageParser:
|
||||
results.append([itemKinoPoiskId, itemTitle, itemYear, itemScore])
|
||||
|
||||
return results
|
||||
|
||||
|
||||
@@ -19,11 +19,9 @@ Simple transliteration
|
||||
"""
|
||||
|
||||
# __id__ = __revision__ = "$Id: translit.py 102 2007-07-12 12:33:36Z the.pythy $"
|
||||
#__url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/translit.py $"
|
||||
# __url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/translit.py $"
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
TRANSTABLE = (
|
||||
(u"'", u"'"),
|
||||
|
||||
@@ -11,7 +11,6 @@ import kinopoisk.LOGGER
|
||||
import kinopoisk.pageparser
|
||||
import kinopoisk.common
|
||||
|
||||
|
||||
GENRE = {
|
||||
'anime': 1750,
|
||||
'biography': 22,
|
||||
@@ -295,7 +294,7 @@ class KinoPoisk:
|
||||
"""
|
||||
|
||||
def __init__(self, language='ru'):
|
||||
dbname='kinopoisk.%s.db' % language
|
||||
dbname = 'kinopoisk.%s.db' % language
|
||||
self.cache = Cache(dbname, 1.0)
|
||||
self.html = Clear()
|
||||
|
||||
@@ -463,8 +462,9 @@ class KinoPoisk:
|
||||
if len(data) == 3:
|
||||
i = 0
|
||||
for mon in (
|
||||
u'января', u'февраля', u'марта', u'апреля', u'мая', u'июня', u'июля', u'августа', u'сентября',
|
||||
u'октября', u'ноября', u'декабря'):
|
||||
u'января', u'февраля', u'марта', u'апреля', u'мая', u'июня', u'июля', u'августа',
|
||||
u'сентября',
|
||||
u'октября', u'ноября', u'декабря'):
|
||||
i += 1
|
||||
if mon == data[1]:
|
||||
mon = str(i)
|
||||
|
||||
@@ -12,10 +12,8 @@ import itertools
|
||||
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
import xbmcaddon
|
||||
import xbmcvfs
|
||||
|
||||
|
||||
RE = {
|
||||
'content-disposition': re.compile('attachment;\sfilename="*([^"\s]+)"|\s')
|
||||
}
|
||||
@@ -34,7 +32,6 @@ class HTTP:
|
||||
if not xbmcvfs.exists(self._dirname):
|
||||
xbmcvfs.mkdir(self._dirname)
|
||||
|
||||
|
||||
def fetch(self, request, **kwargs):
|
||||
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
|
||||
|
||||
@@ -74,7 +71,6 @@ class HTTP:
|
||||
|
||||
return self.response
|
||||
|
||||
|
||||
def _opener(self):
|
||||
|
||||
build = [urllib2.HTTPHandler()]
|
||||
@@ -101,7 +97,6 @@ class HTTP:
|
||||
|
||||
urllib2.install_opener(urllib2.build_opener(*build))
|
||||
|
||||
|
||||
def _fetch(self):
|
||||
params = {} if self.request.params is None else self.request.params
|
||||
|
||||
@@ -130,7 +125,7 @@ class HTTP:
|
||||
':'.join([self.request.auth_username, self.request.auth_password])).strip())
|
||||
|
||||
self.con = urllib2.urlopen(req, timeout=self.request.timeout)
|
||||
#self.con = urllib2.urlopen(req)
|
||||
# self.con = urllib2.urlopen(req)
|
||||
self.response.headers = self._headers(self.con.info())
|
||||
|
||||
if self.request.download:
|
||||
@@ -141,7 +136,6 @@ class HTTP:
|
||||
if self.request.cookies:
|
||||
self.cookies.save(self.request.cookies)
|
||||
|
||||
|
||||
def _download(self):
|
||||
fd = open(self.request.download, 'wb')
|
||||
if self.request.progress:
|
||||
@@ -173,7 +167,6 @@ class HTTP:
|
||||
|
||||
self.response.filename = self.request.download
|
||||
|
||||
|
||||
def _upload(self, upload, params):
|
||||
res = []
|
||||
boundary = mimetools.choose_boundary()
|
||||
@@ -209,7 +202,6 @@ class HTTP:
|
||||
result.append('')
|
||||
return boundary, '\r\n'.join(result)
|
||||
|
||||
|
||||
def _headers(self, raw):
|
||||
headers = {}
|
||||
for line in raw.headers:
|
||||
@@ -221,7 +213,6 @@ class HTTP:
|
||||
headers[tag] = value
|
||||
return headers
|
||||
|
||||
|
||||
def _progress(self, read, size, name):
|
||||
res = []
|
||||
if size < 0:
|
||||
@@ -304,4 +295,3 @@ class HTTPResponse:
|
||||
else:
|
||||
args += ',body=None'
|
||||
return '%s(%s)' % (self.__class__.__name__, args)
|
||||
|
||||
@@ -383,7 +383,6 @@ def get_unicode_from_response(r):
|
||||
except TypeError:
|
||||
return r.content
|
||||
|
||||
|
||||
# The unreserved URI characters (RFC 3986)
|
||||
UNRESERVED_SET = frozenset(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
@@ -519,6 +518,7 @@ def should_bypass_proxies(url):
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def get_environ_proxies(url):
|
||||
"""Return a dict of environment proxies."""
|
||||
if should_bypass_proxies(url):
|
||||
@@ -600,7 +600,6 @@ def parse_header_links(value):
|
||||
|
||||
return links
|
||||
|
||||
|
||||
# Null bytes; no need to recreate these on each call to guess_json_utf
|
||||
_null = '\x00'.encode('ascii') # encoding to ASCII for Python 3
|
||||
_null2 = _null * 2
|
||||
@@ -613,26 +612,26 @@ def guess_json_utf(data):
|
||||
# determine the encoding. Also detect a BOM, if present.
|
||||
sample = data[:4]
|
||||
if sample in (codecs.BOM_UTF32_LE, codecs.BOM32_BE):
|
||||
return 'utf-32' # BOM included
|
||||
return 'utf-32' # BOM included
|
||||
if sample[:3] == codecs.BOM_UTF8:
|
||||
return 'utf-8-sig' # BOM included, MS style (discouraged)
|
||||
if sample[:2] in (codecs.BOM_UTF16_LE, codecs.BOM_UTF16_BE):
|
||||
return 'utf-16' # BOM included
|
||||
return 'utf-16' # BOM included
|
||||
nullcount = sample.count(_null)
|
||||
if nullcount == 0:
|
||||
return 'utf-8'
|
||||
if nullcount == 2:
|
||||
if sample[::2] == _null2: # 1st and 3rd are null
|
||||
if sample[::2] == _null2: # 1st and 3rd are null
|
||||
return 'utf-16-be'
|
||||
if sample[1::2] == _null2: # 2nd and 4th are null
|
||||
return 'utf-16-le'
|
||||
# Did not detect 2 valid UTF-16 ascii-range characters
|
||||
# Did not detect 2 valid UTF-16 ascii-range characters
|
||||
if nullcount == 3:
|
||||
if sample[:3] == _null3:
|
||||
return 'utf-32-be'
|
||||
if sample[1:] == _null3:
|
||||
return 'utf-32-le'
|
||||
# Did not detect a valid UTF-32 ascii-range character
|
||||
# Did not detect a valid UTF-32 ascii-range character
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
#import xbmc, xbmcgui, xbmcplugin, xbmcvfs
|
||||
import xbmcaddon
|
||||
# import xbmc, xbmcgui, xbmcplugin, xbmcvfs
|
||||
from tvdb import TvDb
|
||||
from tmdbs import TmDb
|
||||
from kinopoisks import KinoPoisk
|
||||
|
||||
|
||||
STATUS = {
|
||||
'moder': (40501, 'FFFF0000'),
|
||||
'check': (40502, 'FFFF0000'),
|
||||
@@ -90,7 +88,7 @@ class Scrapers():
|
||||
scraper = TvDb(language)
|
||||
elif content == 'tmdb':
|
||||
scraper = TmDb(language)
|
||||
else: #if content == 'kinopoisk':
|
||||
else: # if content == 'kinopoisk':
|
||||
scraper = KinoPoisk(language)
|
||||
|
||||
name, search, year = item['label'], item['search'], item['year']
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
import urllib
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import os
|
||||
import time
|
||||
|
||||
import SearcherABC
|
||||
|
||||
@@ -66,7 +63,7 @@ class RuTrackerOrg(SearcherABC.SearcherABC):
|
||||
|
||||
def search(self, keyword):
|
||||
filesList = []
|
||||
url='http://rutracker.org/forum/tracker.php?nm=' + urllib.quote_plus(keyword)
|
||||
url = 'http://rutracker.org/forum/tracker.php?nm=' + urllib.quote_plus(keyword)
|
||||
|
||||
data = {'prev_my': '0',
|
||||
'prev_new': '0',
|
||||
@@ -79,11 +76,11 @@ class RuTrackerOrg(SearcherABC.SearcherABC):
|
||||
response = self.makeRequest(url, data=data)
|
||||
if None != response and 0 < len(response):
|
||||
response = response.decode('cp1251').encode('utf8')
|
||||
#print response
|
||||
# print response
|
||||
if not self.check_login(response):
|
||||
response = self.makeRequest(url, data=data)
|
||||
response = response.decode('cp1251').encode('utf8')
|
||||
#print response
|
||||
# print response
|
||||
forums = [7, 187, 2090, 2221, 2091, 2092, 2093, 934, 505, 212, 2459, 1235, 185, 22, 941, 1666, 124, 1543,
|
||||
376, 709, 1577, 511, 656, 93, 905, 1576, 101, 100, 103, 572, 1670, 2198, 2199, 313, 2201, 312,
|
||||
2339, 314, 352, 549, 1213, 2109, 514, 2097, 4, 930, 2365, 1900, 521, 2258, 208, 539, 209, 484,
|
||||
@@ -128,19 +125,19 @@ class RuTrackerOrg(SearcherABC.SearcherABC):
|
||||
|
||||
def getTorrentFile(self, url):
|
||||
self.load_cookie()
|
||||
cookie=None
|
||||
cookie = None
|
||||
for cookie in self.cookieJar:
|
||||
if cookie.name=='bb_data' and cookie.domain=='.rutracker.org':
|
||||
cookie = 'bb_data=' + cookie.value + '; bb_dl=' + re.search('(\d+)$',url).group(1)
|
||||
if cookie.name == 'bb_data' and cookie.domain == '.rutracker.org':
|
||||
cookie = 'bb_data=' + cookie.value + '; bb_dl=' + re.search('(\d+)$', url).group(1)
|
||||
break
|
||||
if not cookie:
|
||||
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$',url).group(1)
|
||||
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$', url).group(1)
|
||||
|
||||
referer = 'http://rutracker.org/forum/viewtopic.php?t=' + re.search('(\d+)$', url).group(1)
|
||||
headers=[('Cookie', cookie), ('Referer', referer)]
|
||||
headers = [('Cookie', cookie), ('Referer', referer)]
|
||||
content = self.makeRequest(url, headers=headers)
|
||||
if not self.check_login(content):
|
||||
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$',url).group(1)
|
||||
cookie = self.login() + '; bb_dl=' + re.search('(\d+)$', url).group(1)
|
||||
content = self.makeRequest(url, headers=[('Cookie', cookie), ('Referer', referer)])
|
||||
|
||||
return self.saveTorrentFile(url, content)
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
'''
|
||||
|
||||
import re
|
||||
import os
|
||||
import urllib
|
||||
import tempfile
|
||||
import sys
|
||||
|
||||
import SearcherABC
|
||||
@@ -63,25 +61,26 @@ class T411FR(SearcherABC.SearcherABC):
|
||||
))'''
|
||||
|
||||
headers = {('Origin', 'http://t411.io'),
|
||||
('User-Agent',
|
||||
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||
('Referer', 'http://t411.io/'),('X-NewRelic-ID','x='),
|
||||
('X-Requested-With','XMLHttpRequest'),}
|
||||
('User-Agent',
|
||||
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||
('Referer', 'http://t411.io/'), ('X-NewRelic-ID', 'x='),
|
||||
('X-Requested-With', 'XMLHttpRequest'), }
|
||||
|
||||
def search(self, keyword):
|
||||
filesList = []
|
||||
url='http://www.t411.io/torrents/search/?search=%s' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
|
||||
url+='&order=seeders&type=desc'
|
||||
url = 'http://www.t411.io/torrents/search/?search=%s' % urllib.quote_plus(
|
||||
keyword.decode('utf-8').encode('cp1251'))
|
||||
url += '&order=seeders&type=desc'
|
||||
response = self.makeRequest(url, headers=self.headers)
|
||||
if None != response and 0 < len(response):
|
||||
#self.cookieJar.save(ignore_discard=True)
|
||||
#self.check_login(response)
|
||||
#print response
|
||||
# self.cookieJar.save(ignore_discard=True)
|
||||
# self.check_login(response)
|
||||
# print response
|
||||
regex = '''<a href="//.+?" title="(.+?)">.+?<span class="up">.+?<a href="/torrents/nfo/\?id=(\d+)" class="ajax nfo"></a>.+?</td>.+?<td align="center">.+?</td>.+?<td align="center">.+?</td>.+?<td align="center">(.+?)</td>.+?<td align="center" class="up">(\d+)</td>.+?<td align="center" class="down">(\d+)</td>'''
|
||||
for (title, link, size, seeds, leechers) in re.compile(regex, re.DOTALL).findall(response):
|
||||
title=self.clear_title(title)
|
||||
title = self.clear_title(title)
|
||||
image = sys.modules["__main__"].__root__ + self.searchIcon
|
||||
link = 'http://www.t411.io/torrents/download/?id='+link
|
||||
link = 'http://www.t411.io/torrents/download/?id=' + link
|
||||
filesList.append((
|
||||
int(int(self.sourceWeight) * int(seeds)),
|
||||
int(seeds), int(leechers), size,
|
||||
@@ -92,11 +91,11 @@ class T411FR(SearcherABC.SearcherABC):
|
||||
return filesList
|
||||
|
||||
def clear_title(self, s):
|
||||
return self.stripHtml(self.unescape(s)).replace(' ',' ').replace(' ',' ').strip()
|
||||
return self.stripHtml(self.unescape(s)).replace(' ', ' ').replace(' ', ' ').strip()
|
||||
|
||||
def check_login(self, response=None):
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
# print response
|
||||
if re.compile('<input class="userInput"').search(response) or \
|
||||
re.compile('start cache').search(response):
|
||||
print 'T411FR Not logged!'
|
||||
@@ -106,24 +105,24 @@ class T411FR(SearcherABC.SearcherABC):
|
||||
|
||||
def getTorrentFile(self, url):
|
||||
content = self.makeRequest(url, headers=self.headers)
|
||||
#print content
|
||||
# print content
|
||||
if not self.check_login(content):
|
||||
content = self.makeRequest(url, headers=self.headers)
|
||||
#return url
|
||||
# return url
|
||||
return self.saveTorrentFile(url, content)
|
||||
|
||||
def login(self):
|
||||
data = {
|
||||
'password': 'toraddon20',
|
||||
'login': 'zombitorrent',
|
||||
'remember':'1'
|
||||
'remember': '1'
|
||||
}
|
||||
x=self.makeRequest(
|
||||
'http://www.t411.io/users/auth/',data=data, headers=self.headers)
|
||||
if re.search('{"status":"OK"',x):
|
||||
x = self.makeRequest(
|
||||
'http://www.t411.io/users/auth/', data=data, headers=self.headers)
|
||||
if re.search('{"status":"OK"', x):
|
||||
print 'LOGGED T411FR'
|
||||
self.cookieJar.save(ignore_discard=True)
|
||||
for cookie in self.cookieJar:
|
||||
if cookie.name == 'authKey' and cookie.domain=='.t411.io':
|
||||
if cookie.name == 'authKey' and cookie.domain == '.t411.io':
|
||||
return 'authKey=' + cookie.value
|
||||
return False
|
||||
return False
|
||||
@@ -19,9 +19,7 @@
|
||||
'''
|
||||
|
||||
import re
|
||||
import os
|
||||
import urllib
|
||||
import tempfile
|
||||
import sys
|
||||
|
||||
import SearcherABC
|
||||
@@ -64,8 +62,8 @@ class TFileME(SearcherABC.SearcherABC):
|
||||
|
||||
def search(self, keyword):
|
||||
filesList = []
|
||||
url='http://tfile.me/forum/ssearch.php?q=%s' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
|
||||
url+='&c=2&f=4&f=1488&f=1379&f=1225&f=1331&f=1248&f=1197&f=1026&f=293&f=1227&f=577&f=298&f=297&f=290&f=299&f=230&f=303&f=292&f=1240&f=304&f=296&f=300&f=1332&f=1324&f=691&f=301&f=294&f=1241&f=498&f=367&f=574&f=1226&f=295&f=189&f=1525&f=1224&f=1388&f=1387&f=1276&f=1889&f=1917&f=1907&f=1908&f=1909&f=1910&f=1911&f=1890&f=1891&f=1892&f=1893&f=1912&f=1899&f=1894&f=1895&f=1903&f=1896&f=1897&f=1898&f=1900&f=1902&f=1901&f=1904&f=1905&f=1906&f=1913&f=15&f=1918&f=1374&f=1946&f=1579&f=1947&f=1242&f=1508&f=1165&f=1166&f=1245&f=1158&f=532&f=1167&f=1159&f=1244&f=1160&f=1173&f=1238&f=1678&f=1161&f=1320&f=1162&f=1246&f=496&f=1164&f=1163&f=1172&f=1243&f=1386&f=1312&f=1536&f=1919&f=1577&f=1989&f=1578&f=1554&f=1537&f=1538&f=1539&f=1540&f=1541&f=1542&f=1543&f=1555&f=1680&f=1544&f=1556&f=1545&f=1546&f=1547&f=1848&f=1548&f=1550&f=1620&f=1920&f=193&f=1968&f=1237&f=1420&f=1036&f=449&f=448&f=447&f=537&f=1170&f=37&f=1921&f=1323&f=1252&f=1685&f=697&f=172&f=311&f=183&f=130&f=1024&f=139&f=1023&f=179&f=392&f=308&f=342&f=1612&f=1015&f=96&f=353&f=997&f=285&f=154&f=1613&f=975&f=168&f=1849&f=1020&f=265&f=123&f=1614&f=1615&f=117&f=155&f=1611&f=1616&f=1617&f=152&f=105&f=312&f=127&f=1030&f=150&f=328&f=305&f=149&f=136&f=134&f=158&f=169&f=1421&f=768&f=767&f=309&f=377&f=1017&f=1590&f=1923&f=1591&f=1966&f=1592&f=1607&f=1593&f=1594&f=1595&f=1596&f=1597&f=1598&f=1599&f=1600&f=1844&f=1601&f=1602&f=1603&f=1604&f=1605&f=1681&f=17&f=1924&f=1415&f=1964&f=1416&f=1304&f=1146&f=1147&f=1156&f=1534&f=1142&f=29&f=85&f=1514&f=1148&f=1515&f=384&f=216&f=1149&f=232&f=1535&f=506&f=1517&f=1516&f=1000&f=1518&f=237&f=243&f=1150&f=244&f=239&f=197&f=236&f=1151&f=235&f=1152&f=234&f=1153&f=1018&f=1143&f=1563&f=1925&f=1564&f=1565&f=1566&f=1567&f=1568&f=1569&f=1570&f=1571&f=1572&f=1574&f=1575&f=1576&f=1926&f=175&f=1881&f=1256&f=1145&f=1140&f=1253&f=1157&f=727&f=1551&f=567&f=1254&f=219&f=568&f=974&f=495&f=743&f=494&f=401&f=731&f=499&f=500&f=538&f=206&f=1040&f=446&f=1005&f=210&f=203&f=207&f=204&f=1255&f=202&f=1141&f=16&f=1927&f=1380&f=1425&f=1438&f=1333&f=187&f=1062&f=1310&f=1059&f=1033&f=1509&f=1193&f=1195&f=1064&f=1063&f=1028&f=1058&f=1019&f=490&f=1397&f=1065&f=1419&f=1194&f=1070&f=274&f=1383&f=1334&f=1067&f=1068&f=1066&f=1069&f=1060&f=1282&f=19&f=1915&f=1872&f=1922&f=1284&f=1294&f=1301&f=1288&f=1291&f=1309&f=39&f=1285&f=1290&f=1306&f=1295&f=1300&f=1302&f=1287&f=1307&f=1292&f=1299&f=1297&f=1293&f=1888&f=1286&f=1298&f=1296&f=1519&f=1303&f=1527&g=&act=&y=&ql=&a=&d=&o=&size_min=0&size_max=0'
|
||||
url = 'http://tfile.me/forum/ssearch.php?q=%s' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
|
||||
url += '&c=2&f=4&f=1488&f=1379&f=1225&f=1331&f=1248&f=1197&f=1026&f=293&f=1227&f=577&f=298&f=297&f=290&f=299&f=230&f=303&f=292&f=1240&f=304&f=296&f=300&f=1332&f=1324&f=691&f=301&f=294&f=1241&f=498&f=367&f=574&f=1226&f=295&f=189&f=1525&f=1224&f=1388&f=1387&f=1276&f=1889&f=1917&f=1907&f=1908&f=1909&f=1910&f=1911&f=1890&f=1891&f=1892&f=1893&f=1912&f=1899&f=1894&f=1895&f=1903&f=1896&f=1897&f=1898&f=1900&f=1902&f=1901&f=1904&f=1905&f=1906&f=1913&f=15&f=1918&f=1374&f=1946&f=1579&f=1947&f=1242&f=1508&f=1165&f=1166&f=1245&f=1158&f=532&f=1167&f=1159&f=1244&f=1160&f=1173&f=1238&f=1678&f=1161&f=1320&f=1162&f=1246&f=496&f=1164&f=1163&f=1172&f=1243&f=1386&f=1312&f=1536&f=1919&f=1577&f=1989&f=1578&f=1554&f=1537&f=1538&f=1539&f=1540&f=1541&f=1542&f=1543&f=1555&f=1680&f=1544&f=1556&f=1545&f=1546&f=1547&f=1848&f=1548&f=1550&f=1620&f=1920&f=193&f=1968&f=1237&f=1420&f=1036&f=449&f=448&f=447&f=537&f=1170&f=37&f=1921&f=1323&f=1252&f=1685&f=697&f=172&f=311&f=183&f=130&f=1024&f=139&f=1023&f=179&f=392&f=308&f=342&f=1612&f=1015&f=96&f=353&f=997&f=285&f=154&f=1613&f=975&f=168&f=1849&f=1020&f=265&f=123&f=1614&f=1615&f=117&f=155&f=1611&f=1616&f=1617&f=152&f=105&f=312&f=127&f=1030&f=150&f=328&f=305&f=149&f=136&f=134&f=158&f=169&f=1421&f=768&f=767&f=309&f=377&f=1017&f=1590&f=1923&f=1591&f=1966&f=1592&f=1607&f=1593&f=1594&f=1595&f=1596&f=1597&f=1598&f=1599&f=1600&f=1844&f=1601&f=1602&f=1603&f=1604&f=1605&f=1681&f=17&f=1924&f=1415&f=1964&f=1416&f=1304&f=1146&f=1147&f=1156&f=1534&f=1142&f=29&f=85&f=1514&f=1148&f=1515&f=384&f=216&f=1149&f=232&f=1535&f=506&f=1517&f=1516&f=1000&f=1518&f=237&f=243&f=1150&f=244&f=239&f=197&f=236&f=1151&f=235&f=1152&f=234&f=1153&f=1018&f=1143&f=1563&f=1925&f=1564&f=1565&f=1566&f=1567&f=1568&f=1569&f=1570&f=1571&f=1572&f=1574&f=1575&f=1576&f=1926&f=175&f=1881&f=1256&f=1145&f=1140&f=1253&f=1157&f=727&f=1551&f=567&f=1254&f=219&f=568&f=974&f=495&f=743&f=494&f=401&f=731&f=499&f=500&f=538&f=206&f=1040&f=446&f=1005&f=210&f=203&f=207&f=204&f=1255&f=202&f=1141&f=16&f=1927&f=1380&f=1425&f=1438&f=1333&f=187&f=1062&f=1310&f=1059&f=1033&f=1509&f=1193&f=1195&f=1064&f=1063&f=1028&f=1058&f=1019&f=490&f=1397&f=1065&f=1419&f=1194&f=1070&f=274&f=1383&f=1334&f=1067&f=1068&f=1066&f=1069&f=1060&f=1282&f=19&f=1915&f=1872&f=1922&f=1284&f=1294&f=1301&f=1288&f=1291&f=1309&f=39&f=1285&f=1290&f=1306&f=1295&f=1300&f=1302&f=1287&f=1307&f=1292&f=1299&f=1297&f=1293&f=1888&f=1286&f=1298&f=1296&f=1519&f=1303&f=1527&g=&act=&y=&ql=&a=&d=&o=&size_min=0&size_max=0'
|
||||
headers = {('Origin', 'http://tfile.me'),
|
||||
('User-Agent',
|
||||
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 YaBrowser/14.10.2062.12061 Safari/537.36'),
|
||||
@@ -75,15 +73,15 @@ class TFileME(SearcherABC.SearcherABC):
|
||||
if None != response and 0 < len(response):
|
||||
response = response.decode('cp1251').encode('utf-8')
|
||||
self.cookieJar.save(ignore_discard=True)
|
||||
#self.check_login(response)
|
||||
#print response
|
||||
#bad_forums = [2,1,23,32,40,41]
|
||||
# self.check_login(response)
|
||||
# print response
|
||||
# bad_forums = [2,1,23,32,40,41]
|
||||
regex = '''<a href="/forum/viewforum\.php\?f=(\d+)">.+?<a href="/forum/viewtopic\.php\?t=.+?">(.+?)</a>.+?<a href="/forum/download\.php\?id=(\d+)">(.+?)</a>.+?class="sd">(\d+)</b>.+?class="lc">(\d+)'''
|
||||
for (forum, title, link, size, seeds, leechers) in re.compile(regex, re.DOTALL).findall(response):
|
||||
#if int(forum) not in bad_forums:
|
||||
title=self.clear_title(title)
|
||||
# if int(forum) not in bad_forums:
|
||||
title = self.clear_title(title)
|
||||
image = sys.modules["__main__"].__root__ + self.searchIcon
|
||||
link = 'http://tfile.me/forum/download.php?id='+link
|
||||
link = 'http://tfile.me/forum/download.php?id=' + link
|
||||
filesList.append((
|
||||
int(int(self.sourceWeight) * int(seeds)),
|
||||
int(seeds), int(leechers), size,
|
||||
@@ -94,11 +92,11 @@ class TFileME(SearcherABC.SearcherABC):
|
||||
return filesList
|
||||
|
||||
def clear_title(self, s):
|
||||
return self.stripHtml(self.unescape(s)).replace(' ',' ').replace(' ',' ').strip()
|
||||
return self.stripHtml(self.unescape(s)).replace(' ', ' ').replace(' ', ' ').strip()
|
||||
|
||||
def check_login(self, response=None):
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
# print response
|
||||
if re.compile('<input class="text" type="text" name="username"').search(response):
|
||||
print 'TFileME Not logged!'
|
||||
self.login()
|
||||
@@ -109,21 +107,21 @@ class TFileME(SearcherABC.SearcherABC):
|
||||
self.timeout(5)
|
||||
self.check_login(self.makeRequest('http://tfile.me/'))
|
||||
content = self.makeRequest(url)
|
||||
#return url
|
||||
# return url
|
||||
return self.saveTorrentFile(url, content)
|
||||
|
||||
def login(self):
|
||||
data = {
|
||||
'password': 'torrenter',
|
||||
'username': 'torrenterpl',
|
||||
'login':'Вход'
|
||||
'login': 'Вход'
|
||||
}
|
||||
x=self.makeRequest(
|
||||
x = self.makeRequest(
|
||||
'http://tfile.me/login/',
|
||||
data
|
||||
)
|
||||
self.cookieJar.save(ignore_discard=True)
|
||||
for cookie in self.cookieJar:
|
||||
if cookie.name == 'phpbb2mysql_data' and cookie.domain=='.tfile.me':
|
||||
if cookie.name == 'phpbb2mysql_data' and cookie.domain == '.tfile.me':
|
||||
return 'phpbb2mysql_data=' + cookie.value
|
||||
return False
|
||||
return False
|
||||
@@ -21,7 +21,6 @@
|
||||
import urllib
|
||||
import re
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
import SearcherABC
|
||||
|
||||
@@ -69,12 +68,12 @@ class ThePirateBaySe(SearcherABC.SearcherABC):
|
||||
response = self.makeRequest(url)
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
# print response
|
||||
dat = re.compile(
|
||||
r'<div class="detName">.+?">(.+?)</a>.+?<a href="(.+?)".+?<font class="detDesc">Uploaded .+?, Size (.+?), .+?</font>.+?<td align="right">(\d+?)</td>.+?<td align="right">(\d+?)</td>',
|
||||
re.DOTALL).findall(response)
|
||||
for (title, link, size, seeds, leechers) in dat:
|
||||
torrentTitle = title #"%s [S\L: %s\%s]" % (title, seeds, leechers)
|
||||
torrentTitle = title # "%s [S\L: %s\%s]" % (title, seeds, leechers)
|
||||
size = size.replace(' ', ' ')
|
||||
image = sys.modules["__main__"].__root__ + self.searchIcon
|
||||
if not re.match('^https?\://.+', link) and not re.match('^magnet\:.+', link):
|
||||
@@ -86,4 +85,4 @@ class ThePirateBaySe(SearcherABC.SearcherABC):
|
||||
self.__class__.__name__ + '::' + link,
|
||||
image,
|
||||
))
|
||||
return filesList
|
||||
return filesList
|
||||
@@ -19,9 +19,7 @@
|
||||
'''
|
||||
|
||||
import re
|
||||
import os
|
||||
import urllib
|
||||
import tempfile
|
||||
import sys
|
||||
|
||||
import SearcherABC
|
||||
@@ -64,7 +62,8 @@ class KinoZalTV(SearcherABC.SearcherABC):
|
||||
|
||||
def search(self, keyword):
|
||||
filesList = []
|
||||
url='http://kinozal.tv/browse.php?s=%s&g=0&c=0&v=0&d=0&w=0&t=1&f=0' % urllib.quote_plus(keyword.decode('utf-8').encode('cp1251'))
|
||||
url = 'http://kinozal.tv/browse.php?s=%s&g=0&c=0&v=0&d=0&w=0&t=1&f=0' % urllib.quote_plus(
|
||||
keyword.decode('utf-8').encode('cp1251'))
|
||||
|
||||
headers = {('Origin', 'http://kinozal.tv'),
|
||||
('User-Agent',
|
||||
@@ -74,8 +73,8 @@ class KinoZalTV(SearcherABC.SearcherABC):
|
||||
response = self.makeRequest(url, headers=headers)
|
||||
if None != response and 0 < len(response):
|
||||
response = response.decode('cp1251').encode('utf-8')
|
||||
#print response
|
||||
bad_forums = [2,1,23,32,40,41]
|
||||
# print response
|
||||
bad_forums = [2, 1, 23, 32, 40, 41]
|
||||
regex = '''onclick="cat\((\d+)\);".+?<a href="/details\.php\?id=(\d+)".+?>(.+?)</a>.+?<td class='s'>(.+?)</td>.+?class='sl_s'>(\d+)</td>.+?class='sl_p'>(\d+)</td>'''
|
||||
for (forum, topic, title, size, seeds, leechers) in re.compile(regex, re.DOTALL).findall(response):
|
||||
if int(forum) not in bad_forums:
|
||||
@@ -102,10 +101,10 @@ class KinoZalTV(SearcherABC.SearcherABC):
|
||||
self.timeout(5)
|
||||
|
||||
content = self.makeRequest(url)
|
||||
#print content
|
||||
# print content
|
||||
if not self.check_login(content):
|
||||
content = self.makeRequest(url)
|
||||
#print content
|
||||
# print content
|
||||
|
||||
return self.saveTorrentFile(url, content)
|
||||
|
||||
@@ -113,7 +112,7 @@ class KinoZalTV(SearcherABC.SearcherABC):
|
||||
data = {
|
||||
'password': 'torrenter',
|
||||
'username': 'torrenterpl',
|
||||
'returnto:':''
|
||||
'returnto:': ''
|
||||
}
|
||||
self.makeRequest(
|
||||
'http://kinozal.tv/takelogin.php',
|
||||
@@ -121,11 +120,11 @@ class KinoZalTV(SearcherABC.SearcherABC):
|
||||
)
|
||||
self.cookieJar.save(ignore_discard=True)
|
||||
for cookie in self.cookieJar:
|
||||
uid,passed=None,None
|
||||
uid, passed = None, None
|
||||
if cookie.name == 'uid':
|
||||
uid=cookie.value
|
||||
uid = cookie.value
|
||||
if cookie.name == 'pass':
|
||||
passed=cookie.value
|
||||
passed = cookie.value
|
||||
if uid and passed:
|
||||
return 'uid=' + uid+'; pass='+ passed
|
||||
return False
|
||||
return 'uid=' + uid + '; pass=' + passed
|
||||
return False
|
||||
@@ -1,28 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import xbmcgui, Localization, sys, xbmc
|
||||
import sys
|
||||
|
||||
import xbmcgui
|
||||
import Localization
|
||||
import xbmc
|
||||
|
||||
KEY_BUTTON_BACK = 275
|
||||
KEY_KEYBOARD_ESC = 61467
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_NAV_BACK = 92
|
||||
|
||||
|
||||
class DialogXml(xbmcgui.WindowXMLDialog):
|
||||
def onInit(self):
|
||||
print "onInit(): Window Initialized"
|
||||
localize=Localization.localize
|
||||
color='[COLOR %s]%s[/COLOR]'
|
||||
localize = Localization.localize
|
||||
color = '[COLOR %s]%s[/COLOR]'
|
||||
self.movie_label = self.getControl(32)
|
||||
self.movie_label.setText(self.movieInfo['desc'])
|
||||
|
||||
if self.movieInfo.get('views'):
|
||||
self.view_label = self.getControl(34)
|
||||
self.view_label.setLabel(color % ('blue', localize('Views:'))+self.movieInfo['views'])
|
||||
self.view_label.setLabel(color % ('blue', localize('Views:')) + self.movieInfo['views'])
|
||||
|
||||
self.view_label = self.getControl(35)
|
||||
self.ratingcolor = 'green'
|
||||
self.ratingint = int(self.movieInfo['rating'])
|
||||
if(self.ratingint < 70):
|
||||
if (self.ratingint < 70):
|
||||
self.ratingcolor = 'red'
|
||||
self.view_label.setLabel(color % ('blue', localize('Rating:'))+color % (self.ratingcolor, self.movieInfo['rating']))
|
||||
self.view_label.setLabel(
|
||||
color % ('blue', localize('Rating:')) + color % (self.ratingcolor, self.movieInfo['rating']))
|
||||
|
||||
self.movie_label = self.getControl(1)
|
||||
self.movie_label.setLabel(self.movieInfo['title'])
|
||||
@@ -43,7 +50,7 @@ class DialogXml(xbmcgui.WindowXMLDialog):
|
||||
self.setFocus(self.getControl(22))
|
||||
|
||||
def onAction(self, action):
|
||||
buttonCode = action.getButtonCode()
|
||||
buttonCode = action.getButtonCode()
|
||||
if (action == ACTION_NAV_BACK or action == ACTION_PREVIOUS_MENU):
|
||||
self.close()
|
||||
if (buttonCode == KEY_BUTTON_BACK or buttonCode == KEY_KEYBOARD_ESC):
|
||||
@@ -61,18 +68,16 @@ class DialogXml(xbmcgui.WindowXMLDialog):
|
||||
|
||||
def RunPlugin(self, action):
|
||||
if self.link:
|
||||
exec_str='XBMC.RunPlugin(%s)' % \
|
||||
('%s?action=%s&url=%s') % \
|
||||
(sys.argv[0], action, self.link)
|
||||
exec_str = 'XBMC.RunPlugin(%s)' % \
|
||||
('%s?action=%s&url=%s') % \
|
||||
(sys.argv[0], action, self.link)
|
||||
xbmc.executebuiltin(exec_str)
|
||||
|
||||
|
||||
def onFocus(self, controlID):
|
||||
#print "onFocus(): control %i" % controlID
|
||||
# print "onFocus(): control %i" % controlID
|
||||
pass
|
||||
|
||||
|
||||
def doModal(self, movieInfo, url):
|
||||
self.movieInfo = movieInfo
|
||||
self.link=url
|
||||
xbmcgui.WindowXMLDialog.doModal(self)
|
||||
self.link = url
|
||||
xbmcgui.WindowXMLDialog.doModal(self)
|
||||
@@ -842,7 +842,7 @@ class AzureusConnection(AzureusLink):
|
||||
raise NoEstablishedConnectionError
|
||||
|
||||
from xml.dom.minidom import parseString
|
||||
from dopal.xmlutils import normalise_xml_structure, get_text_content
|
||||
from dopal.xmlutils import normalise_xml_structure
|
||||
|
||||
# First step, convert the method data to XML.
|
||||
xml_data = remote_method_call_as_xml(method_name, method_args,
|
||||
@@ -1018,7 +1018,6 @@ class ExtendedAzureusConnection(AzureusConnection):
|
||||
|
||||
return dopal.utils.parse_azureus_version_string(az_version)
|
||||
|
||||
|
||||
# Use of this name is deprecated, and this alias will be removed in later
|
||||
# versions of DOPAL.
|
||||
ReusableAzureusConnection = ExtendedAzureusConnection
|
||||
@@ -22,7 +22,7 @@ from dopal.core import ExtendedAzureusConnection
|
||||
from dopal.errors import AzMethodError, InvalidObjectIDError, \
|
||||
RemoteMethodError, StaleObjectReferenceError, ConnectionlessObjectError, \
|
||||
NonRefreshableConnectionlessObjectError, MissingRemoteAttributeError, \
|
||||
NonRefreshableIncompleteObjectError, NonRefreshableObjectError
|
||||
NonRefreshableObjectError
|
||||
import dopal.utils
|
||||
|
||||
|
||||
@@ -487,7 +487,6 @@ class RemoteAttributesMixin(object):
|
||||
text = "'%s' object has no attribute '%s'"
|
||||
raise AttributeError, text % (type(self).__name__, name)
|
||||
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if self.__protect_remote_attributes__ and not name.startswith('__'):
|
||||
if name in self.__remote_attribute_names__:
|
||||
|
||||
+82
-87
@@ -18,7 +18,6 @@ import xbmc
|
||||
import xbmcgui
|
||||
import xbmcvfs
|
||||
|
||||
|
||||
os.sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
import dopal.main
|
||||
@@ -51,7 +50,6 @@ class HTTP:
|
||||
if not xbmcvfs.exists(self._dirname):
|
||||
xbmcvfs.mkdir(self._dirname)
|
||||
|
||||
|
||||
def fetch(self, request, **kwargs):
|
||||
self.con, self.fd, self.progress, self.cookies, self.request = None, None, None, None, request
|
||||
|
||||
@@ -91,7 +89,6 @@ class HTTP:
|
||||
|
||||
return self.response
|
||||
|
||||
|
||||
def _opener(self):
|
||||
|
||||
build = [urllib2.HTTPHandler()]
|
||||
@@ -118,7 +115,6 @@ class HTTP:
|
||||
|
||||
urllib2.install_opener(urllib2.build_opener(*build))
|
||||
|
||||
|
||||
def _fetch(self):
|
||||
params = {} if self.request.params is None else self.request.params
|
||||
|
||||
@@ -153,7 +149,7 @@ class HTTP:
|
||||
if self.request.download:
|
||||
self._download()
|
||||
else:
|
||||
if not self.response.headers.get('content-encoding')=='gzip':
|
||||
if not self.response.headers.get('content-encoding') == 'gzip':
|
||||
self.response.body = self.con.read()
|
||||
else:
|
||||
buf = StringIO(self.con.read())
|
||||
@@ -163,7 +159,6 @@ class HTTP:
|
||||
if self.request.cookies:
|
||||
self.cookies.save(self.request.cookies)
|
||||
|
||||
|
||||
def _download(self):
|
||||
fd = open(self.request.download, 'wb')
|
||||
if self.request.progress:
|
||||
@@ -195,7 +190,6 @@ class HTTP:
|
||||
|
||||
self.response.filename = self.request.download
|
||||
|
||||
|
||||
def _upload(self, upload, params):
|
||||
res = []
|
||||
boundary = mimetools.choose_boundary()
|
||||
@@ -231,7 +225,6 @@ class HTTP:
|
||||
result.append('')
|
||||
return boundary, '\r\n'.join(result)
|
||||
|
||||
|
||||
def _headers(self, raw):
|
||||
headers = {}
|
||||
for line in raw.headers:
|
||||
@@ -243,7 +236,6 @@ class HTTP:
|
||||
headers[tag] = value
|
||||
return headers
|
||||
|
||||
|
||||
def _progress(self, read, size, name):
|
||||
res = []
|
||||
if size < 0:
|
||||
@@ -756,11 +748,11 @@ class Transmission:
|
||||
return True if res else None
|
||||
|
||||
def setprio_simple_multi(self, menu):
|
||||
id=menu[0][0]
|
||||
prio=menu[0][1]
|
||||
res=None
|
||||
id = menu[0][0]
|
||||
prio = menu[0][1]
|
||||
res = None
|
||||
|
||||
inds=[]
|
||||
inds = []
|
||||
for hash, action, ind in menu:
|
||||
inds.append(int(ind))
|
||||
|
||||
@@ -857,72 +849,72 @@ class Deluge:
|
||||
self.login = login
|
||||
self.password = password
|
||||
|
||||
self.url = ['http://','https://'][int(url)] + host
|
||||
self.url = ['http://', 'https://'][int(url)] + host
|
||||
if port:
|
||||
self.url += ':' + str(port)
|
||||
|
||||
self.http = HTTP()
|
||||
|
||||
def get_info(self):
|
||||
obj = self.action({"method":"web.update_ui",
|
||||
"params":[[],{}],"id":1})
|
||||
obj = self.action({"method": "web.update_ui",
|
||||
"params": [[], {}], "id": 1})
|
||||
return obj
|
||||
|
||||
def list(self):
|
||||
obj=self.get_info()
|
||||
obj = self.get_info()
|
||||
if obj is None:
|
||||
return False
|
||||
|
||||
res = []
|
||||
if len(obj['result'].get('torrents'))>0:
|
||||
if len(obj['result'].get('torrents')) > 0:
|
||||
for k in obj['result'].get('torrents').keys():
|
||||
r=obj['result']['torrents'][k]
|
||||
add={
|
||||
'id': str(k),
|
||||
'status': self.get_status(r['state']),
|
||||
'name': r['name'],
|
||||
'size': r['total_wanted'],
|
||||
'progress': round(r['progress'], 2),
|
||||
'download': r['total_done'],
|
||||
'upload': r['total_uploaded'],
|
||||
'upspeed': r['upload_payload_rate'],
|
||||
'downspeed': r['download_payload_rate'],
|
||||
'ratio': round(r['ratio'], 2),
|
||||
'eta': r['eta'],
|
||||
'peer': r['total_peers'],
|
||||
'seed': r['num_seeds'],
|
||||
'leech': r['num_peers'],
|
||||
'add': r['time_added'],
|
||||
'dir': r['save_path']
|
||||
r = obj['result']['torrents'][k]
|
||||
add = {
|
||||
'id': str(k),
|
||||
'status': self.get_status(r['state']),
|
||||
'name': r['name'],
|
||||
'size': r['total_wanted'],
|
||||
'progress': round(r['progress'], 2),
|
||||
'download': r['total_done'],
|
||||
'upload': r['total_uploaded'],
|
||||
'upspeed': r['upload_payload_rate'],
|
||||
'downspeed': r['download_payload_rate'],
|
||||
'ratio': round(r['ratio'], 2),
|
||||
'eta': r['eta'],
|
||||
'peer': r['total_peers'],
|
||||
'seed': r['num_seeds'],
|
||||
'leech': r['num_peers'],
|
||||
'add': r['time_added'],
|
||||
'dir': r['save_path']
|
||||
}
|
||||
if len(r['files'])>1: add['dir']=os.path.join(r['save_path'],r['name'])
|
||||
if len(r['files']) > 1: add['dir'] = os.path.join(r['save_path'], r['name'])
|
||||
res.append(add)
|
||||
return res
|
||||
|
||||
def listdirs(self):
|
||||
obj = self.action({"method":"core.get_config","params":[],"id":5})
|
||||
obj = self.action({"method": "core.get_config", "params": [], "id": 5})
|
||||
if obj is None:
|
||||
return False
|
||||
|
||||
try:
|
||||
res = [obj['result'].get('download_location')]
|
||||
except:
|
||||
res=[None]
|
||||
res = [None]
|
||||
return res, res
|
||||
|
||||
def listfiles(self, id):
|
||||
obj = self.get_info()
|
||||
i=0
|
||||
i = 0
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
res = []
|
||||
obj=obj['result']['torrents'][id]
|
||||
#print str(obj)
|
||||
if len(obj['files'])==1:
|
||||
strip_path=None
|
||||
obj = obj['result']['torrents'][id]
|
||||
# print str(obj)
|
||||
if len(obj['files']) == 1:
|
||||
strip_path = None
|
||||
else:
|
||||
strip_path=obj['name']
|
||||
strip_path = obj['name']
|
||||
|
||||
for x in obj['files']:
|
||||
if x['size'] >= 1024 * 1024 * 1024:
|
||||
@@ -934,17 +926,18 @@ class Deluge:
|
||||
else:
|
||||
size = str(x['size']) + 'B'
|
||||
if strip_path:
|
||||
path=x['path'].lstrip(strip_path).lstrip('/')
|
||||
path = x['path'].lstrip(strip_path).lstrip('/')
|
||||
else:
|
||||
path=x['path']
|
||||
path = x['path']
|
||||
|
||||
if x.get('progress'):
|
||||
percent=int(x['progress']*100)
|
||||
elif obj.get('file_progress') and len(obj['file_progress'])>=i:
|
||||
percent=int(obj['file_progress'][i]*100)
|
||||
else:percent=0
|
||||
percent = int(x['progress'] * 100)
|
||||
elif obj.get('file_progress') and len(obj['file_progress']) >= i:
|
||||
percent = int(obj['file_progress'][i] * 100)
|
||||
else:
|
||||
percent = 0
|
||||
|
||||
i+=1
|
||||
i += 1
|
||||
res.append([path, percent, x['index'], size])
|
||||
|
||||
return res
|
||||
@@ -953,24 +946,26 @@ class Deluge:
|
||||
obj = self.get_info()
|
||||
if obj is None:
|
||||
return None
|
||||
res=obj['result']['torrents'][id]['file_priorities']
|
||||
res = obj['result']['torrents'][id]['file_priorities']
|
||||
return res
|
||||
|
||||
def add(self, torrent, dirname):
|
||||
torrentFile=os.path.join(self.http._dirname,'deluge.torrent')
|
||||
torrentFile = os.path.join(self.http._dirname, 'deluge.torrent')
|
||||
if self.action({'method': 'core.add_torrent_file',
|
||||
'params': [torrentFile,
|
||||
base64.b64encode(torrent), {"download_path": dirname}],"id":3}) is None:
|
||||
base64.b64encode(torrent), {"download_path": dirname}], "id": 3}) is None:
|
||||
return None
|
||||
return True
|
||||
|
||||
def add_url(self, torrent, dirname):
|
||||
if re.match("^magnet\:.+$", torrent):
|
||||
if self.action({'method': 'core.add_torrent_magnet', 'params':[torrent,
|
||||
{'download_path': dirname}],"id":3}) is None:
|
||||
if self.action({'method': 'core.add_torrent_magnet', 'params': [torrent,
|
||||
{'download_path': dirname}],
|
||||
"id": 3}) is None:
|
||||
return None
|
||||
else:
|
||||
if self.action({"method": "core.add_torrent_url", "params":[torrent, {'download_path': dirname}],"id":3}) is None:
|
||||
if self.action({"method": "core.add_torrent_url", "params": [torrent, {'download_path': dirname}],
|
||||
"id": 3}) is None:
|
||||
return None
|
||||
return True
|
||||
|
||||
@@ -979,48 +974,48 @@ class Deluge:
|
||||
|
||||
def setprio(self, id, ind):
|
||||
i = -1
|
||||
prios=self.get_prio(id)
|
||||
prios = self.get_prio(id)
|
||||
|
||||
for p in prios:
|
||||
i=i+1
|
||||
if p==1:
|
||||
i = i + 1
|
||||
if p == 1:
|
||||
prios.pop(i)
|
||||
prios.insert(i,0)
|
||||
prios.insert(i, 0)
|
||||
|
||||
prios.pop(int(ind))
|
||||
prios.insert(int(ind),7)
|
||||
prios.insert(int(ind), 7)
|
||||
|
||||
if self.action({"method": "core.set_torrent_file_priorities", "params":[id, prios],"id":6}) is None:
|
||||
return None
|
||||
if self.action({"method": "core.set_torrent_file_priorities", "params": [id, prios], "id": 6}) is None:
|
||||
return None
|
||||
|
||||
return True
|
||||
|
||||
def setprio_simple(self, id, prio, ind):
|
||||
prios=self.get_prio(id)
|
||||
prios = self.get_prio(id)
|
||||
|
||||
if ind!=None:
|
||||
if ind != None:
|
||||
prios.pop(int(ind))
|
||||
if prio == '3':
|
||||
prios.insert(int(ind),7)
|
||||
prios.insert(int(ind), 7)
|
||||
elif prio == '0':
|
||||
prios.insert(int(ind),0)
|
||||
prios.insert(int(ind), 0)
|
||||
|
||||
if self.action({"method": "core.set_torrent_file_priorities", "params":[id, prios],"id":6}) is None:
|
||||
if self.action({"method": "core.set_torrent_file_priorities", "params": [id, prios], "id": 6}) is None:
|
||||
return None
|
||||
return True
|
||||
|
||||
def setprio_simple_multi(self, menu):
|
||||
id=menu[0][0]
|
||||
prios=self.get_prio(id)
|
||||
id = menu[0][0]
|
||||
prios = self.get_prio(id)
|
||||
|
||||
for hash, action, ind in menu:
|
||||
prios.pop(int(ind))
|
||||
if action == '3':
|
||||
prios.insert(int(ind),7)
|
||||
prios.insert(int(ind), 7)
|
||||
elif action == '0':
|
||||
prios.insert(int(ind),0)
|
||||
prios.insert(int(ind), 0)
|
||||
|
||||
if self.action({"method": "core.set_torrent_file_priorities", "params":[id, prios],"id":6}) is None:
|
||||
if self.action({"method": "core.set_torrent_file_priorities", "params": [id, prios], "id": 6}) is None:
|
||||
return None
|
||||
|
||||
def action(self, request):
|
||||
@@ -1034,8 +1029,8 @@ class Deluge:
|
||||
return None
|
||||
else:
|
||||
response = self.http.fetch(self.url + '/json', method='POST', params=jsobj,
|
||||
headers={'X-Requested-With': 'XMLHttpRequest', 'Cookie': cookie,
|
||||
'Content-Type': 'application/json; charset=UTF-8'})
|
||||
headers={'X-Requested-With': 'XMLHttpRequest', 'Cookie': cookie,
|
||||
'Content-Type': 'application/json; charset=UTF-8'})
|
||||
|
||||
if response.error:
|
||||
return None
|
||||
@@ -1049,23 +1044,23 @@ class Deluge:
|
||||
return obj
|
||||
|
||||
def action_simple(self, action, id):
|
||||
actions = {'start': {"method":"core.resume_torrent","params":[[id]],"id":4},
|
||||
'stop': {"method":"core.pause_torrent","params":[[id]],"id":4},
|
||||
'remove': {"method":"core.remove_torrent","params":[id, False],"id":4},
|
||||
'removedata': {"method":"core.remove_torrent", "params":[id, True],"id":4}}
|
||||
actions = {'start': {"method": "core.resume_torrent", "params": [[id]], "id": 4},
|
||||
'stop': {"method": "core.pause_torrent", "params": [[id]], "id": 4},
|
||||
'remove': {"method": "core.remove_torrent", "params": [id, False], "id": 4},
|
||||
'removedata': {"method": "core.remove_torrent", "params": [id, True], "id": 4}}
|
||||
obj = self.action(actions[action])
|
||||
return True if obj else None
|
||||
|
||||
def get_auth(self):
|
||||
params=json.dumps({"method":"auth.login","params":[self.password],"id":0})
|
||||
params = json.dumps({"method": "auth.login", "params": [self.password], "id": 0})
|
||||
response = self.http.fetch(self.url + '/json', method='POST', params=params, gzip=True,
|
||||
headers={'X-Requested-With': 'XMLHttpRequest',
|
||||
'Content-Type': 'application/json; charset=UTF-8'})
|
||||
headers={'X-Requested-With': 'XMLHttpRequest',
|
||||
'Content-Type': 'application/json; charset=UTF-8'})
|
||||
if response.error:
|
||||
return None
|
||||
|
||||
auth=json.loads(response.body)
|
||||
if auth["result"]==False:
|
||||
auth = json.loads(response.body)
|
||||
if auth["result"] == False:
|
||||
return False
|
||||
else:
|
||||
r = re.compile('_session_id=([^;]+);').search(response.headers.get('set-cookie', ''))
|
||||
@@ -1118,7 +1113,7 @@ class Vuze:
|
||||
'download': float(getattr(getattr(r, 'stats'), 'downloaded')),
|
||||
'upload': getattr(getattr(r, 'stats'), 'uploaded'),
|
||||
# 'upspeed': r['rateUpload'],
|
||||
#'downspeed': r['rateDownload'],
|
||||
# 'downspeed': r['rateDownload'],
|
||||
'ratio': float(r.stats.share_ratio) / 1000,
|
||||
'eta': getattr(getattr(r, 'stats'), 'eta'),
|
||||
'peer': getattr(getattr(r, 'scrape_result'), 'non_seed_count') + getattr(getattr(r, 'scrape_result'),
|
||||
|
||||
Reference in new issue
Block a user