mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
reformat
This commit is contained in:
@@ -2,9 +2,9 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
sets "server/settings"
|
sets "server/settings"
|
||||||
"server/torr"
|
"server/torr"
|
||||||
@@ -150,13 +150,13 @@ func msxPlaylist(c *gin.Context) {
|
|||||||
host := utils.GetScheme(c) + "://" + c.Request.Host
|
host := utils.GetScheme(c) + "://" + c.Request.Host
|
||||||
status := tor.Status()
|
status := tor.Status()
|
||||||
viewed := sets.ListViewed(hash)
|
viewed := sets.ListViewed(hash)
|
||||||
list := []msxItem{}
|
var list []msxItem
|
||||||
|
|
||||||
for _, f := range status.FileStats {
|
for _, f := range status.FileStats {
|
||||||
mime := utils.GetMimeType(f.Path)
|
mime := utils.GetMimeType(f.Path)
|
||||||
action := mime[0 : len(mime)-2]
|
action := mime[0 : len(mime)-2]
|
||||||
|
|
||||||
if (action == "*") {
|
if action == "*" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
name := filepath.Base(f.Path)
|
name := filepath.Base(f.Path)
|
||||||
@@ -165,16 +165,16 @@ func msxPlaylist(c *gin.Context) {
|
|||||||
PlayerLabel: strings.TrimSuffix(name, filepath.Ext(name)),
|
PlayerLabel: strings.TrimSuffix(name, filepath.Ext(name)),
|
||||||
Action: action + ":" + host + "/stream/" + url.PathEscape(name) + "?link=" + hash + "&index=" + fmt.Sprint(f.Id) + "&play",
|
Action: action + ":" + host + "/stream/" + url.PathEscape(name) + "?link=" + hash + "&index=" + fmt.Sprint(f.Id) + "&play",
|
||||||
}
|
}
|
||||||
if (isViewed(viewed, f.Id)) {
|
if isViewed(viewed, f.Id) {
|
||||||
item.Tag = " "
|
item.Tag = " "
|
||||||
}
|
}
|
||||||
if (action == "audio") {
|
if action == "audio" {
|
||||||
item.Icon = "msx-white-soft:music-note"
|
item.Icon = "msx-white-soft:music-note"
|
||||||
}
|
}
|
||||||
list = append(list, item)
|
list = append(list, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len(list) == 0) {
|
if len(list) == 0 {
|
||||||
c.JSON(200, msxData{
|
c.JSON(200, msxData{
|
||||||
Action: "error:No supported content found",
|
Action: "error:No supported content found",
|
||||||
})
|
})
|
||||||
@@ -206,7 +206,7 @@ func msxPlaylist(c *gin.Context) {
|
|||||||
|
|
||||||
func isViewed(viewed []*sets.Viewed, id int) bool {
|
func isViewed(viewed []*sets.Viewed, id int) bool {
|
||||||
for _, v := range viewed {
|
for _, v := range viewed {
|
||||||
if (v.FileIndex == id) {
|
if v.FileIndex == id {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user