pull/14/head
DiMartinoXBMC 2016-05-28 08:42:49 +03:00
parent 5e98bb1b89
commit 43fe7d5c6f
7 changed files with 45 additions and 10 deletions

View File

@ -370,6 +370,7 @@ class AnteoPlayer(xbmc.Player):
keep_files = True keep_files = True
resume_file=os.path.join(self.userStorageDirectory, 'torrents', os.path.basename(self.torrentUrl)+'.resume_data') resume_file=os.path.join(self.userStorageDirectory, 'torrents', os.path.basename(self.torrentUrl)+'.resume_data')
enable_dht = self.__settings__.getSetting("enable_dht") == 'true'
dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"] dht_routers = ["router.bittorrent.com:6881","router.utorrent.com:6881"]
user_agent = 'uTorrent/2200(24683)' user_agent = 'uTorrent/2200(24683)'
self.pre_buffer_bytes = int(self.__settings__.getSetting("pre_buffer_bytes"))*1024*1024 self.pre_buffer_bytes = int(self.__settings__.getSetting("pre_buffer_bytes"))*1024*1024
@ -378,7 +379,7 @@ class AnteoPlayer(xbmc.Player):
connections_limit=connections_limit, download_kbps=download_limit, upload_kbps=upload_limit, connections_limit=connections_limit, download_kbps=download_limit, upload_kbps=upload_limit,
encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete, encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete,
dht_routers=dht_routers, use_random_port=use_random_port, listen_port=listen_port, dht_routers=dht_routers, use_random_port=use_random_port, listen_port=listen_port,
keep_files=keep_files, user_agent=user_agent, resume_file=resume_file) keep_files=keep_files, user_agent=user_agent, resume_file=resume_file, enable_dht=enable_dht)
def buffer(self): def buffer(self):
#self.pre_buffer_bytes = 30*1024*1024 #30 MB #self.pre_buffer_bytes = 30*1024*1024 #30 MB

34
Core.py
View File

@ -909,7 +909,7 @@ class Core:
kinometa = self.Scraper.scraper(scraper, {'label': title, 'search': search, kinometa = self.Scraper.scraper(scraper, {'label': title, 'search': search,
'year': year}, self.language) 'year': year}, self.language)
#print 'kinometa:'+str(kinometa) log('kinometa:'+str(kinometa))
for section in kinometa.keys(): for section in kinometa.keys():
if isinstance(kinometa[section], dict): if isinstance(kinometa[section], dict):
@ -935,7 +935,13 @@ class Core:
else: else:
title = meta.get('info').get('title') title = meta.get('info').get('title')
listitem = xbmcgui.ListItem(title, iconImage=img, thumbnailImage=img) listitem = xbmcgui.ListItem(title)
images = {'thumb': img, #'icon': img,
'poster': img,# 'banner': img,
#'fanart': img, 'landscape': img,
# 'clearart': image, 'clearlogo': image,
}
listitem.setArt(images)
listitem.setInfo(type='Video', infoLabels=info) listitem.setInfo(type='Video', infoLabels=info)
if meta: if meta:
listitem=itemScrap(listitem, meta) listitem=itemScrap(listitem, meta)
@ -1102,7 +1108,29 @@ class Core:
def drawItem(self, title, action, link='', image='', isFolder=True, contextMenu=None, replaceMenu=True, action2='', fileSize=0L, def drawItem(self, title, action, link='', image='', isFolder=True, contextMenu=None, replaceMenu=True, action2='', fileSize=0L,
info={}): info={}):
#log('[drawItem]:'+str((title, action, image, isFolder, contextMenu, replaceMenu, action2, info))) #log('[drawItem]:'+str((title, action, image, isFolder, contextMenu, replaceMenu, action2, info)))
listitem = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image) listitem = xbmcgui.ListItem(title)
images = {'icon':image, 'thumb':image}
images = {'icon': image, 'thumb': image,
'poster': image, 'banner': image,
'fanart': image, 'landscape': image,
#'clearart': image, 'clearlogo': image,
}
listitem.setArt(images)
"""
setArt(values) -- Sets the listitem's art
values : dictionary - pairs of { label: value }.
- Some default art values (any string possible):
- thumb : string - image filename
- poster : string - image filename
- banner : string - image filename
- fanart : string - image filename
- clearart : string - image filename
- clearlogo : string - image filename
- landscape : string - image filename
- icon : string - image filename
example:
- self.list.getSelectedItem().setArt({ 'poster': 'poster.png', 'banner' : 'banner.png' })
"""
if not info: info = {"Title": title, "plot": title} if not info: info = {"Title": title, "plot": title}
if not isFolder and fileSize: if not isFolder and fileSize:
info['size'] = fileSize info['size'] = fileSize

View File

@ -137,13 +137,14 @@ class InposLoader:
keep_complete = True keep_complete = True
keep_incomplete = True keep_incomplete = True
enable_dht = self.__settings__.getSetting("enable_dht") == 'true'
dht_routers = ["router.bittorrent.com:6881", "router.utorrent.com:6881"] dht_routers = ["router.bittorrent.com:6881", "router.utorrent.com:6881"]
user_agent = 'uTorrent/2200(24683)' user_agent = 'uTorrent/2200(24683)'
self.engine = Engine(uri=file_url(self.torrentFile), download_path=self.storageDirectory, self.engine = Engine(uri=file_url(self.torrentFile), download_path=self.storageDirectory,
connections_limit=connections_limit, connections_limit=connections_limit,
encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete, encryption=encryption, keep_complete=keep_complete, keep_incomplete=keep_incomplete,
dht_routers=dht_routers, use_random_port=use_random_port, listen_port=listen_port, dht_routers=dht_routers, use_random_port=use_random_port, listen_port=listen_port,
user_agent=user_agent) user_agent=user_agent, enable_dht=enable_dht)
def localize(self, string): def localize(self, string):
try: try:

View File

@ -46,6 +46,7 @@ class SkorbaLoader:
lt = None lt = None
save_resume_data = None save_resume_data = None
__settings__ = sys.modules["__main__"].__settings__ __settings__ = sys.modules["__main__"].__settings__
enable_dht = __settings__.getSetting("enable_dht") == 'true'
def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'): def __init__(self, storageDirectory='', torrentFile='', torrentFilesDirectory='torrents'):
self.storageDirectory = storageDirectory self.storageDirectory = storageDirectory
@ -163,7 +164,7 @@ class SkorbaLoader:
iterator = 0 iterator = 0
while iterator < 100: while iterator < 100:
xbmc.sleep(500) xbmc.sleep(500)
self.torrentHandle.force_dht_announce() if self.enable_dht: self.torrentHandle.force_dht_announce()
progressBar.update(iterator, Localization.localize('Please Wait'), Localization.localize('Magnet-link is converting')+'.' * (iterator % 4), ' ') progressBar.update(iterator, Localization.localize('Please Wait'), Localization.localize('Magnet-link is converting')+'.' * (iterator % 4), ' ')
iterator += 1 iterator += 1
if progressBar.iscanceled(): if progressBar.iscanceled():
@ -339,6 +340,7 @@ class SkorbaLoader:
self.session = self.lt.session() self.session = self.lt.session()
self.session.set_alert_mask(self.lt.alert.category_t.error_notification | self.lt.alert.category_t.status_notification | self.lt.alert.category_t.storage_notification) self.session.set_alert_mask(self.lt.alert.category_t.error_notification | self.lt.alert.category_t.status_notification | self.lt.alert.category_t.storage_notification)
#self.session.set_alert_mask(self.lt.alert.category_t.all_categories) #self.session.set_alert_mask(self.lt.alert.category_t.all_categories)
if self.enable_dht:
self.session.add_dht_router("router.bittorrent.com", 6881) self.session.add_dht_router("router.bittorrent.com", 6881)
self.session.add_dht_router("router.utorrent.com", 6881) self.session.add_dht_router("router.utorrent.com", 6881)
self.session.start_dht() self.session.start_dht()
@ -481,7 +483,7 @@ class SkorbaLoader:
self.session.stop_natpmp() self.session.stop_natpmp()
self.session.stop_upnp() self.session.stop_upnp()
self.session.stop_lsd() self.session.stop_lsd()
self.session.stop_dht() if self.enable_dht: self.session.stop_dht()
def resume_data(self): def resume_data(self):
wasPaused=self.session.is_paused() wasPaused=self.session.is_paused()

View File

@ -67,6 +67,7 @@
<string id="30067">Aeon Nox (by joyrider)</string> <string id="30067">Aeon Nox (by joyrider)</string>
<string id="30068">pyrrent2http (python-libtorrent via http)</string> <string id="30068">pyrrent2http (python-libtorrent via http)</string>
<string id="30069">Append size to file name</string> <string id="30069">Append size to file name</string>
<string id="30070">Enable DHT</string>
<string id="30101">Interface</string> <string id="30101">Interface</string>
<string id="30102">P2P Network</string> <string id="30102">P2P Network</string>
<string id="30103">Advanced</string> <string id="30103">Advanced</string>

View File

@ -67,6 +67,7 @@
<string id="30067">Aeon Nox (от joyrider)</string> <string id="30067">Aeon Nox (от joyrider)</string>
<string id="30068">pyrrent2http (python-libtorrent по http)</string> <string id="30068">pyrrent2http (python-libtorrent по http)</string>
<string id="30069">Добавлять размер к имени файла</string> <string id="30069">Добавлять размер к имени файла</string>
<string id="30070">Включить DHT</string>
<string id="30101">Интерфейс</string> <string id="30101">Интерфейс</string>
<string id="30102">P2P Сеть</string> <string id="30102">P2P Сеть</string>
<string id="30103">Дополнительные</string> <string id="30103">Дополнительные</string>

View File

@ -69,6 +69,7 @@
<setting id="min_storage_size" type="slider" label="30059" default="0" visible="!eq(-5,1)" range="0,2,100" option="int"/> <setting id="min_storage_size" type="slider" label="30059" default="0" visible="!eq(-5,1)" range="0,2,100" option="int"/>
<setting id="pause_onplay" type="bool" label="30060" default="false" visible="!eq(-6,1)"/> <setting id="pause_onplay" type="bool" label="30060" default="false" visible="!eq(-6,1)"/>
<setting id="max_history_add" type="slider" label="30065" default="100" visible="!eq(-7,1)" range="0,2,100" option="int"/> <setting id="max_history_add" type="slider" label="30065" default="100" visible="!eq(-7,1)" range="0,2,100" option="int"/>
<setting id="enable_dht" type="bool" label="30070" default="true" visible="!eq(-8,1)"/>
<setting id="append_filesize" type="bool" label="30069" default="true"/> <setting id="append_filesize" type="bool" label="30069" default="true"/>
</category> </category>
</settings> </settings>