Add category associated to each torrent

This commit is contained in:
LIAUD Corentin
2023-11-22 14:08:10 +01:00
parent 286609acec
commit 8c92856595
22 changed files with 171 additions and 70 deletions

View File

@@ -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