Skip to content

Commit

Permalink
Merge pull request #810 from MrServo/master
Browse files Browse the repository at this point in the history
[TVSpielfilm] 7.0 youtube trailer search fixed
  • Loading branch information
mike-99 authored Sep 23, 2024
2 parents ea2415f + 03b46d2 commit 6421696
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions TVSpielfilm/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ def searchOneValue(self, regex, text, fallback, flag_S=False):
text = search(regex, text, flags=S) if flag_S else search(regex, text)
return text.group(1) if text else fallback

def checkPath(self):
def checkPath(self, session):
self.session = session
try:
if exists(TEMPPATH):
rmtree(TEMPPATH)
Expand Down Expand Up @@ -392,7 +393,7 @@ def finishedAutoTimerEdit(self, answer):
def getPics(self, picurllist, offset, show=True, playshow=False):
for idx in range(6):
try:
picurl = picurllist[offset + i]
picurl = picurllist[offset + idx]
callInThread(self.iPicDownload, picurl, idx)
if show:
self['pic%s' % idx].show()
Expand Down Expand Up @@ -1715,7 +1716,7 @@ def __init__(self, session, link, standalone=True):
'yellow': self.yellow,
'red': self.makeTimer,
'blue': self.hideScreen}, -1)
self.checkPath()
self.checkPath(self.session)
self.service_db = serviceDB(SERVICEFILE)
if exists(SERVICEFILE):
with open(SERVICEFILE, 'r') as f:
Expand Down Expand Up @@ -2149,7 +2150,7 @@ def gotoEnd(self):
end = len(self.searchentries) - 1
self['searchmenu'].moveToIndex(end)

def downloadError(self, error):
def downloadError(self, output):
self['CHANNELkey'].hide()
self['CHANNELtext'].hide()
self['BOUQUETkey'].hide()
Expand All @@ -2163,7 +2164,7 @@ def downloadError(self, error):
self['INFOtext'].setText('Jetzt/Gleich im TV')
self['INFOtext'].show()
self.ready = True
self.showDownloadError(error)
self.showDownloadError(output)

def refresh(self):
self.postviewready = False
Expand Down Expand Up @@ -2380,7 +2381,7 @@ def __init__(self, session, link, eventview, tagestipp):
'yellow': self.yellow,
'red': self.makeTimer,
'blue': self.hideScreen}, -1)
self.checkPath()
self.checkPath(self.session)
if exists(TIMERFILE):
self.timer = open(TIMERFILE).read().split('\n')
else:
Expand Down Expand Up @@ -3599,6 +3600,7 @@ def __init__(self, session, name, movie):
if movie:
name = "%s Trailer" % name
name = ensure_str(name.encode('ascii', 'xmlcharrefreplace')).replace(' ', '+')
#https://www.youtube.com/results?search_query=das+boot
self.link = 'https://www.youtube.com/results?filters=video&search_query=%s' % name
self.titel = 'YouTube Trailer Suche'
self.localposter = []
Expand Down Expand Up @@ -3647,8 +3649,8 @@ def onLayoutFinished(self):
def makeTrailerList(self, output):
output = ensure_str(output)
self.setTitle(self.titel)
startpos = output.find('class="masthead-skeleton-icon">')
endpos = output.find(';/*')
startpos = output.find('primaryContents')
endpos = output.find('a11ySkipNavigationButton')
bereich = unescape(output[startpos:endpos]).replace("­", "-")
# für Analysezwecke, wenn z.B. der YouTube-Zugang nicht ordentlich läuft
if config.plugins.tvspielfilm.debuglog.value and config.plugins.tvspielfilm.logtofile.value:
Expand Down Expand Up @@ -3876,7 +3878,7 @@ def __init__(self, session):
'green': self.green,
'blue': self.hideScreen,
'menu': self.config}, -1)
self.checkPath()
self.checkPath(self.session)
self.onShown.append(self.onShownFinished)

def onShownFinished(self):
Expand Down

0 comments on commit 6421696

Please sign in to comment.