btclient
parent
b239e74bff
commit
c38b65c643
|
@ -365,14 +365,15 @@ class BTClientPlayer(xbmc.Player):
|
|||
self.display_name = label
|
||||
|
||||
base = 'http://127.0.0.1:' + str(self.free_port) + '/'
|
||||
url = urlparse.urljoin(base, urllib.quote(path))
|
||||
url = urlparse.urljoin(base, urllib.quote(self.c._file.path))
|
||||
# мегакостыль!
|
||||
rpc = ({'jsonrpc': '2.0', 'method': 'Files.GetDirectory', 'params': {
|
||||
'media': 'video', 'directory': os.path.dirname(path)}, 'id': 0})
|
||||
'media': 'video', 'directory': path}, 'id': 0})
|
||||
data = json.dumps(rpc)
|
||||
request = xbmc.executeJSONRPC(data)
|
||||
response = json.loads(request)
|
||||
xbmc.sleep(300)
|
||||
while not response:
|
||||
xbmc.sleep(100)
|
||||
if response:
|
||||
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||
playlist.clear()
|
||||
|
|
57
Core.py
57
Core.py
|
@ -11,7 +11,7 @@
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the#
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
|
@ -26,12 +26,7 @@ import xbmcaddon
|
|||
import xbmcgui
|
||||
import xbmcplugin
|
||||
import xbmcvfs
|
||||
import Content
|
||||
from Player import TorrentPlayer
|
||||
from functions import *
|
||||
from resources.utorrent.net import *
|
||||
from resources.scrapers.scrapers import Scrapers
|
||||
from resources.skins.DialogXml import *
|
||||
from platform_pulsar import get_platform
|
||||
|
||||
|
||||
|
@ -136,7 +131,7 @@ class Core:
|
|||
image=self.ROOT + '/icons/magnet.png')
|
||||
if self.debug:
|
||||
self.drawItem('full_download', 'full_download', image=self.ROOT + '/icons/magnet.png')
|
||||
self.drawItem('test', 'test', image=self.ROOT + '/icons/magnet.png')
|
||||
self.drawItem('test', 'test', image=self.ROOT + '/icons/magnet.png', isFolder=False)
|
||||
|
||||
if '0' != self.__settings__.getSetting("keep_files"):
|
||||
self.drawItem('< %s >' % self.localize('Clear Storage'), 'clearStorage', isFolder=True,
|
||||
|
@ -273,18 +268,23 @@ class Core:
|
|||
lockView('wide')
|
||||
|
||||
def test(self, params={}):
|
||||
#db=DownloadDB()
|
||||
#db.add(u'XXX2', 'file', json.dumps({'seeds':1,'leechers':1}), 20)
|
||||
#url='magnet:?xt=urn:btih:6698E0950DCD257A6B03AF2E8B068B7FF9D4619D&dn=game+of+thrones+season+2+720p+bluray+x264+shaanig&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337'
|
||||
#filename='D:\\torrents\\Torrenter\\torrents\\Jimmy.Fallon.2015.01.09.Don.Cheadle.HDTV.x264-CROOKS.mp4.torrent'
|
||||
#torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
|
||||
#self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(filename))
|
||||
#torrent.downloadProcess()
|
||||
#self.DownloadStatus()
|
||||
url='http://torcache.net/torrent/6698E0950DCD257A6B03AF2E8B068B7FF9D4619D.torrent?title=[kickass.to]game.of.thrones.season.2.720p.bluray.x264.shaanig'
|
||||
#xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrenter/?action=openTorrent&external=ThePirateBaySe&url=ThePirateBaySe%3A%3A'+urllib.quote_plus(url)+'¬_download_only=True")')
|
||||
#print str(Searchers().list())
|
||||
first_run_230(False)
|
||||
from BTClientPlayer import BTClientPlayer
|
||||
torrentUrl='D:\\ntest.torrent'
|
||||
params['url']='0'
|
||||
if not xbmcvfs.exists(torrentUrl):
|
||||
action = xbmcgui.Dialog()
|
||||
torrentUrl = action.browse(1, self.localize('Choose .torrent in video library'), 'video', '.torrent')
|
||||
if torrentUrl and xbmcvfs.exists(torrentUrl):
|
||||
if 0 != len(torrentUrl):
|
||||
self.Player = BTClientPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
|
||||
else:
|
||||
print self.__plugin__ + " Unexpected access to method playTorrent() without torrent content"
|
||||
#path='http://127.0.0.1:5001/Inception.2010.1080p.BluRay.x264.5xRus.Eng-Otaibi.mkv'
|
||||
#listitem = xbmcgui.ListItem('Inception.2010.1080p.BluRay.x264.5xRus.Eng-Otaibi.mkv', path=path)
|
||||
#playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||
#playlist.clear()
|
||||
#playlist.add(path, listitem)
|
||||
#xbmc.Player().play(playlist)
|
||||
|
||||
def DownloadStatus(self, params={}):
|
||||
db = DownloadDB()
|
||||
|
@ -592,6 +592,7 @@ class Core:
|
|||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
||||
|
||||
def openContent(self, params={}):
|
||||
import Content
|
||||
self.contenterObject = {}
|
||||
self.Content = Content.Content()
|
||||
self.Contenters = Contenters()
|
||||
|
@ -675,6 +676,7 @@ class Core:
|
|||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
||||
|
||||
def full_download(self, params={}):
|
||||
import Content
|
||||
self.contenterObject = {}
|
||||
self.Content = Content.Content()
|
||||
self.Contenters = Contenters()
|
||||
|
@ -759,6 +761,7 @@ class Core:
|
|||
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
|
||||
|
||||
def drawcontentList(self, contentList, params={}):
|
||||
from resources.scrapers.scrapers import Scrapers
|
||||
contentList = sorted(contentList, key=lambda x: x[0], reverse=True)
|
||||
self.Scraper = Scrapers()
|
||||
progressBar = xbmcgui.DialogProgress()
|
||||
|
@ -926,6 +929,7 @@ class Core:
|
|||
#self.drawItem(title, 'openTorrent', link, img, info=info, contextMenu=contextMenu, replaceMenu=False)
|
||||
|
||||
def ActionInfo(self, params={}):
|
||||
from resources.skins.DialogXml import DialogXml
|
||||
get = params.get
|
||||
contenter=get('provider')
|
||||
infolink=get('url')
|
||||
|
@ -1058,6 +1062,7 @@ class Core:
|
|||
self.sectionMenu()
|
||||
|
||||
def uTorrentBrowser(self, params={}):
|
||||
from resources.utorrent.net import Download
|
||||
menu, dirs = [], []
|
||||
contextMenustring = 'XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s') % (sys.argv[0], 'uTorrentBrowser', '%s')
|
||||
get = params.get
|
||||
|
@ -1312,10 +1317,17 @@ class Core:
|
|||
torrentUrl = self.__settings__.getSetting("lastTorrent")
|
||||
self.userStorage(params)
|
||||
if self.torrent_player == '0':
|
||||
from Player import TorrentPlayer
|
||||
if 0 != len(torrentUrl):
|
||||
self.Player = TorrentPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
|
||||
else:
|
||||
print self.__plugin__ + " Unexpected access to method playTorrent() without torrent content"
|
||||
elif self.torrent_player == '2':
|
||||
from BTClientPlayer import BTClientPlayer
|
||||
if 0 != len(torrentUrl):
|
||||
self.Player = BTClientPlayer(userStorageDirectory=self.userStorageDirectory, torrentUrl=torrentUrl, params=params)
|
||||
else:
|
||||
print self.__plugin__ + " Unexpected access to method playTorrent() without torrent content"
|
||||
elif self.torrent_player == '1':
|
||||
__ASsettings__ = xbmcaddon.Addon(id='script.module.torrent.ts')
|
||||
folder=__ASsettings__.getSetting("folder")
|
||||
|
@ -1596,6 +1608,7 @@ class Core:
|
|||
return
|
||||
|
||||
def downloadFilesList(self, params={}):
|
||||
from resources.utorrent.net import Download
|
||||
dirname = None
|
||||
dat = Download().listdirs()
|
||||
if dat == False:
|
||||
|
@ -1667,7 +1680,7 @@ class Core:
|
|||
if success:
|
||||
showMessage(self.localize('Torrent-client Browser'), self.localize('Added!'), forced=True)
|
||||
if ind:
|
||||
id = self.chooseHASH()[0]
|
||||
id = self.chooseHASH(Download().list())[0]
|
||||
Download().setprio(id, ind)
|
||||
|
||||
def downloadLibtorrent(self, params={}):
|
||||
|
@ -1744,10 +1757,10 @@ class Core:
|
|||
else:
|
||||
self.openSection(params)
|
||||
|
||||
def chooseHASH(self):
|
||||
def chooseHASH(self, list):
|
||||
dialog_items, dialog_items_clean = [], []
|
||||
dialog_files = []
|
||||
dat = Download().list()
|
||||
dat = list
|
||||
if dat == False:
|
||||
showMessage(self.localize('Error'), self.localize('No connection! Check settings!'), forced=True)
|
||||
return
|
||||
|
|
|
@ -41,7 +41,7 @@ class Torrent():
|
|||
|
||||
def get_torrent_client(self):
|
||||
player = self.__settings__.getSetting("torrent_player")
|
||||
if player == '0':
|
||||
if player in ['0','2']:
|
||||
self.player = 'libtorrent'
|
||||
elif player == '1':
|
||||
self.player = 'acestream'
|
||||
|
|
|
@ -61,12 +61,14 @@ class Libtorrent:
|
|||
from python_libtorrent import get_libtorrent
|
||||
libtorrent=get_libtorrent()
|
||||
log('Imported libtorrent v%s from python_libtorrent/%s' %(libtorrent.version, self.platform['system']))
|
||||
module=True
|
||||
except Exception, e:
|
||||
module=False
|
||||
log('Error importing python_libtorrent.%s. Exception: %s' %(self.platform['system'], str(e)))
|
||||
import libtorrent
|
||||
|
||||
try:
|
||||
log('Imported libtorrent v' + libtorrent.version + ' from system')
|
||||
if not module: log('Imported libtorrent v' + libtorrent.version + ' from system')
|
||||
self.lt = libtorrent
|
||||
del libtorrent
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.libtorrent"/>
|
||||
<import addon="script.module.btclient"/>
|
||||
<import addon="script.module.torrent.ts"/>
|
||||
</requires>
|
||||
<extension point="xbmc.python.pluginsource" provides="video" library="default.py">
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
English changelog at http://bit.ly/1MfSVUP
|
||||
|
||||
[B]Version 2.3.6[/B]
|
||||
[+] Оптимизация импорта
|
||||
[+] Новый Проигрыватель BTclient (https://github.com/izderadicka/btclient) в тестовом режиме.
|
||||
|
||||
[B]Version 2.3.5[/B]
|
||||
[+] Проигрыватель: Уменьшена просадка после загрузки буфера
|
||||
[+] Проигрыватель: Проверка на запись хранилища
|
||||
|
|
|
@ -36,7 +36,6 @@ import xbmc
|
|||
import xbmcaddon
|
||||
import xbmcvfs
|
||||
import Localization
|
||||
from resources.scrapers.scrapers import Scrapers
|
||||
|
||||
try:
|
||||
from hashlib import md5
|
||||
|
@ -1265,6 +1264,7 @@ class Contenters():
|
|||
pass
|
||||
|
||||
def first_time(self, scrapperDB_ver, language='ru'):
|
||||
from resources.scrapers.scrapers import Scrapers
|
||||
searcher = 'metadata'
|
||||
redl = False
|
||||
scrapperDB_ver = scrapperDB_ver[language]
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<string id="30043">Delete files</string>
|
||||
<string id="30044">Save files</string>
|
||||
<string id="30045">Ask to save</string>
|
||||
<string id="30046">BTclient (python-libtorrent via http)</string>
|
||||
<string id="30101">Interface</string>
|
||||
<string id="30102">P2P Network</string>
|
||||
<string id="30103">Advanced</string>
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<string id="30043">Удалять файлы</string>
|
||||
<string id="30044">Сохранять файлы</string>
|
||||
<string id="30045">Спросить о сохранении</string>
|
||||
<string id="30046">BTclient (python-libtorrent по http)</string>
|
||||
<string id="30101">Интерфейс</string>
|
||||
<string id="30102">P2P Сеть</string>
|
||||
<string id="30103">Дополнительные</string>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<setting id="debug" type="bool" label="30015" default="false"/>
|
||||
</category>
|
||||
<category label="30102">
|
||||
<setting id="torrent_player" type="enum" label="30023" default="0" lvalues="30021|30022" />
|
||||
<setting id="torrent_player" type="enum" label="30023" default="0" lvalues="30021|30022|30046" />
|
||||
<setting id="storage" type="folder" label="30004" default=""/>
|
||||
<setting id="keep_files" type="enum" label="30008" default="1" lvalues="30043|30044|30045"/>
|
||||
<setting id="ask_dir" type="bool" label="30031" default="false" enable="!eq(-1,0)" />
|
||||
|
|
Loading…
Reference in New Issue