some really shady shit

pull/15/head
DiMartinoXBMC 2017-01-07 14:39:57 +03:00
parent 94e02d116b
commit 4223c6d942
10 changed files with 71 additions and 27 deletions

View File

@ -302,6 +302,9 @@ class AnteoPlayer(xbmc.Player):
if self.buffer(): if self.buffer():
log('[AnteoPlayer]: ************************************* GOING LOOP') log('[AnteoPlayer]: ************************************* GOING LOOP')
if self.setup_play(): if self.setup_play():
WatchedHistoryDB().add(self.basename,
foldername(self.getContentList()[self.contentId]['title']),
self.watchedTime, self.totalTime, self.contentId, self.fullSize)
self.setup_subs() self.setup_subs()
self.loop() self.loop()
WatchedHistoryDB().add(self.basename, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) WatchedHistoryDB().add(self.basename, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize)
@ -321,19 +324,19 @@ class AnteoPlayer(xbmc.Player):
log('[AnteoPlayer]: ************************************* NO! break') log('[AnteoPlayer]: ************************************* NO! break')
showMessage(self.localize('Information'), showMessage(self.localize('Information'),
self.localize('Stopping the torrent2http process...'), forced=True) self.localize('Stopping the torrent2http process...'))
break break
xbmc.Player().stop() xbmc.Player().stop()
loadsw_onstop() # Reload Search Window
if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory: if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory:
xbmc.sleep(1000) xbmc.sleep(1000)
clearStorage(self.userStorageDirectory) clearStorage(self.userStorageDirectory)
showMessage(self.localize('Information'), showMessage(self.localize('Information'),
self.localize('torrent2http process stopped.'), forced=True) self.localize('torrent2http process stopped.'))
loadsw_onstop() # Reload Search Window
def init(self): def init(self):
self.next_contentId = False self.next_contentId = False

View File

@ -1473,6 +1473,9 @@ class Core:
self.userStorageDirectory=dirname self.userStorageDirectory=dirname
def playTorrent(self, params={}): def playTorrent(self, params={}):
if params.get('filename'):
torrentUrl = params.get('filename')
else:
torrentUrl = self.__settings__.getSetting("lastTorrent") torrentUrl = self.__settings__.getSetting("lastTorrent")
#xbmc.executebuiltin('Action(Stop)') #xbmc.executebuiltin('Action(Stop)')
self.userStorage(params) self.userStorage(params)
@ -1608,7 +1611,7 @@ class Core:
'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % ( 'XBMC.RunPlugin(%s)' % ('%s?action=%s&ind=%s') % (
sys.argv[0], 'downloadLibtorrent', str(identifier))), sys.argv[0], 'downloadLibtorrent', str(identifier))),
] ]
link = {'url': identifier, 'thumbnail': thumbnail, 'save_folder':save_folder} link = {'url': identifier, 'thumbnail': thumbnail, 'save_folder':save_folder, 'filename':url}
self.drawItem(title, 'playTorrent', link, image=thumbnail, isFolder=False, self.drawItem(title, 'playTorrent', link, image=thumbnail, isFolder=False,
action2=ids_video.rstrip(','), contextMenu=contextMenu, replaceMenu=False, fileSize=filesize) action2=ids_video.rstrip(','), contextMenu=contextMenu, replaceMenu=False, fileSize=filesize)
view_style('openTorrent') view_style('openTorrent')

View File

@ -273,6 +273,9 @@ class InposPlayer(xbmc.Player):
while True: while True:
log('['+author+'Player]: ************************************* GOING LOOP') log('['+author+'Player]: ************************************* GOING LOOP')
if self.setup_play(): if self.setup_play():
WatchedHistoryDB().add(self.basename,
foldername(self.getContentList()[self.contentId]['title']),
self.watchedTime, self.totalTime, self.contentId, self.fullSize)
self.setup_subs() self.setup_subs()
self.loop() self.loop()
WatchedHistoryDB().add(self.basename, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize) WatchedHistoryDB().add(self.basename, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize)
@ -301,8 +304,6 @@ class InposPlayer(xbmc.Player):
xbmc.Player().stop() xbmc.Player().stop()
loadsw_onstop() # Reload Search Window
if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory: if '1' != self.__settings__.getSetting("keep_files") and 'Saved Files' not in self.userStorageDirectory:
xbmc.sleep(1000) xbmc.sleep(1000)
clearStorage(self.userStorageDirectory) clearStorage(self.userStorageDirectory)
@ -313,7 +314,9 @@ class InposPlayer(xbmc.Player):
#else: #else:
#if self.seeding: self.db_delete() #if self.seeding: self.db_delete()
showMessage(self.localize('Information'), showMessage(self.localize('Information'),
self.localize('Torrent downloading is stopped.'), forced=True) self.localize('Torrent downloading is stopped.'))
loadsw_onstop() # Reload Search Window
def init(self): def init(self):
self.next_contentId = False self.next_contentId = False
@ -572,7 +575,7 @@ class InposPlayer(xbmc.Player):
int) and self.next_contentId != False: int) and self.next_contentId != False:
self.engine.activate_file(self.next_contentId) self.engine.activate_file(self.next_contentId)
showMessage(self.localize('Torrent Downloading'), showMessage(self.localize('Torrent Downloading'),
self.localize('Starting download next episode!'), forced=True) self.localize('Starting download next episode!'))
log('[loop]: next_contentId '+str(self.next_contentId)+str(isinstance(self.next_contentId, int))) log('[loop]: next_contentId '+str(self.next_contentId)+str(isinstance(self.next_contentId, int)))
file_status = self.engine.file_status(self.next_contentId) file_status = self.engine.file_status(self.next_contentId)
self.basename = self.display_name = os.path.basename(file_status.name) self.basename = self.display_name = os.path.basename(file_status.name)

View File

@ -166,6 +166,10 @@ class TorrentPlayer(xbmc.Player):
debug('************************************* GOING LOOP') debug('************************************* GOING LOOP')
self.torrent.startSession() self.torrent.startSession()
self.torrent.continueSession(self.contentId) self.torrent.continueSession(self.contentId)
WatchedHistoryDB().add(self.basename,
foldername(self.torrent.getContentList()[self.contentId]['title']),
self.watchedTime, self.totalTime, self.contentId,
self.fullSize / 1024 / 1024)
self.loop() self.loop()
WatchedHistoryDB().add(self.basename, foldername(self.torrent.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize / 1024 / 1024) WatchedHistoryDB().add(self.basename, foldername(self.torrent.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize / 1024 / 1024)
else: else:
@ -184,8 +188,6 @@ class TorrentPlayer(xbmc.Player):
debug('************************************* NO! break') debug('************************************* NO! break')
break break
loadsw_onstop() # Reload Search Window
self.torrent.stopSession() self.torrent.stopSession()
self.torrent.threadComplete = True self.torrent.threadComplete = True
self.torrent.checkThread() self.torrent.checkThread()
@ -195,11 +197,13 @@ class TorrentPlayer(xbmc.Player):
else: else:
if self.seeding_status: if self.seeding_status:
showMessage(self.localize('Information'), showMessage(self.localize('Information'),
self.localize('Torrent is seeding. To stop it use Download Status.'), forced=True) self.localize('Torrent is seeding. To stop it use Download Status.'))
else: else:
if self.seeding: self.db_delete() if self.seeding: self.db_delete()
showMessage(self.localize('Information'), showMessage(self.localize('Information'),
self.localize('Torrent downloading is stopped.'), forced=True) self.localize('Torrent downloading is stopped.'))
loadsw_onstop() # Reload Search Window
def init(self): def init(self):
self.next_dl = True if self.__settings__.getSetting('next_dl') == 'true' and self.ids_video else False self.next_dl = True if self.__settings__.getSetting('next_dl') == 'true' and self.ids_video else False
@ -369,7 +373,7 @@ class TorrentPlayer(xbmc.Player):
if len(subs) > 0: if len(subs) > 0:
self.torrent.startSession() self.torrent.startSession()
showMessage(self.localize('Information'), showMessage(self.localize('Information'),
self.localize('Downloading and copy subtitles. Please wait.'), forced=True) self.localize('Downloading and copy subtitles. Please wait.'))
for ind, title in subs: for ind, title in subs:
self.torrent.continueSession(ind) self.torrent.continueSession(ind)
while iterator < 100: while iterator < 100:
@ -457,7 +461,7 @@ class TorrentPlayer(xbmc.Player):
if self.iterator == 100 and self.next_dl and not self.next_dling and isinstance(self.next_contentId, if self.iterator == 100 and self.next_dl and not self.next_dling and isinstance(self.next_contentId,
int) and self.next_contentId != False: int) and self.next_contentId != False:
showMessage(self.localize('Torrent Downloading'), showMessage(self.localize('Torrent Downloading'),
self.localize('Starting download next episode!'), forced=True) self.localize('Starting download next episode!'))
self.torrent.stopSession() self.torrent.stopSession()
# xbmc.sleep(1000) # xbmc.sleep(1000)
path = self.torrent.getFilePath(self.next_contentId) path = self.torrent.getFilePath(self.next_contentId)

View File

@ -1,5 +1,10 @@
English changelog at http://bit.ly/1MfSVUP English changelog at http://bit.ly/1MfSVUP
[B]Version 2.6.0[/B]
[+] Окно Поиска: Полноценный релиз
[+] Настройки: Добавлена возможность отключения уведомлений
[+] История Просмотров: При аварийном выходе данные остаются
[B]Version 2.5.6[/B] [B]Version 2.5.6[/B]
[+] Списки Медиа: Добавлен RuTorOrg [+] Списки Медиа: Добавлен RuTorOrg

View File

@ -93,10 +93,10 @@ def clearStorage(userStorageDirectory, force = False):
if saved_bool: if saved_bool:
shutil.move(saved_temp, saved) shutil.move(saved_temp, saved)
showMessage(Localization.localize('Storage'), Localization.localize('Storage has been cleared'), forced=True) showMessage(Localization.localize('Storage'), Localization.localize('Storage has been cleared'))
else: else:
showMessage(Localization.localize('Storage'), Localization.localize('Does not exists'), forced=True) showMessage(Localization.localize('Storage'), Localization.localize('Does not exists'))
log('[clearStorage]: fail storage '+userStorageDirectory + os.sep) log('[clearStorage]: fail storage '+userStorageDirectory + os.sep)
try: try:
@ -152,6 +152,7 @@ def debug(msg, forced=False):
def showMessage(heading, message, times=10000, forced=False): def showMessage(heading, message, times=10000, forced=False):
if forced or not getSettingAsBool('disable_notifications'):
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s, "%s")' % ( xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s, "%s")' % (
heading.replace('"', "'"), message.replace('"', "'"), times, icon)) heading.replace('"', "'"), message.replace('"', "'"), times, icon))
debug(str((heading.replace('"', "'"), message.replace('"', "'"), times, icon))) debug(str((heading.replace('"', "'"), message.replace('"', "'"), times, icon)))
@ -1362,6 +1363,7 @@ def get_contentList(url):
import Downloader import Downloader
url = urllib.unquote_plus(url) url = urllib.unquote_plus(url)
log('0' + __settings__.getSetting("lastTorrent"))
__settings__.setSetting("lastTorrentUrl", url) __settings__.setSetting("lastTorrentUrl", url)
classMatch = re.search('(\w+)::(.+)', url) classMatch = re.search('(\w+)::(.+)', url)
@ -1372,7 +1374,9 @@ def get_contentList(url):
torrent = Downloader.Torrent(userStorageDirectory, url, torrentFilesDirectory=torrentFilesDirectory) torrent = Downloader.Torrent(userStorageDirectory, url, torrentFilesDirectory=torrentFilesDirectory)
log('1'+__settings__.getSetting("lastTorrent"))
__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) __settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
log('2'+__settings__.getSetting("lastTorrent"))
append_filesize = __settings__.getSetting("append_filesize") == 'true' append_filesize = __settings__.getSetting("append_filesize") == 'true'

View File

@ -85,6 +85,7 @@
<string id="30109">Enabled, optional</string> <string id="30109">Enabled, optional</string>
<string id="30110">Disabled</string> <string id="30110">Disabled</string>
<string id="30111">Search Window Transparent Background</string> <string id="30111">Search Window Transparent Background</string>
<string id="30112">Disable Notifications</string>
<string id="50301">Save path</string> <string id="50301">Save path</string>
<string id="50302">Call dialog</string> <string id="50302">Call dialog</string>
<string id="50303">Default</string> <string id="50303">Default</string>

View File

@ -79,6 +79,13 @@
<string id="30103">Дополнительные</string> <string id="30103">Дополнительные</string>
<string id="30104">Торрент-клиент</string> <string id="30104">Торрент-клиент</string>
<string id="30105">Hentai (тонкая настр.)</string> <string id="30105">Hentai (тонкая настр.)</string>
<string id="30106">Режим работы Окна Поиска</string>
<string id="30107">Включен, убрать старый вид</string>
<string id="30108">Включен, заменить старый вид</string>
<string id="30109">Включен, как опция</string>
<string id="30110">Отключен</string>
<string id="30111">Прозрачность Окна Поиска</string>
<string id="30112">Отключить Уведомления</string>
<string id="50301">Директория для сохранения файлов</string> <string id="50301">Директория для сохранения файлов</string>
<string id="50302">Вызывать диалог</string> <string id="50302">Вызывать диалог</string>
<string id="50303">Задать по умолчанию</string> <string id="50303">Задать по умолчанию</string>

View File

@ -73,6 +73,7 @@
<setting id="enable_dht" type="bool" label="30070" default="true" visible="!eq(-8,1)"/> <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"/>
<setting id="torrent_info_style" type="enum" label="30072" default="0" lvalues="30073|30074|30075"/> <setting id="torrent_info_style" type="enum" label="30072" default="0" lvalues="30073|30074|30075"/>
<setting id="disable_notifications" type="bool" label="30112" default="false"/>
<setting id="sw_transparent_back" type="bool" label="30111" default="false"/> <setting id="sw_transparent_back" type="bool" label="30111" default="false"/>
</category> </category>
</settings> </settings>

View File

@ -240,8 +240,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
navi = read.read() navi = read.read()
read.close() read.close()
try:
debug('navi_load navi: '+str(navi)) debug('navi_load navi: '+str(navi))
log('navi_load navi: ' + str(navi['route'])) log('navi_load navi: ' + str(navi['route']))
except:
log('navi_load load error')
if navi and len(navi) > 0: if navi and len(navi) > 0:
self.navi = json.loads(navi) self.navi = json.loads(navi)
@ -335,7 +338,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if query: if query:
self.input_search.setText(query) self.input_search.setText(query)
else: else:
if self.input_search.getText() not in ['', None]:
query = self.input_search.getText() query = self.input_search.getText()
elif self.navi['last_query'] not in ['', None]:
query = self.navi['last_query']
self.input_search.setText(self.navi['last_query'])
log('Search query: ' + str(query)) log('Search query: ' + str(query))
@ -814,7 +821,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
contentListNew = sorted(contentListNew, key=lambda x: x[0], reverse=False) contentListNew = sorted(contentListNew, key=lambda x: x[0], reverse=False)
for title, identifier, filesize in contentListNew: for title, identifier, filesize in contentListNew:
params = {'mode': 'torrent_play', 'url': identifier, 'url2': ids_video.rstrip(','), 'filename': link} params = {'mode': 'torrent_play', 'fileIndex': identifier, 'url2': ids_video.rstrip(','), 'url': link}
self.drawItem(title, params) self.drawItem(title, params)
self.navi_save('open_torrent') self.navi_save('open_torrent')
@ -865,7 +872,11 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
return label_list return label_list
def context(self): def context(self):
if self.getFocus() == self.listing: try:
focused_control = self.getFocus()
except:
focused_control = None
if focused_control == self.listing:
item = self.listing.getSelectedItem() item = self.listing.getSelectedItem()
params = json.loads(item.getfilename()) params = json.loads(item.getfilename())
mode = params.get('mode') mode = params.get('mode')
@ -879,6 +890,8 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
if ret > -1 and ret < len(label_list): if ret > -1 and ret < len(label_list):
getattr(self, "right_press" + str(ret + 1))() getattr(self, "right_press" + str(ret + 1))()
elif focused_control == self.input_search:
self.input_search.setText('')
def right_menu(self, mode='place'): def right_menu(self, mode='place'):
if not mode == 'place': if not mode == 'place':
@ -1028,7 +1041,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
self.navi_back() self.navi_back()
elif mode == 'torrent_play': elif mode == 'torrent_play':
if index == 1: if index == 1:
url = self.form_link('playTorrent', params) url = self.form_link('playSTRM', params)
xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url)) xbmc.executebuiltin('xbmc.RunPlugin("%s")' % (url))
__settings__.setSetting('loadsw_onstop', 'true') __settings__.setSetting('loadsw_onstop', 'true')
self.close() self.close()
@ -1125,7 +1138,7 @@ class SearchWindow(pyxbmct.AddonDialogWindow):
link_url = '' link_url = ''
for key in link.keys(): for key in link.keys():
if link.get(key) and key != 'mode': if link.get(key) and key != 'mode':
link_url = '%s&%s=%s' % (link_url, key, urllib.quote_plus(link.get(key))) link_url = '%s&%s=%s' % (link_url, key, urllib.quote_plus(ensure_str(link.get(key))))
url = '%s?action=%s' % ('plugin://plugin.video.torrenter/', action) + link_url url = '%s?action=%s' % ('plugin://plugin.video.torrenter/', action) + link_url
else: else:
url = '%s?action=%s&url=%s' % ('plugin://plugin.video.torrenter/', action, urllib.quote_plus(link)) url = '%s?action=%s&url=%s' % ('plugin://plugin.video.torrenter/', action, urllib.quote_plus(link))