media list, cc, deluge fixes

pull/1/head
DiMartinoXBMC 2015-07-15 19:14:22 +03:00
parent 0d5263aaff
commit e480cb4919
20 changed files with 146 additions and 74 deletions

View File

@ -38,8 +38,11 @@ class Content:
cookieJar = None
baseurl = ''
def isLabel(self):
return 'Should search on ruhunt?'
def isTracker(self):
return 'Never seen'
def isSearcher(self):
return False
def isPages(self):
return False

19
Core.py
View File

@ -89,7 +89,7 @@ class Core:
def sectionMenu(self):
if self.__settings__.getSetting('plugin_name')!=self.__plugin__:
if self.__plugin__ == 'Torrenter v.2.3.1':
if self.__plugin__ == 'Torrenter v.2.3.2':
#first_run_230(self.__settings__.getSetting('delete_russian')=='true')
first_run_231()
if self.__settings__.getSetting('delete_russian')!='false':
@ -630,7 +630,7 @@ class Core:
else:
if provider:
self.Content = self.contenterObject[provider]
if not self.Content.isLabel():
if not self.Content.isTracker():
self.draw(apps, mode='content')
else:
self.draw(apps, mode='tracker')
@ -878,6 +878,8 @@ class Core:
def drawtrackerList(self, provider, contentList):
contentList = sorted(contentList, key=lambda x: x[0], reverse=True)
if self.contenterObject[provider].isSearcher():
Searchers().checkExist(provider)
for num, originaltitle, title, year, img, info in contentList:
if not info.get('label'):
continue
@ -888,17 +890,16 @@ class Core:
continue
label = info.get('label').encode('utf-8', 'ignore')
if self.contenterObject[provider].isInfoLink() and info.get('link'):
if info.get('link'):
if isinstance(info.get('link'), tuple):
url=info.get('link')[0]
else:
url=info.get('link')
if not '::' in url:
if self.contenterObject[provider].isSearcher():
link = {'url': '%s::%s' % (provider, url), 'thumbnail': img}
else:
link = {'url': url, 'thumbnail': img}
elif self.contenterObject[provider].isLabel():
link = {'url': '%s::%s' % (provider, urllib.quote_plus(label)), 'thumbnail': img}
contextMenu = [
(self.localize('Download via T-client'),
@ -1640,10 +1641,8 @@ class Core:
searcher = classMatch.group(1)
url = Searchers().downloadWithSearcher(classMatch.group(2), searcher)
torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory)
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory)
torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory)
if re.match("^magnet\:.+$", url):
if not dirname:

View File

@ -316,15 +316,26 @@ class Libtorrent:
self.session.start_natpmp()
self.session.listen_on(6881, 6891)
#self.session.set_severity_level(self.lt.alert.severity_levels.info)
#self.session.add_extension(self.lt.create_ut_pex_plugin)
#self.session.add_extension(self.lt.create_ut_metadata_plugin)
#self.session.add_extension(self.lt.create_metadata_plugin)
# Session settings
session_settings = self.session.settings()
session_settings.announce_to_all_tiers = True
session_settings.announce_to_all_trackers = True
session_settings.connection_speed = 100
session_settings.peer_connect_timeout = 2
session_settings.rate_limit_ip_overhead = True
session_settings.request_timeout = 5
session_settings.torrent_connect_boost = 100
session_settings = self.session.get_settings()
#session_settings['user_agent'] = 'python_client/' + self.lt.version
#session_settings['auto_manage_startup'] = 30
#session_settings['auto_manage_interval'] = 30
#session_settings['dht_announce_interval'] = 60
session_settings['announce_to_all_tiers'] = True
session_settings['announce_to_all_trackers'] = True
session_settings['connection_speed'] = 100
session_settings['peer_connect_timeout'] = 2
session_settings['rate_limit_ip_overhead'] = True
session_settings['request_timeout'] = 5
session_settings['torrent_connect_boost'] = 100
self.session.set_settings(session_settings)
@ -353,6 +364,8 @@ class Libtorrent:
else:
self.torrentFileInfo = self.getMagnetInfo()
self.torrentHandle.set_sequential_download(True)
#self.torrentHandle.set_max_connections(60)
#self.torrentHandle.set_max_uploads(-1)
self.stopSession()
def stopSession(self):

View File

@ -261,7 +261,9 @@ def localize(text):
'Please contact DiMartino on kodi.tv forum. We compiled python-libtorrent for Android,':'Свяжитесь с DiMartino на xbmc.ru. Мы собрали python-libtorrent на Android',
'but we need your help with some tests on different processors.':'но нам нужна помощь в тестировании на разные процессоры.',
'We added Android ARM full support to Torrenter v2!':'Мы добавили полную поддержку Android ARM в Torrenter v2!',
'I deleted pre-installed ones, install them in Search Control Window!':'Теперь серчеры нужно устанавливать отдельно в Окне Управления Поиском!'
'I deleted pre-installed ones, install them in Search Control Window!':'Теперь серчеры нужно устанавливать отдельно в Окне Управления Поиском!',
'Torrenter didn\'t find %s searcher':'Торрентер не нашел серчер трекера %s',
'Torrenter Tracker Install':'Установка трекеров в Torrenter',
},
'uk': {

View File

@ -1,5 +1,8 @@
[B]Version 2.3.2[/B]
[+] Control Center: Исправлена работа без серчеров
[+] Списки Медиа: Проверка отсутствия серчера
[+] Списки Медиа: Исправлен ThePirateBay
[+] Торрент-клиент: Добавлена возможность указать путь Deluge
[B]Version 2.3.1[/B]
[+] Загрузка: Исправлена ошибка удаления базы данных

View File

@ -32,7 +32,7 @@ __version__ = __settings__.getAddonInfo('version')
__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
__root__ = __settings__.getAddonInfo('path')
print 'SYS ARGV: ' + str(sys.argv)
#print 'SYS ARGV: ' + str(sys.argv)
if len(sys.argv) > 1:
params = getParameters(sys.argv[1])
@ -47,6 +47,8 @@ class ControlCenter(AddonDialogWindow):
self.db = None
self.addtime = None
self.has_searchers=len(self.dic)>0
self.more_one_searcher=len(self.dic)>1
self.more_two_searcher=len(self.dic)>2
if self.has_searchers:
if addtime:
self.addtime = addtime
@ -66,6 +68,7 @@ class ControlCenter(AddonDialogWindow):
self.keys = self.dic.keys()
self.placed, self.button_columns, self.last_column_row = self.place()
#print str((self.placed, self.button_columns, self.last_column_row))
else:
self.button_columns=0
@ -87,22 +90,10 @@ class ControlCenter(AddonDialogWindow):
else:
i += 1
placed[item] = (j, i)
# print item+str((j, i))
#print item+str((j, i))
return placed, j, i
def set_info_controls(self):
# Demo for PyXBMCt UI controls.
# no_int_label = Label(__language__(30146), alignment=ALIGN_CENTER)
# self.placeControl(no_int_label, 0, 0, 1, 3)
#
# label_timeout = Label(__language__(30410))
# self.placeControl(label_timeout, 1, 0)
# Label
# self.label = Label(__language__(30545) % TimeOut().timeout())
# self.placeControl(self.label, 1, 1)
#
# label_watched = Label(__language__(30414) % (WatchedDB().count()))
# self.placeControl(label_watched, 2, 0)
pass
def set_active_controls(self):
@ -167,27 +158,28 @@ class ControlCenter(AddonDialogWindow):
self.radiobutton[searcher].controlUp(self.radiobutton[ser])
# self.button_columns, self.last_column_row
if place[1] == 0 and place[0] == self.button_columns:
if self.last_column_row > 0:
ser = placed_keys[placed_values.index((place[0], self.last_column_row))]
if self.more_one_searcher:
if place[1] == 0 and place[0] == self.button_columns:
if self.last_column_row > 0:
ser = placed_keys[placed_values.index((place[0], self.last_column_row))]
else:
ser = placed_keys[placed_values.index((place[0] - 1, 2))]
elif place[1] == 0:
ser = placed_keys[placed_values.index((place[0], 2))]
else:
ser = placed_keys[placed_values.index((place[0] - 1, 2))]
elif place[1] == 0:
ser = placed_keys[placed_values.index((place[0], 2))]
else:
ser = placed_keys[placed_values.index((place[0], place[1] - 1))]
self.radiobutton[searcher].controlLeft(self.radiobutton[ser])
ser = placed_keys[placed_values.index((place[0], place[1] - 1))]
self.radiobutton[searcher].controlLeft(self.radiobutton[ser])
# print str((self.button_columns, self.last_column_row))
# print searcher
if place == (self.button_columns, self.last_column_row) and self.last_column_row < 2:
ser = placed_keys[placed_values.index((place[0] - 1, place[1] + 1))]
elif place[1] == 2:
ser = placed_keys[placed_values.index((place[0], 0))]
else:
ser = placed_keys[placed_values.index((place[0], place[1] + 1))]
self.radiobutton[searcher].controlRight(self.radiobutton[ser])
#print str((self.button_columns, self.last_column_row))
#print searcher
if self.more_two_searcher:
if place == (self.button_columns, self.last_column_row) and self.last_column_row < 2:
ser = placed_keys[placed_values.index((place[0] - 1, place[1] + 1))]
elif place[1] == 2:
ser = placed_keys[placed_values.index((place[0], 0))]
else:
ser = placed_keys[placed_values.index((place[0], place[1] + 1))]
self.radiobutton[searcher].controlRight(self.radiobutton[ser])
if place[0] == self.button_columns - 1 and place[1] > self.last_column_row or \
place[0] == self.button_columns:
@ -197,11 +189,22 @@ class ControlCenter(AddonDialogWindow):
self.radiobutton[searcher].controlDown(self.radiobutton[ser])
self.button_install.controlUp(self.radiobutton_bottom[0])
self.button_openserchset.controlUp(self.radiobutton_bottom[1])
self.button_clearstor.controlUp(self.radiobutton_bottom[2])
self.button_openset.controlDown(self.radiobutton_top[0])
self.button_utorrent.controlDown(self.radiobutton_top[1])
self.button_close.controlDown(self.radiobutton_top[2])
if self.more_one_searcher:
self.button_openserchset.controlUp(self.radiobutton_bottom[1])
self.button_utorrent.controlDown(self.radiobutton_top[1])
else:
self.button_openserchset.controlUp(self.radiobutton_bottom[0])
self.button_utorrent.controlDown(self.radiobutton_top[0])
if self.more_two_searcher:
self.button_clearstor.controlUp(self.radiobutton_bottom[2])
self.button_close.controlDown(self.radiobutton_top[2])
elif self.more_one_searcher:
self.button_clearstor.controlUp(self.radiobutton_bottom[1])
self.button_close.controlDown(self.radiobutton_top[1])
else:
self.button_clearstor.controlUp(self.radiobutton_bottom[0])
self.button_close.controlDown(self.radiobutton_top[0])
else:
self.button_install.controlUp(self.button_openset)
self.button_openserchset.controlUp(self.button_utorrent)

View File

@ -1091,6 +1091,7 @@ class Searchers():
'path':path,
'searcher':os.path.join(path,name+'.py'),
'type':'external'}
#if len(searchersDict)>1: break
return searchersDict
def dic(self, providers=[]):
@ -1143,6 +1144,16 @@ class Searchers():
e)
return url
def checkExist(self, searcher):
if searcher not in self.list():
yes=xbmcgui.Dialog().yesno('< %s >' % Localization.localize('Torrenter Tracker Install'),
Localization.localize('Torrenter didn\'t find %s searcher' % searcher),
Localization.localize('Would you like to install %s from "MyShows.me Kodi Repo" in Programs section?') % searcher,)
if yes:
xbmc.executebuiltin('Dialog.Close(all,true)')
xbmc.executebuiltin('XBMC.ActivateWindow(Addonbrowser,addons://search/%s)' % ('Torrenter Searcher %s' % searcher))
def search(url, searchersList, isApi=None):
from threading import Thread
@ -1801,4 +1812,4 @@ def noActiveSerachers():
Localization.localize('Would you like to install %s from "MyShows.me Kodi Repo" in Programs section?') % '',)
if yes:
xbmc.executebuiltin('Dialog.Close(all,true)')
xbmc.executebuiltin('XBMC.ActivateWindow(Addonbrowser,addons://search/%s)' % ('Torrenter Searcher'))
xbmc.executebuiltin('XBMC.ActivateWindow(Addonbrowser,addons://search/%s)' % ('Torrenter Searcher'))

View File

@ -98,7 +98,10 @@ class CXZ(Content.Content):
sourceWeight = 2
def isLabel(self):
def isTracker(self):
return False
def isSearcher(self):
return False
def isInfoLink(self):

View File

@ -40,9 +40,12 @@ class EZTV(Content.Content):
'''
sourceWeight = 1
def isLabel(self):
def isTracker(self):
return True
def isSearcher(self):
return False
def isScrappable(self):
return False

View File

@ -51,7 +51,10 @@ class FastTorrent(Content.Content):
'''
sourceWeight = 1
def isLabel(self):
def isTracker(self):
return False
def isSearcher(self):
return False
def isScrappable(self):

View File

@ -81,7 +81,10 @@ class IMDB(Content.Content):
'''
sourceWeight = 2
def isLabel(self):
def isTracker(self):
return False
def isSearcher(self):
return False
def isPages(self):

View File

@ -50,9 +50,12 @@ class KickAssSo(Content.Content):
'''
sourceWeight = 1
def isLabel(self):
def isTracker(self):
return True
def isSearcher(self):
return False
def isScrappable(self):
return False

View File

@ -87,7 +87,10 @@ class KinoPoisk(Content.Content):
'''
sourceWeight = 2
def isLabel(self):
def isTracker(self):
return False
def isSearcher(self):
return False
def isPages(self):

View File

@ -45,7 +45,10 @@ class RiperAM(Content.Content):
'''
sourceWeight = 1
def isLabel(self):
def isTracker(self):
return True
def isSearcher(self):
return True
def isScrappable(self):

View File

@ -118,7 +118,7 @@ class SWESUB(Content.Content):
# info
info['label'] = info['title'] = self.unescape(title)
info['link'] = '%s::%s' % ('Nyaa', self.baseurl + '/downloads' + link + '/')
info['link'] = self.baseurl + '/downloads' + link + '/'
info['infolink'] = self.baseurl + link + '.html'
info['plot'] = article.find('div', {'class': 'item-content'}).text

View File

@ -38,7 +38,7 @@ class ThePirateBaySe(Content.Content):
{'name': 'by Date', 'url_after': '/0/3/0'}]}),
}
baseurl = "https://thepiratebay.se"
baseurl = "thepiratebay.gd"
headers = [('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'),
@ -50,9 +50,12 @@ class ThePirateBaySe(Content.Content):
'''
sourceWeight = 1
def isLabel(self):
def isTracker(self):
return True
def isSearcher(self):
return False
def isScrappable(self):
return False
@ -72,7 +75,7 @@ class ThePirateBaySe(Content.Content):
contentList = []
url = self.get_url(category, subcategory, apps_property)
response = self.makeRequest(url, headers=self.headers)
response = self.open2(url)
if None != response and 0 < len(response):
# print response
@ -81,6 +84,17 @@ class ThePirateBaySe(Content.Content):
# print str(contentList)
return contentList
def open2(self, url=''):
import httplib
conn = httplib.HTTPConnection(self.baseurl)
conn.request("GET", url.replace(self.baseurl,''))
r1 = conn.getresponse()
status = str(r1.status) + " " + r1.reason
content = r1.read()
#print str(status)
#print str(content)
return content
def mode(self, response):
contentList = []
# print str(result)

View File

@ -53,6 +53,7 @@
<string id="50315">Login</string>
<string id="50316">Password</string>
<string id="50311">Torrent Client</string>
<string id="50317">URL (only No SSL)</string>
<string id="30426">Path replacement (remote only)</string>
<string id="30412">Close</string>
<string id="30413">Open Settings</string>

View File

@ -52,6 +52,7 @@
<string id="50314">URL</string>
<string id="50315">Логин</string>
<string id="50316">Пароль</string>
<string id="50317">URL (только без SSL)</string>
<string id="50311">Торрент-клиент</string>
<string id="30426">Замена пути (remote only)</string>
<string id="30412">Закрыть</string>

View File

@ -168,7 +168,7 @@
<setting id="torrent_vuze_login" type="text" label="50315" visible="eq(-12,2)" default=""/>
<setting id="torrent_vuze_password" type="text" label="50316" visible="eq(-13,2)" default="" option="hidden"/>
<setting id="torrent_deluge_host" type="ipaddress" label="50312" visible="eq(-14,3)" default="127.0.0.1"/>
<setting id="torrent_deluge_url" type="enum" label="50314" visible="eq(-15,3)" values="http:// (only No SSL)" default="0"/>
<setting id="torrent_deluge_path" type="text" label="50317" visible="eq(-15,3)" default="/"/>
<setting id="torrent_deluge_port" type="number" label="50313" visible="eq(-16,3)" default="8112"/>
<setting id="torrent_deluge_password" type="text" label="50316" visible="eq(-17,3)" default="deluge" option="hidden"/>
</category>

View File

@ -849,10 +849,11 @@ class Deluge:
self.login = login
self.password = password
self.url = ['http://', 'https://'][int(url)] + host
self.url = 'http://'+host
if port:
self.url += ':' + str(port)
self.url += url
print str(self.url)
self.http = HTTP()
def get_info(self):
@ -1299,7 +1300,7 @@ class Download():
config = {
'host': self.setting.getSetting("torrent_deluge_host"),
'port': self.setting.getSetting("torrent_deluge_port"),
'url': self.setting.getSetting("torrent_deluge_url"),
'url': self.setting.getSetting("torrent_deluge_path"),
'login': '',
'password': self.setting.getSetting("torrent_deluge_password")
}