external seek

pull/15/head
DiMartinoXBMC 2017-01-18 15:59:45 +03:00
parent ad88903843
commit f499dd8502
6 changed files with 38 additions and 8 deletions

View File

@ -302,12 +302,12 @@ class AnteoPlayer(xbmc.Player):
if self.buffer():
log('[AnteoPlayer]: ************************************* GOING LOOP')
if self.setup_play():
WatchedHistoryDB().add(self.basename,
WatchedHistoryDB().add(self.basename, self.torrentUrl,
foldername(self.getContentList()[self.contentId]['title']),
self.watchedTime, self.totalTime, self.contentId, self.fullSize)
self.setup_subs()
self.loop()
WatchedHistoryDB().add(self.basename, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize)
WatchedHistoryDB().add(self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize)
else:
log('[AnteoPlayer]: ************************************* break')
break

View File

@ -1479,6 +1479,9 @@ class Core:
else:
torrentUrl = self.__settings__.getSetting("lastTorrent")
#xbmc.executebuiltin('Action(Stop)')
if self.torrent_player != '1' and params.get('external') == '1' and not params.get('seek'):
params['seek'] = watched_seek(torrentUrl, params['url'])
self.userStorage(params)
if self.torrent_player == '0':
from Player import TorrentPlayer

View File

@ -273,12 +273,12 @@ class InposPlayer(xbmc.Player):
while True:
log('['+author+'Player]: ************************************* GOING LOOP')
if self.setup_play():
WatchedHistoryDB().add(self.basename,
WatchedHistoryDB().add(self.basename, self.torrentUrl,
foldername(self.getContentList()[self.contentId]['title']),
self.watchedTime, self.totalTime, self.contentId, self.fullSize)
self.setup_subs()
self.loop()
WatchedHistoryDB().add(self.basename, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize)
WatchedHistoryDB().add(self.basename, self.torrentUrl, foldername(self.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize)
else:
log('['+author+'Player]: ************************************* break')
break

View File

@ -166,12 +166,12 @@ class TorrentPlayer(xbmc.Player):
debug('************************************* GOING LOOP')
self.torrent.startSession()
self.torrent.continueSession(self.contentId)
WatchedHistoryDB().add(self.basename,
WatchedHistoryDB().add(self.basename, self.torrentUrl,
foldername(self.torrent.getContentList()[self.contentId]['title']),
self.watchedTime, self.totalTime, self.contentId,
self.fullSize / 1024 / 1024)
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, self.torrentUrl, foldername(self.torrent.getContentList()[self.contentId]['title']), self.watchedTime, self.totalTime, self.contentId, self.fullSize / 1024 / 1024)
else:
break
debug('************************************* GO NEXT?')

View File

@ -1,5 +1,8 @@
English changelog at http://bit.ly/1MfSVUP
[B]Version 2.6.2[/B]
[+] История Просмотров: Перемотка при внешнем вызове
[B]Version 2.6.1[/B]
[+] Окно Поиска: Использование окна в сторонних плагинах

View File

@ -1071,7 +1071,14 @@ class WatchedHistoryDB:
self._close()
return x if x else None
def add(self, filename, foldername = None, seek = 0, length = 1, ind = 0, size = 0):
def getbypathind(self, path, ind):
self._connect()
self.cur.execute('select seek from history where path="' + path + '" AND ind=' + ind)
x = self.cur.fetchone()
self._close()
return x if x else None
def add(self, filename, path, foldername = None, seek = 0, length = 1, ind = 0, size = 0):
try:
watchedPercent = int((float(seek) / float(length)) * 100)
except:
@ -1080,7 +1087,7 @@ class WatchedHistoryDB:
if self.history_bool and watchedPercent <= max_history_add:
self._connect()
url = __settings__.getSetting("lastTorrentUrl")
path = __settings__.getSetting("lastTorrent")
#path = __settings__.getSetting("lastTorrent")
if not foldername:
foldername = ''
self.cur.execute('delete from history where filename="' + decode(filename) + '"')
@ -2303,3 +2310,20 @@ def loadsw_onstop():
import searchwindow
params = {'mode': 'load'}
searchwindow.main(params)
def watched_seek(filename, ind):
db = WatchedHistoryDB()
seek = db.getbypathind(filename, ind)
log('[watched_seek] seek - '+str(seek))
if seek:
seek = seek[0]
seek = int(seek) if int(seek) > 3 * 60 else 0
if seek > 0:
seek_text = '%02d:%02d:%02d' % ((seek / (60 * 60)), (seek / 60) % 60, seek % 60)
dialog_items = [Localization.localize('Play (from %s)') % seek_text,
Localization.localize('Play (from start)')]
ret = xbmcgui.Dialog().select(Localization.localize('Play (with seek)'), dialog_items)
if ret == 0:
return str(seek)
else:
return '0'