subs and loop fix
parent
c5094557d3
commit
11a897c391
|
@ -175,7 +175,7 @@ class AnteoLoader:
|
||||||
return self.torrentFile
|
return self.torrentFile
|
||||||
else:
|
else:
|
||||||
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
||||||
torrentFile = self.torrentFilesPath + self.md5(torrentUrl) + '.torrent'
|
torrentFile = os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent')
|
||||||
try:
|
try:
|
||||||
if not re.match("^http\:.+$", torrentUrl):
|
if not re.match("^http\:.+$", torrentUrl):
|
||||||
content = xbmcvfs.File(torrentUrl, "rb").read()
|
content = xbmcvfs.File(torrentUrl, "rb").read()
|
||||||
|
@ -202,7 +202,7 @@ class AnteoLoader:
|
||||||
torrentFile = torrentUrl
|
torrentFile = torrentUrl
|
||||||
if xbmcvfs.exists(torrentFile) and not os.path.exists(torrentFile):
|
if xbmcvfs.exists(torrentFile) and not os.path.exists(torrentFile):
|
||||||
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
if not xbmcvfs.exists(self.torrentFilesPath): xbmcvfs.mkdirs(self.torrentFilesPath)
|
||||||
torrentFile = self.torrentFilesPath + self.md5(torrentUrl) + '.torrent'
|
torrentFile = os.path.join(self.torrentFilesPath, self.md5(torrentUrl) + '.torrent')
|
||||||
xbmcvfs.copy(torrentUrl, torrentFile)
|
xbmcvfs.copy(torrentUrl, torrentFile)
|
||||||
if xbmcvfs.exists(torrentFile):
|
if xbmcvfs.exists(torrentFile):
|
||||||
self.torrentFile = "file:///"+torrentFile.replace('\\','//').replace('////','//')
|
self.torrentFile = "file:///"+torrentFile.replace('\\','//').replace('////','//')
|
||||||
|
@ -255,6 +255,7 @@ 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():
|
||||||
|
self.setup_subs()
|
||||||
self.loop()
|
self.loop()
|
||||||
else:
|
else:
|
||||||
log('[AnteoPlayer]: ************************************* break')
|
log('[AnteoPlayer]: ************************************* break')
|
||||||
|
@ -264,7 +265,7 @@ class AnteoPlayer(xbmc.Player):
|
||||||
self.contentId = self.next_contentId
|
self.contentId = self.next_contentId
|
||||||
continue
|
continue
|
||||||
log('[AnteoPlayer]: ************************************* NO! break')
|
log('[AnteoPlayer]: ************************************* NO! break')
|
||||||
break
|
break
|
||||||
|
|
||||||
xbmc.Player().stop()
|
xbmc.Player().stop()
|
||||||
|
|
||||||
|
@ -391,6 +392,7 @@ class AnteoPlayer(xbmc.Player):
|
||||||
else:
|
else:
|
||||||
progressBar.update(iterator, self.localize('UNKNOWN STATUS'), ' ', ' ')
|
progressBar.update(iterator, self.localize('UNKNOWN STATUS'), ' ', ' ')
|
||||||
if progressBar.iscanceled():
|
if progressBar.iscanceled():
|
||||||
|
self.iterator = 0
|
||||||
ready = False
|
ready = False
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -432,12 +434,6 @@ class AnteoPlayer(xbmc.Player):
|
||||||
else:
|
else:
|
||||||
self.next_contentId = False
|
self.next_contentId = False
|
||||||
log('[AnteoPlayer][setup_play]: next_contentId: '+str(self.next_contentId))
|
log('[AnteoPlayer][setup_play]: next_contentId: '+str(self.next_contentId))
|
||||||
|
|
||||||
if self.subs_dl:
|
|
||||||
sub_files = self.engine.list(media_types=[MediaType.SUBTITLES])
|
|
||||||
if sub_files:
|
|
||||||
log("[AnteoPlayer][setup_play]: Detected subtitles: %s" % str(sub_files[0]))
|
|
||||||
subtitles = sub_files[0]
|
|
||||||
try:
|
try:
|
||||||
seasonId = self.get("seasonId")
|
seasonId = self.get("seasonId")
|
||||||
self.episodeId = self.get("episodeId") if not self.episodeId else int(self.episodeId) + 1
|
self.episodeId = self.get("episodeId") if not self.episodeId else int(self.episodeId) + 1
|
||||||
|
@ -466,13 +462,24 @@ class AnteoPlayer(xbmc.Player):
|
||||||
|
|
||||||
player = xbmc.Player()
|
player = xbmc.Player()
|
||||||
player.play(url, listitem)
|
player.play(url, listitem)
|
||||||
xbmc.sleep(1000)
|
|
||||||
if subtitles:
|
|
||||||
player.setSubtitles(subtitles.url)
|
|
||||||
|
|
||||||
xbmc.sleep(2000) # very important, do not edit this, podavan
|
xbmc.sleep(2000) # very important, do not edit this, podavan
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def setup_subs(self):
|
||||||
|
if self.subs_dl:
|
||||||
|
file_status = self.engine.file_status(self.contentId)
|
||||||
|
subs = []
|
||||||
|
filename = os.path.basename(file_status.name)
|
||||||
|
sub_files = self.engine.list(media_types=[MediaType.SUBTITLES])
|
||||||
|
for i in sub_files:
|
||||||
|
if isSubtitle(filename, i.name):
|
||||||
|
subs.append(i)
|
||||||
|
if subs:
|
||||||
|
log("[AnteoPlayer][setup_subs]: Detected subtitles: %s" % str(subs))
|
||||||
|
for sub in subs:
|
||||||
|
xbmc.Player().setSubtitles(sub.url)
|
||||||
|
|
||||||
def loop(self):
|
def loop(self):
|
||||||
debug_counter=0
|
debug_counter=0
|
||||||
xbmc.sleep(1000)
|
xbmc.sleep(1000)
|
||||||
|
|
Loading…
Reference in New Issue