Restore thetvdb functionality following site changes

This commit is contained in:
HummyPkg 2019-11-27 15:51:43 +00:00
parent 38aca0d740
commit f77d11f3fc
4 changed files with 40 additions and 43 deletions
CONTROL
webif
html/browse/tvdb
lib

@ -1,10 +1,10 @@
Package: webif Package: webif
Priority: optional Priority: optional
Section: web Section: web
Version: 1.4.6 Version: 1.4.7
Architecture: mipsel Architecture: mipsel
Maintainer: af123@hpkg.tv Maintainer: af123@hpkg.tv
Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.78-1),jim-oo(>=0.77),jim-sqlite3(>=0.77),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.12-1),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv Depends: tcpfix,webif-channelicons(>=1.1.27),lighttpd(>=1.4.39-1),jim(>=0.79),jim-pack(>=0.79),jim-oo(>=0.77),jim-sqlite3(>=0.77),jim-cgi(>=0.7-1),jim-binary(>=0.76),service-control(>=2.3),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.8),hmt(>=2.0.10),ssmtp,cron-daemon(>=1.18.3-3),at(>=3.1.18),anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.1.12-1),webif-charts(>=1.2-1),stripts(>=1.4.2),tmenu(>=1.21-2),ffmpeg(>=2.8),id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7),hwctl,nugget(>=0.98),sqlite3(>=3.15.1),jim-xconv,zip(>=3.0-1)
Suggests: Suggests:
Description: An evolving web interface for the Humax. Description: An evolving web interface for the Humax.
Tags: https://hummy.tv/forum/threads/7712/ Tags: https://hummy.tv/forum/threads/7712/

@ -14,7 +14,7 @@ div.tvdbsynopsis
img.tvdbbanner img.tvdbbanner
{ {
height: 30px; height: 50px;
vertical-align: middle; vertical-align: middle;
} }

Binary file not shown.

@ -7,6 +7,7 @@ require system.class xml.class
set ::tvdb::apikey 1764335F804A5A91 set ::tvdb::apikey 1764335F804A5A91
set ::tvdb::mirror "thetvdb.com" set ::tvdb::mirror "thetvdb.com"
set ::tvdb::artwork "artworks.thetvdb.com"
set ::tvdb::cache "/mod/var/tvdb" set ::tvdb::cache "/mod/var/tvdb"
set ::tvdb::icache "/mod/webif/cache/tvdb/img" set ::tvdb::icache "/mod/webif/cache/tvdb/img"
set ::tvdb::cacheage 86400 set ::tvdb::cacheage 86400
@ -51,23 +52,35 @@ tvdb method setseries {sid} {
set seriesid $sid set seriesid $sid
} }
tvdb method _fetch {url} { #tvdb method _fetch {url} {
set f [socket stream "${::tvdb::mirror}:80"] # set f [socket stream "${::tvdb::mirror}:443"]
$f puts -nonewline "GET $url HTTP/1.0\r\n" # $f ssl
$f puts -nonewline "Host: $::tvdb::mirror\r\n" # $f puts -nonewline "GET $url HTTP/1.1\r\n"
$f puts -nonewline "Connection: close\r\n" # $f puts -nonewline "Host: $::tvdb::mirror\r\n"
$f puts -nonewline "\r\n" # $f puts -nonewline "Connection: close\r\n"
# $f puts -nonewline "\r\n"
#
# set line [string trim [$f gets]]
# while {[string length $line]} {
# #puts "Web Header: $line"
# set line [string trim [$f gets]]
# }
#
# # Save the body
# set ret [$f read]
# $f close
# return $ret
#}
set line [string trim [$f gets]] proc {tvdb fetchfile} {url} {
while {[string length $line]} { set cmd {wget -q -4 -O-}
#puts "Web Header: $line" lappend cmd $url
set line [string trim [$f gets]] ::tvdb::dlog "Executing $cmd"
} return [exec {*}$cmd]
}
# Save the body tvdb method _fetch {path} {
set ret [$f read] return [tvdb fetchfile "https://$::tvdb::mirror$path"]
$f close
return $ret
} }
tvdb method _parse {xml vars {end "XX"}} { tvdb method _parse {xml vars {end "XX"}} {
@ -157,7 +170,7 @@ tvdb method fetchseries {} {
puts $f [$self _fetch \ puts $f [$self _fetch \
"/api/$::tvdb::apikey/series/$seriesid/all/en.zip"] "/api/$::tvdb::apikey/series/$seriesid/all/en.zip"]
$f close $f close
catch {exec unzip -o -q "$base.zip" en.xml -d $::tvdb::cache} catch {exec /mod/bin/unzip -o -q "$base.zip" en.xml -d $::tvdb::cache}
if {[file exists "$::tvdb::cache/en.xml"]} { if {[file exists "$::tvdb::cache/en.xml"]} {
file rename "$::tvdb::cache/en.xml" $base.xml file rename "$::tvdb::cache/en.xml" $base.xml
# Extract episode info # Extract episode info
@ -388,30 +401,14 @@ proc {tvdb series} {series {sid 0}} {
return $t return $t
} }
proc {tvdb fetchfile} {url} {
set f [socket stream "${::tvdb::mirror}:80"]
$f puts -nonewline "GET $url HTTP/1.0\r\n"
$f puts -nonewline "Host: $::tvdb::mirror\r\n"
$f puts -nonewline "Connection: close\r\n"
$f puts -nonewline "\r\n"
# Skip headers in the response.
set line [string trim [$f gets]]
while {[string length $line]} {
#puts "Web Header: $line"
set line [string trim [$f gets]]
}
# Save the body
set ret [$f read]
$f close
return $ret
}
proc {tvdb cachebanner} {banner} { proc {tvdb cachebanner} {banner} {
if {![string match {/banners/*} $banner]} {
set _banner "/banners/$banner"
} else {
set _banner $banner
}
if {![file exists "$::tvdb::icache/$banner"]} { if {![file exists "$::tvdb::icache/$banner"]} {
set ret [tvdb fetchfile \ set ret [tvdb fetchfile "https://$::tvdb::artwork$_banner"]
"http://$::tvdb::mirror/banners/$banner"]
if {[string length $ret] > 50} { if {[string length $ret] > 50} {
system mkdir_p "$::tvdb::icache/[file dirname $banner]" system mkdir_p "$::tvdb::icache/[file dirname $banner]"
file write "$::tvdb::icache/$banner" $ret file write "$::tvdb::icache/$banner" $ret
@ -424,6 +421,6 @@ proc {tvdb bannerurl} {banner} {
} }
proc {tvdb seriesurl} {seriesid} { proc {tvdb seriesurl} {seriesid} {
return "http://$::tvdb::mirror/?tab=series&id=$seriesid" return "https://$::tvdb::mirror/?tab=series&id=$seriesid"
} }