// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, "license": { "name": "GPL 3.0" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/cache": { "post": { "description": "Return cache stats.", "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Return cache stats", "parameters": [ { "description": "Cache stats request", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api.cacheReqJS" } } ], "responses": { "200": { "description": "Cache stats", "schema": { "$ref": "#/definitions/state.CacheState" } } } } }, "/download/{size}": { "get": { "description": "Download the test file of given size (for speed testing purpose).", "produces": [ "application/octet-stream" ], "tags": [ "API" ], "summary": "Generates test file of given size", "parameters": [ { "type": "string", "description": "Test file size (in MB)", "name": "size", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "file" } } } } }, "/echo": { "get": { "description": "Tests whether server is alive or not", "produces": [ "text/plain" ], "tags": [ "API" ], "summary": "Tests server status", "responses": { "200": { "description": "Server version", "schema": { "type": "string" } } } } }, "/ffp/{hash}/{id}": { "get": { "description": "Gather informations using ffprobe.", "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Gather informations using ffprobe", "parameters": [ { "type": "string", "description": "Torrent hash", "name": "hash", "in": "path", "required": true }, { "type": "string", "description": "File index in torrent", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Data returned from ffprobe" } } } }, "/magnets": { "get": { "description": "Get HTML of magnet links.", "produces": [ "text/html" ], "tags": [ "Pages" ], "summary": "Get HTML of magnet links", "responses": { "200": { "description": "HTML with Magnet links" } } } }, "/play/{hash}/{id}": { "get": { "description": "Play given torrent referenced by infohash and file id.", "produces": [ "application/octet-stream" ], "tags": [ "API" ], "summary": "Play given torrent by infohash", "parameters": [ { "type": "string", "description": "Torrent infohash", "name": "hash", "in": "path", "required": true }, { "type": "string", "description": "File index in torrent", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "Torrent data" } } } }, "/playlist": { "get": { "description": "Get HTTP link of torrent in M3U list.", "produces": [ "audio/x-mpegurl" ], "tags": [ "API" ], "summary": "Get HTTP link of torrent in M3U list", "parameters": [ { "type": "string", "description": "Torrent hash", "name": "hash", "in": "query", "required": true }, { "type": "boolean", "description": "From last play file", "name": "fromlast", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "file" } } } } }, "/playlistall/all.m3u": { "get": { "description": "Retrieve all torrents and generates a bundled M3U playlist.", "produces": [ "audio/x-mpegurl" ], "tags": [ "API" ], "summary": "Get a M3U playlist with all torrents", "responses": { "200": { "description": "OK", "schema": { "type": "file" } } } } }, "/search": { "get": { "description": "Makes a rutor search.", "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Makes a rutor search", "parameters": [ { "type": "string", "description": "Rutor query", "name": "query", "in": "query", "required": true } ], "responses": { "200": { "description": "Rutor torrent search result(s)", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.TorrentDetails" } } } } } }, "/settings": { "post": { "description": "Allow to get or set server settings.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Get / Set server settings", "parameters": [ { "description": "Settings request. Available params for action: get, set, def", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api.setsReqJS" } } ], "responses": { "200": { "description": "Settings JSON or nothing. Depends on what action has been asked.", "schema": { "$ref": "#/definitions/settings.BTSets" } } } } }, "/shutdown": { "get": { "description": "Gracefully shuts down server after 1 second.", "tags": [ "API" ], "summary": "Shuts down server", "responses": { "200": { "description": "OK" } } } }, "/stat": { "get": { "description": "Show server and torrents statistics.", "produces": [ "text/plain" ], "tags": [ "Pages" ], "summary": "TorrServer Statistics", "responses": { "200": { "description": "TorrServer statistics" } } } }, "/storage/settings": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "Retrieves the current storage preferences for settings and viewed history", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Get storage configuration settings", "responses": { "200": { "description": "Storage preferences", "schema": { "type": "object", "additionalProperties": true } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "Updates the storage preferences for settings and viewed history. Requires application restart for changes to take effect.", "consumes": [ "application/json", "application/x-www-form-urlencoded" ], "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Update storage configuration settings", "parameters": [ { "description": "Storage preferences to update", "name": "request", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } }, { "enum": [ "json", "bbolt" ], "type": "string", "description": "Settings storage type", "name": "settings", "in": "formData" }, { "enum": [ "json", "bbolt" ], "type": "string", "description": "Viewed history storage type", "name": "viewed", "in": "formData" } ], "responses": { "200": { "description": "Update successful", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Invalid input data", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "401": { "description": "Unauthorized", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "403": { "description": "Read-only mode", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/stream": { "get": { "description": "Multi usage endpoint.", "produces": [ "application/octet-stream" ], "tags": [ "API" ], "summary": "Multi usage endpoint", "parameters": [ { "type": "string", "description": "Magnet/hash/link to torrent", "name": "link", "in": "query", "required": true }, { "type": "string", "description": "File index in torrent", "name": "index", "in": "query" }, { "type": "string", "description": "Should preload torrent", "name": "preload", "in": "query" }, { "type": "string", "description": "Get statistics from torrent", "name": "stat", "in": "query" }, { "type": "string", "description": "Should save torrent", "name": "save", "in": "query" }, { "type": "string", "description": "Get torrent as M3U playlist", "name": "m3u", "in": "query" }, { "type": "string", "description": "Get M3U from last played file", "name": "fromlast", "in": "query" }, { "type": "string", "description": "Start stream torrent", "name": "play", "in": "query" }, { "type": "string", "description": "Set title of torrent", "name": "title", "in": "query" }, { "type": "string", "description": "Set poster link of torrent", "name": "poster", "in": "query" }, { "type": "string", "description": "Set category of torrent, used in web: movie, tv, music, other", "name": "category", "in": "query" } ], "responses": { "200": { "description": "Data returned according to query" } } } }, "/tmdb/settings": { "get": { "description": "Get TMDB API configuration", "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Get TMDB settings", "responses": { "200": { "description": "TMDB settings", "schema": { "$ref": "#/definitions/settings.TMDBConfig" } } } } }, "/torrent/upload": { "post": { "description": "Supports multiple files. Returns array of statuses.", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Add .torrent files", "parameters": [ { "type": "file", "description": "Torrent file(s) to insert", "name": "file", "in": "formData", "required": true }, { "type": "string", "description": "Save to DB", "name": "save", "in": "formData" }, { "type": "string", "description": "Torrent title (single file only)", "name": "title", "in": "formData" }, { "type": "string", "description": "Torrent category", "name": "category", "in": "formData" }, { "type": "string", "description": "Torrent poster (single file only)", "name": "poster", "in": "formData" }, { "type": "string", "description": "Torrent data", "name": "data", "in": "formData" } ], "responses": { "200": { "description": "Torrent statuses", "schema": { "type": "array", "items": { "$ref": "#/definitions/state.TorrentStatus" } } } } } }, "/torrents": { "post": { "description": "Allow to list, add, remove, get, set, drop, wipe torrents on server. The action depends of what has been asked.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Handle torrents informations", "parameters": [ { "description": "Torrent request. Available params for action: add, get, set, rem, list, drop, wipe. link required for add, hash required for get, set, rem, drop.", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api.torrReqJS" } } ], "responses": { "200": { "description": "OK" } } } }, "/torznab/search": { "get": { "description": "Makes a torznab search.", "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Makes a torznab search", "parameters": [ { "type": "string", "description": "Torznab query", "name": "query", "in": "query", "required": true } ], "responses": { "200": { "description": "Torznab torrent search result(s)", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.TorrentDetails" } } } } } }, "/viewed": { "post": { "description": "Allow to set, list or remove viewed torrents from server.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API" ], "summary": "Set / List / Remove viewed torrents", "parameters": [ { "description": "Viewed torrent request. Available params for action: set, rem, list", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/api.viewedReqJS" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/settings.Viewed" } } } } } } }, "definitions": { "api.cacheReqJS": { "type": "object", "properties": { "action": { "type": "string" }, "hash": { "type": "string" } } }, "api.setsReqJS": { "type": "object", "properties": { "action": { "type": "string" }, "sets": { "$ref": "#/definitions/settings.BTSets" } } }, "api.torrReqJS": { "type": "object", "properties": { "action": { "type": "string" }, "category": { "type": "string" }, "data": { "type": "string" }, "filter": { "type": "string" }, "hash": { "type": "string" }, "link": { "type": "string" }, "poster": { "type": "string" }, "save_to_db": { "type": "boolean" }, "title": { "type": "string" } } }, "api.viewedReqJS": { "type": "object", "properties": { "action": { "type": "string" }, "file_index": { "type": "integer" }, "hash": { "type": "string" } } }, "models.TorrentDetails": { "type": "object", "properties": { "audioQuality": { "type": "integer" }, "categories": { "type": "string" }, "createDate": { "type": "string" }, "hash": { "type": "string" }, "imdbid": { "type": "string" }, "link": { "type": "string" }, "magnet": { "type": "string" }, "name": { "type": "string" }, "names": { "type": "array", "items": { "type": "string" } }, "peer": { "type": "integer" }, "seed": { "type": "integer" }, "size": { "type": "string" }, "title": { "type": "string" }, "tracker": { "type": "string" }, "videoQuality": { "type": "integer" }, "year": { "type": "integer" } } }, "settings.BTSets": { "type": "object", "properties": { "cacheSize": { "description": "Cache", "type": "integer", "format": "int64" }, "connectionsLimit": { "type": "integer" }, "disableDHT": { "type": "boolean" }, "disablePEX": { "type": "boolean" }, "disableTCP": { "type": "boolean" }, "disableUPNP": { "type": "boolean" }, "disableUTP": { "type": "boolean" }, "disableUpload": { "type": "boolean" }, "downloadRateLimit": { "description": "in kb, 0 - inf", "type": "integer" }, "enableDLNA": { "description": "DLNA", "type": "boolean" }, "enableDebug": { "description": "debug logs", "type": "boolean" }, "enableIPv6": { "description": "BT Config", "type": "boolean" }, "enableProxy": { "description": "P2P Proxy", "type": "boolean" }, "enableRutorSearch": { "description": "Rutor", "type": "boolean" }, "enableTorznabSearch": { "description": "Torznab", "type": "boolean" }, "forceEncrypt": { "description": "Torrent", "type": "boolean" }, "friendlyName": { "type": "string" }, "peersListenPort": { "type": "integer" }, "preloadCache": { "description": "in percent", "type": "integer" }, "proxyHosts": { "type": "array", "items": { "type": "string" } }, "readerReadAHead": { "description": "in percent, 5%-100%, [...S__X__E...] [S-E] not clean", "type": "integer" }, "removeCacheOnDrop": { "type": "boolean" }, "responsiveMode": { "description": "Reader", "type": "boolean" }, "retrackersMode": { "description": "0 - don` + "`" + `t add, 1 - add retrackers (def), 2 - remove retrackers 3 - replace retrackers", "type": "integer" }, "showFSActiveTorr": { "description": "FS", "type": "boolean" }, "sslCert": { "type": "string" }, "sslKey": { "type": "string" }, "sslPort": { "description": "HTTPS", "type": "integer" }, "storeSettingsInJson": { "description": "Storage preferences", "type": "boolean" }, "storeViewedInJson": { "type": "boolean" }, "tmdbsettings": { "description": "TMDB", "allOf": [ { "$ref": "#/definitions/settings.TMDBConfig" } ] }, "torrentDisconnectTimeout": { "description": "in seconds", "type": "integer" }, "torrentsSavePath": { "type": "string" }, "torznabUrls": { "type": "array", "items": { "$ref": "#/definitions/settings.TorznabConfig" } }, "uploadRateLimit": { "description": "in kb, 0 - inf", "type": "integer" }, "useDisk": { "description": "Disk", "type": "boolean" } } }, "settings.TMDBConfig": { "type": "object", "properties": { "apikey": { "description": "TMDB API Key", "type": "string" }, "apiurl": { "description": "Base API URL (default: https://api.themoviedb.org)", "type": "string" }, "imageURL": { "description": "Image URL (default: https://image.tmdb.org)", "type": "string" }, "imageURLRu": { "description": "Image URL for Russian users (default: https://imagetmdb.com)", "type": "string" } } }, "settings.TorznabConfig": { "type": "object", "properties": { "host": { "type": "string" }, "key": { "type": "string" }, "name": { "type": "string" } } }, "settings.Viewed": { "type": "object", "properties": { "file_index": { "type": "integer" }, "hash": { "type": "string" } } }, "state.CacheState": { "type": "object", "properties": { "capacity": { "type": "integer", "format": "int64" }, "filled": { "type": "integer", "format": "int64" }, "hash": { "type": "string" }, "pieces": { "type": "object", "additionalProperties": { "$ref": "#/definitions/state.ItemState" } }, "piecesCount": { "type": "integer" }, "piecesLength": { "type": "integer", "format": "int64" }, "readers": { "type": "array", "items": { "$ref": "#/definitions/state.ReaderState" } }, "torrent": { "$ref": "#/definitions/state.TorrentStatus" } } }, "state.ItemState": { "type": "object", "properties": { "completed": { "type": "boolean" }, "id": { "type": "integer" }, "length": { "type": "integer", "format": "int64" }, "priority": { "type": "integer" }, "size": { "type": "integer", "format": "int64" } } }, "state.ReaderState": { "type": "object", "properties": { "end": { "type": "integer" }, "reader": { "type": "integer" }, "start": { "type": "integer" } } }, "state.TorrentFileStat": { "type": "object", "properties": { "id": { "type": "integer" }, "length": { "type": "integer" }, "path": { "type": "string" } } }, "state.TorrentStat": { "type": "integer", "enum": [ 0, 1, 2, 3, 4, 5 ], "x-enum-varnames": [ "TorrentAdded", "TorrentGettingInfo", "TorrentPreload", "TorrentWorking", "TorrentClosed", "TorrentInDB" ] }, "state.TorrentStatus": { "type": "object", "properties": { "active_peers": { "type": "integer" }, "bit_rate": { "type": "string" }, "bytes_read": { "type": "integer" }, "bytes_read_data": { "type": "integer" }, "bytes_read_useful_data": { "type": "integer" }, "bytes_written": { "type": "integer" }, "bytes_written_data": { "type": "integer" }, "category": { "type": "string" }, "chunks_read": { "type": "integer" }, "chunks_read_useful": { "type": "integer" }, "chunks_read_wasted": { "type": "integer" }, "chunks_written": { "type": "integer" }, "connected_seeders": { "type": "integer" }, "data": { "type": "string" }, "download_speed": { "type": "number" }, "duration_seconds": { "type": "number" }, "file_stats": { "type": "array", "items": { "$ref": "#/definitions/state.TorrentFileStat" } }, "half_open_peers": { "type": "integer" }, "hash": { "type": "string" }, "loaded_size": { "type": "integer" }, "name": { "type": "string" }, "pending_peers": { "type": "integer" }, "pieces_dirtied_bad": { "type": "integer" }, "pieces_dirtied_good": { "type": "integer" }, "poster": { "type": "string" }, "preload_size": { "type": "integer" }, "preloaded_bytes": { "type": "integer" }, "stat": { "$ref": "#/definitions/state.TorrentStat" }, "stat_string": { "type": "string" }, "timestamp": { "type": "integer" }, "title": { "type": "string" }, "torrent_size": { "type": "integer" }, "torrs_hash": { "type": "string" }, "total_peers": { "type": "integer" }, "upload_speed": { "type": "number" } } } }, "securityDefinitions": { "BasicAuth": { "type": "basic" } }, "externalDocs": { "description": "OpenAPI", "url": "https://swagger.io/resources/open-api/" } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "{version.Version}", Host: "", BasePath: "/", Schemes: []string{}, Title: "Swagger Torrserver API", Description: "Torrent streaming server.", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }