fix msx build and some changes

This commit is contained in:
YouROK
2021-09-20 17:36:17 +03:00
parent bb2993dbf4
commit c95bfa7e68
14 changed files with 83 additions and 177 deletions

12
server/web/msx/html.go Normal file
View File

@@ -0,0 +1,12 @@
package msx
import _ "embed"
//go:embed pages/tizen.html
var Msxtizenhtml []byte
//go:embed pages/tizen.js
var Msxtizenjs []byte
//go:embed pages/tvx-plugin.min.js
var Msxtvxpluginminjs []byte

View File

@@ -84,8 +84,8 @@ func msxTorrents(c *gin.Context) {
for i, tor := range torrs {
item := msxItem{
Title: tor.Title,
Image: tor.Poster,
Title: tor.Title,
Image: tor.Poster,
Action: "content:" + host + "/msx/playlist/" + url.PathEscape(tor.Title) +
"?hash=" + tor.TorrentSpec.InfoHash.HexString() + "&platform={PLATFORM}",
}
@@ -189,31 +189,31 @@ func msxPlaylist(c *gin.Context) {
Action: action + ":" + uri,
}
if (platform == "android" || platform == "firetv") {
if platform == "android" || platform == "firetv" {
item.Action = "system:tvx:launch"
item.Data = gin.H{
"id": hash + "-" + fmt.Sprint(f.Id),
"uri": uri,
"id": hash + "-" + fmt.Sprint(f.Id),
"uri": uri,
"type": mime,
}
} else if (platform == "lg") {
} else if platform == "lg" {
// TODO - custom player needed
// item.Action = "system:lg:launch:com.webos.app.mediadiscovery"
// item.Data = gin.H{
// "properties": gin.H{
// "videoList": gin.H{
// "result": [1]gin.H{
// gin.H{
// "url": uri,
// "thumbnail": tor.Poster,
// },
// },
// },
// },
// }
} else if (platform == "ios" || platform == "mac") {
//item.Action = "system:lg:launch:com.webos.app.mediadiscovery"
//item.Data = gin.H{
// "properties": gin.H{
// "videoList": gin.H{
// "result": [1]gin.H{
// gin.H{
// "url": uri,
// "thumbnail": tor.Poster,
// },
// },
// },
// },
//}
} else if platform == "ios" || platform == "mac" {
// TODO - for iOS and Mac the application must be defined in scheme but we don't know what user has installed
// item.Action = "system:tvx:launch:vlc://"+uri
item.Action = "system:tvx:launch:vlc://" + uri
}
if isViewed(viewed, f.Id) {
@@ -247,14 +247,14 @@ func msxPlaylist(c *gin.Context) {
Items: list,
}
if (platform == "tizen") {
if platform == "tizen" {
res.Template.Properties = gin.H{
"button:content:icon": "tune",
"button:content:icon": "tune",
"button:content:action": "content:request:interaction:init@" + host + "/msx/tizen.html",
}
} else if (platform == "netcast") {
} else if platform == "netcast" {
res.Template.Properties = gin.H{
"button:content:icon": "tune",
"button:content:icon": "tune",
"button:content:action": "system:netcast:menu",
}
}

View File

@@ -7,4 +7,16 @@ func SetupRoute(route *gin.RouterGroup) {
route.GET("/msx/torrents", msxTorrents)
route.GET("/msx/playlist", msxPlaylist)
route.GET("/msx/playlist/*fname", msxPlaylist)
route.GET("/msx/tizen.html", func(c *gin.Context) {
c.Data(200, "text/html; charset=utf-8", Msxtizenhtml)
})
route.GET("/msx/tizen.js", func(c *gin.Context) {
c.Data(200, "text/javascript; charset=utf-8", Msxtizenjs)
})
route.GET("/msx/tvx-plugin.min.js", func(c *gin.Context) {
c.Data(200, "text/javascript; charset=utf-8", Msxtvxpluginminjs)
})
}