mirror of
https://gitlab.com/foxixus/neomovies-api.git
synced 2025-10-27 17:38:51 +05:00
fix: implement Lumex API with correct URL format
- Use /movie/{id} for movies
- Use /tv-series/{id}?season=X&episode=Y for TV shows
- Keep route as /players/lumex/{imdb_id}
- Add autoplay=1 parameter
- Update API documentation with season/episode params
- Keep IMDb ID in route but format URL according to Lumex API
This commit is contained in:
@@ -327,27 +327,44 @@ func getOpenAPISpecWithURL(baseURL string) *OpenAPISpec {
|
||||
},
|
||||
},
|
||||
},
|
||||
"/api/v1/players/lumex/{imdb_id}": map[string]interface{}{
|
||||
"get": map[string]interface{}{
|
||||
"summary": "Плеер Lumex",
|
||||
"description": "Получение плеера Lumex по IMDb ID",
|
||||
"tags": []string{"Players"},
|
||||
"parameters": []map[string]interface{}{
|
||||
{
|
||||
"name": "imdb_id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": map[string]string{"type": "string"},
|
||||
"description": "IMDb ID фильма",
|
||||
},
|
||||
"/api/v1/players/lumex/{imdb_id}": map[string]interface{}{
|
||||
"get": map[string]interface{}{
|
||||
"summary": "Плеер Lumex",
|
||||
"description": "Получение плеера Lumex по IMDb ID. Формат URL: /movie/{id} для фильмов, /tv-series/{id}?season=X&episode=Y для сериалов",
|
||||
"tags": []string{"Players"},
|
||||
"parameters": []map[string]interface{}{
|
||||
{
|
||||
"name": "imdb_id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": map[string]string{"type": "string"},
|
||||
"description": "IMDb ID фильма или сериала (например, tt0133093)",
|
||||
},
|
||||
"responses": map[string]interface{}{
|
||||
"200": map[string]interface{}{
|
||||
"description": "Данные плеера",
|
||||
{
|
||||
"name": "season",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": map[string]string{"type": "integer"},
|
||||
"description": "Номер сезона (для сериалов)",
|
||||
},
|
||||
{
|
||||
"name": "episode",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": map[string]string{"type": "integer"},
|
||||
"description": "Номер серии (для сериалов)",
|
||||
},
|
||||
},
|
||||
"responses": map[string]interface{}{
|
||||
"200": map[string]interface{}{
|
||||
"description": "HTML со встроенным Lumex плеером",
|
||||
"content": map[string]interface{}{
|
||||
"text/html": map[string]interface{}{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"/api/v1/players/vibix/{imdb_id}": map[string]interface{}{
|
||||
"get": map[string]interface{}{
|
||||
"summary": "Vibix плеер по IMDb ID",
|
||||
|
||||
@@ -159,17 +159,23 @@ func (h *PlayersHandler) GetLumexPlayer(w http.ResponseWriter, r *http.Request)
|
||||
|
||||
log.Printf("🎬 Lumex Query Params - Season: '%s', Episode: '%s'", season, episode)
|
||||
|
||||
playerURL := fmt.Sprintf("%s?imdb_id=%s", h.config.LumexURL, url.QueryEscape(imdbID))
|
||||
// Lumex использует формат:
|
||||
// Movie: {LUMEX_URL}/movie/{id}?autoplay=1
|
||||
// TV: {LUMEX_URL}/tv-series/{id}?season=1&episode=3&autoplay=1
|
||||
// ID может быть IMDb или числовым
|
||||
var playerURL string
|
||||
if season != "" && episode != "" {
|
||||
playerURL = fmt.Sprintf("%s&season=%s&episode=%s", playerURL, season, episode)
|
||||
log.Printf("✅ Lumex: Added season/episode params")
|
||||
// Сериал
|
||||
playerURL = fmt.Sprintf("%s/tv-series/%s?season=%s&episode=%s&autoplay=1", h.config.LumexURL, imdbID, season, episode)
|
||||
log.Printf("✅ Lumex: TV series mode with season/episode")
|
||||
} else {
|
||||
log.Printf("⚠️ Lumex: No season/episode params (movie mode)")
|
||||
// Фильм
|
||||
playerURL = fmt.Sprintf("%s/movie/%s?autoplay=1", h.config.LumexURL, imdbID)
|
||||
log.Printf("✅ Lumex: Movie mode")
|
||||
}
|
||||
log.Printf("🔗 Final Lumex URL: %s", playerURL)
|
||||
url := playerURL
|
||||
|
||||
iframe := fmt.Sprintf(`<iframe src="%s" allowfullscreen loading="lazy" style="border:none;width:100%%;height:100%%;"></iframe>`, url)
|
||||
iframe := fmt.Sprintf(`<iframe src="%s" allowfullscreen loading="lazy" style="border:none;width:100%%;height:100%%;"></iframe>`, playerURL)
|
||||
htmlDoc := fmt.Sprintf(`<!DOCTYPE html><html><head><meta charset='utf-8'/><title>Lumex Player</title><style>html,body{margin:0;height:100%%;}</style></head><body>%s</body></html>`, iframe)
|
||||
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
|
||||
Reference in New Issue
Block a user