mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-20 14:06:09 +05:00
remove long link from m3u
This commit is contained in:
@@ -15,7 +15,16 @@ func MakeM3ULists(torrents []*settings.Torrent, host string) string {
|
||||
|
||||
for _, t := range torrents {
|
||||
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"
|
||||
|
||||
magnet := t.Magnet
|
||||
mag, _, err := GetMagnet(magnet)
|
||||
if err == nil {
|
||||
mag.Trackers = []string{} //Remove retrackers for small link size
|
||||
magnet = mag.String()
|
||||
}
|
||||
magnet = url.QueryEscape(magnet)
|
||||
|
||||
m3u += host + "/torrent/play?link=" + url.QueryEscape(magnet) + "&m3u=true&fname=" + utils.CleanFName(t.Name+".m3u") + "\n\n"
|
||||
}
|
||||
return m3u
|
||||
}
|
||||
@@ -23,6 +32,13 @@ func MakeM3ULists(torrents []*settings.Torrent, host string) string {
|
||||
func MakeM3UPlayList(tor torr.TorrentStats, magnet string, host string) string {
|
||||
m3u := "#EXTM3U\n"
|
||||
|
||||
mag, _, err := GetMagnet(magnet)
|
||||
if err == nil {
|
||||
mag.Trackers = []string{} //Remove retrackers for small link size
|
||||
magnet = mag.String()
|
||||
}
|
||||
magnet = url.QueryEscape(magnet)
|
||||
|
||||
for _, f := range tor.FileStats {
|
||||
if GetMimeType(f.Path) != "*/*" {
|
||||
fn := filepath.Base(f.Path)
|
||||
@@ -30,8 +46,7 @@ func MakeM3UPlayList(tor torr.TorrentStats, magnet string, host string) string {
|
||||
fn = f.Path
|
||||
}
|
||||
m3u += "#EXTINF:-1, " + fn + "\n"
|
||||
mag := url.QueryEscape(magnet)
|
||||
m3u += host + "/torrent/play?link=" + mag + "&file=" + fmt.Sprint(f.Id) + "\n\n"
|
||||
m3u += host + "/torrent/play?link=" + magnet + "&file=" + fmt.Sprint(f.Id) + "\n\n"
|
||||
}
|
||||
}
|
||||
return m3u
|
||||
|
||||
Reference in New Issue
Block a user