mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
fix m3u
This commit is contained in:
@@ -3,6 +3,7 @@ package helpers
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"server/settings"
|
"server/settings"
|
||||||
"server/torr"
|
"server/torr"
|
||||||
@@ -13,7 +14,7 @@ func MakeM3ULists(torrents []*settings.Torrent, host string) string {
|
|||||||
m3u := "#EXTM3U\n"
|
m3u := "#EXTM3U\n"
|
||||||
|
|
||||||
for _, t := range torrents {
|
for _, t := range torrents {
|
||||||
m3u += "#EXTINF:0 type=\"playlist\", " + t.Name + "\n"
|
m3u += "#EXTINF:-1 type=\"playlist\", " + t.Name + "\n"
|
||||||
m3u += host + "/torrent/play?link=" + url.QueryEscape(t.Magnet) + "&m3u=true&fname=" + utils.CleanFName(t.Name+".m3u") + "\n\n"
|
m3u += host + "/torrent/play?link=" + url.QueryEscape(t.Magnet) + "&m3u=true&fname=" + utils.CleanFName(t.Name+".m3u") + "\n\n"
|
||||||
}
|
}
|
||||||
return m3u
|
return m3u
|
||||||
@@ -24,7 +25,11 @@ func MakeM3UPlayList(tor torr.TorrentStats, magnet string, host string) string {
|
|||||||
|
|
||||||
for _, f := range tor.FileStats {
|
for _, f := range tor.FileStats {
|
||||||
if GetMimeType(f.Path) != "*/*" {
|
if GetMimeType(f.Path) != "*/*" {
|
||||||
m3u += "#EXTINF:-1, " + f.Path + "\n"
|
fn := filepath.Base(f.Path)
|
||||||
|
if fn == "" {
|
||||||
|
fn = f.Path
|
||||||
|
}
|
||||||
|
m3u += "#EXTINF:-1, " + fn + "\n"
|
||||||
mag := url.QueryEscape(magnet)
|
mag := url.QueryEscape(magnet)
|
||||||
m3u += host + "/torrent/play?link=" + mag + "&file=" + fmt.Sprint(f.Id) + "\n\n"
|
m3u += host + "/torrent/play?link=" + mag + "&file=" + fmt.Sprint(f.Id) + "\n\n"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user