mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Add category associated to each torrent
This commit is contained in:
@@ -55,7 +55,7 @@ func play(c *gin.Context) {
|
||||
}
|
||||
|
||||
if tor.Stat == state.TorrentInDB {
|
||||
tor, err = torr.AddTorrent(spec, tor.Title, tor.Poster, tor.Data)
|
||||
tor, err = torr.AddTorrent(spec, tor.Title, tor.Poster, tor.Data, tor.Category)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
|
||||
@@ -96,7 +96,7 @@ func stream(c *gin.Context) {
|
||||
data = tor.Data
|
||||
}
|
||||
if tor == nil || tor.Stat == state.TorrentInDB {
|
||||
tor, err = torr.AddTorrent(spec, title, poster, data)
|
||||
tor, err = torr.AddTorrent(spec, title, poster, data, tor.Category)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
@@ -170,6 +170,7 @@ func streamNoAuth(c *gin.Context) {
|
||||
title := c.Query("title")
|
||||
poster := c.Query("poster")
|
||||
data := ""
|
||||
category := c.Query("category")
|
||||
|
||||
if link == "" {
|
||||
c.AbortWithError(http.StatusBadRequest, errors.New("link should not be empty"))
|
||||
@@ -194,9 +195,10 @@ func streamNoAuth(c *gin.Context) {
|
||||
title = tor.Title
|
||||
poster = tor.Poster
|
||||
data = tor.Data
|
||||
category = tor.Category
|
||||
|
||||
if tor.Stat == state.TorrentInDB {
|
||||
tor, err = torr.AddTorrent(spec, title, poster, data)
|
||||
tor, err = torr.AddTorrent(spec, title, poster, data, category)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
return
|
||||
|
||||
@@ -21,6 +21,7 @@ type torrReqJS struct {
|
||||
Link string `json:"link,omitempty"`
|
||||
Hash string `json:"hash,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Category string `json:"category,omitempty"`
|
||||
Poster string `json:"poster,omitempty"`
|
||||
Data string `json:"data,omitempty"`
|
||||
SaveToDB bool `json:"save_to_db,omitempty"`
|
||||
@@ -90,7 +91,10 @@ func addTorrent(req torrReqJS, c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
tor, err := torr.AddTorrent(torrSpec, req.Title, req.Poster, req.Data)
|
||||
tor, err := torr.AddTorrent(torrSpec, req.Title, req.Poster, req.Data, req.Category)
|
||||
|
||||
log.TLogln("Final torrent category: ", tor.Category)
|
||||
|
||||
if err != nil {
|
||||
log.TLogln("error add torrent:", err)
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
// @Param file formData file true "Torrent file to insert"
|
||||
// @Param save formData string false "Save to DB"
|
||||
// @Param title formData string false "Torrent title"
|
||||
// @Param category formData string false "Torrent category"
|
||||
// @Param poster formData string false "Torrent poster"
|
||||
// @Param data formData string false "Torrent data"
|
||||
//
|
||||
@@ -41,6 +42,10 @@ func torrentUpload(c *gin.Context) {
|
||||
if len(form.Value["title"]) > 0 {
|
||||
title = form.Value["title"][0]
|
||||
}
|
||||
category := ""
|
||||
if len(form.Value["category"]) > 0 {
|
||||
category = form.Value["category"][0]
|
||||
}
|
||||
poster := ""
|
||||
if len(form.Value["poster"]) > 0 {
|
||||
poster = form.Value["poster"][0]
|
||||
@@ -66,7 +71,7 @@ func torrentUpload(c *gin.Context) {
|
||||
continue
|
||||
}
|
||||
|
||||
tor, err = torr.AddTorrent(spec, title, poster, data)
|
||||
tor, err = torr.AddTorrent(spec, title, poster, data, category)
|
||||
if err != nil {
|
||||
log.TLogln("error upload torrent:", err)
|
||||
continue
|
||||
|
||||
@@ -118,20 +118,20 @@ var Mstile150x150png []byte
|
||||
//go:embed pages/site.webmanifest
|
||||
var Sitewebmanifest []byte
|
||||
|
||||
//go:embed pages/static/js/2.56a11991.chunk.js
|
||||
var Staticjs256a11991chunkjs []byte
|
||||
//go:embed pages/static/js/2.41a752aa.chunk.js
|
||||
var Staticjs241a752aachunkjs []byte
|
||||
|
||||
//go:embed pages/static/js/2.56a11991.chunk.js.LICENSE.txt
|
||||
var Staticjs256a11991chunkjsLICENSEtxt []byte
|
||||
//go:embed pages/static/js/2.41a752aa.chunk.js.LICENSE.txt
|
||||
var Staticjs241a752aachunkjsLICENSEtxt []byte
|
||||
|
||||
//go:embed pages/static/js/2.56a11991.chunk.js.map
|
||||
var Staticjs256a11991chunkjsmap []byte
|
||||
//go:embed pages/static/js/2.41a752aa.chunk.js.map
|
||||
var Staticjs241a752aachunkjsmap []byte
|
||||
|
||||
//go:embed pages/static/js/main.5883b760.chunk.js
|
||||
var Staticjsmain5883b760chunkjs []byte
|
||||
//go:embed pages/static/js/main.b1d76117.chunk.js
|
||||
var Staticjsmainb1d76117chunkjs []byte
|
||||
|
||||
//go:embed pages/static/js/main.5883b760.chunk.js.map
|
||||
var Staticjsmain5883b760chunkjsmap []byte
|
||||
//go:embed pages/static/js/main.b1d76117.chunk.js.map
|
||||
var Staticjsmainb1d76117chunkjsmap []byte
|
||||
|
||||
//go:embed pages/static/js/runtime-main.f542387e.js
|
||||
var Staticjsruntimemainf542387ejs []byte
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"files": {
|
||||
"main.js": "/static/js/main.5883b760.chunk.js",
|
||||
"main.js.map": "/static/js/main.5883b760.chunk.js.map",
|
||||
"main.js": "/static/js/main.b1d76117.chunk.js",
|
||||
"main.js.map": "/static/js/main.b1d76117.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.f542387e.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.f542387e.js.map",
|
||||
"static/js/2.56a11991.chunk.js": "/static/js/2.56a11991.chunk.js",
|
||||
"static/js/2.56a11991.chunk.js.map": "/static/js/2.56a11991.chunk.js.map",
|
||||
"static/js/2.41a752aa.chunk.js": "/static/js/2.41a752aa.chunk.js",
|
||||
"static/js/2.41a752aa.chunk.js.map": "/static/js/2.41a752aa.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"static/js/2.56a11991.chunk.js.LICENSE.txt": "/static/js/2.56a11991.chunk.js.LICENSE.txt"
|
||||
"static/js/2.41a752aa.chunk.js.LICENSE.txt": "/static/js/2.41a752aa.chunk.js.LICENSE.txt"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.f542387e.js",
|
||||
"static/js/2.56a11991.chunk.js",
|
||||
"static/js/main.5883b760.chunk.js"
|
||||
"static/js/2.41a752aa.chunk.js",
|
||||
"static/js/main.b1d76117.chunk.js"
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -118,7 +118,7 @@ func RouteWebPages(route *gin.RouterGroup) {
|
||||
})
|
||||
|
||||
route.GET("/browserconfig.xml", func(c *gin.Context) {
|
||||
c.Data(200, "application/xml; charset=utf-8", Browserconfigxml)
|
||||
c.Data(200, "text/xml; charset=utf-8", Browserconfigxml)
|
||||
})
|
||||
|
||||
route.GET("/dlnaicon-120.png", func(c *gin.Context) {
|
||||
@@ -161,28 +161,28 @@ func RouteWebPages(route *gin.RouterGroup) {
|
||||
c.Data(200, "application/manifest+json", Sitewebmanifest)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.56a11991.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjs256a11991chunkjs)
|
||||
route.GET("/static/js/2.41a752aa.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "text/javascript; charset=utf-8", Staticjs241a752aachunkjs)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.56a11991.chunk.js.LICENSE.txt", func(c *gin.Context) {
|
||||
c.Data(200, "text/plain; charset=utf-8", Staticjs256a11991chunkjsLICENSEtxt)
|
||||
route.GET("/static/js/2.41a752aa.chunk.js.LICENSE.txt", func(c *gin.Context) {
|
||||
c.Data(200, "text/plain; charset=utf-8", Staticjs241a752aachunkjsLICENSEtxt)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.56a11991.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjs256a11991chunkjsmap)
|
||||
route.GET("/static/js/2.41a752aa.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjs241a752aachunkjsmap)
|
||||
})
|
||||
|
||||
route.GET("/static/js/main.5883b760.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjsmain5883b760chunkjs)
|
||||
route.GET("/static/js/main.b1d76117.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "text/javascript; charset=utf-8", Staticjsmainb1d76117chunkjs)
|
||||
})
|
||||
|
||||
route.GET("/static/js/main.5883b760.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjsmain5883b760chunkjsmap)
|
||||
route.GET("/static/js/main.b1d76117.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjsmainb1d76117chunkjsmap)
|
||||
})
|
||||
|
||||
route.GET("/static/js/runtime-main.f542387e.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjsruntimemainf542387ejs)
|
||||
c.Data(200, "text/javascript; charset=utf-8", Staticjsruntimemainf542387ejs)
|
||||
})
|
||||
|
||||
route.GET("/static/js/runtime-main.f542387e.js.map", func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user