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 (
|
||||
"fmt"
|
||||
"strings"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
sets "server/settings"
|
||||
"server/torr"
|
||||
@@ -150,13 +150,13 @@ func msxPlaylist(c *gin.Context) {
|
||||
host := utils.GetScheme(c) + "://" + c.Request.Host
|
||||
status := tor.Status()
|
||||
viewed := sets.ListViewed(hash)
|
||||
list := []msxItem{}
|
||||
var list []msxItem
|
||||
|
||||
for _, f := range status.FileStats {
|
||||
mime := utils.GetMimeType(f.Path)
|
||||
action := mime[0 : len(mime)-2]
|
||||
|
||||
if (action == "*") {
|
||||
if action == "*" {
|
||||
continue
|
||||
}
|
||||
name := filepath.Base(f.Path)
|
||||
@@ -165,16 +165,16 @@ func msxPlaylist(c *gin.Context) {
|
||||
PlayerLabel: strings.TrimSuffix(name, filepath.Ext(name)),
|
||||
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 = " "
|
||||
}
|
||||
if (action == "audio") {
|
||||
if action == "audio" {
|
||||
item.Icon = "msx-white-soft:music-note"
|
||||
}
|
||||
list = append(list, item)
|
||||
}
|
||||
|
||||
if (len(list) == 0) {
|
||||
if len(list) == 0 {
|
||||
c.JSON(200, msxData{
|
||||
Action: "error:No supported content found",
|
||||
})
|
||||
@@ -206,7 +206,7 @@ func msxPlaylist(c *gin.Context) {
|
||||
|
||||
func isViewed(viewed []*sets.Viewed, id int) bool {
|
||||
for _, v := range viewed {
|
||||
if (v.FileIndex == id) {
|
||||
if v.FileIndex == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user