revert: remove torrent streaming feature
This commit is contained in:
@@ -109,7 +109,15 @@ func (h *Handler) HandleAnimeDetails(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handler) HandleAPIAnimeRelations(w http.ResponseWriter, r *http.Request) {
|
||||
idStr := r.PathValue("id")
|
||||
path := r.URL.Path[len("/api/anime/"):]
|
||||
idStr := ""
|
||||
for i, c := range path {
|
||||
if c == '/' {
|
||||
idStr = path[:i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
id, _ := strconv.Atoi(idStr)
|
||||
if id <= 0 {
|
||||
http.Error(w, "invalid id", http.StatusBadRequest)
|
||||
@@ -164,29 +172,3 @@ func (h *Handler) HandleQuickSearch(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
json.NewEncoder(w).Encode(output)
|
||||
}
|
||||
|
||||
func (h *Handler) HandleAPIAnimeEpisodes(w http.ResponseWriter, r *http.Request) {
|
||||
idStr := r.PathValue("id")
|
||||
id, _ := strconv.Atoi(idStr)
|
||||
if id <= 0 {
|
||||
http.Error(w, "invalid id", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
anime, err := h.svc.GetAnime(id)
|
||||
if err != nil {
|
||||
log.Printf("anime fetch error: %v", err)
|
||||
http.Error(w, "Failed to fetch anime", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
episodes, err := h.svc.GetEpisodes(id, 1)
|
||||
if err != nil {
|
||||
log.Printf("episodes fetch error: %v", err)
|
||||
// Return empty episodes instead of error
|
||||
templates.EpisodesList(id, anime.Title, nil, anime.Episodes).Render(r.Context(), w)
|
||||
return
|
||||
}
|
||||
|
||||
templates.EpisodesList(id, anime.Title, episodes.Episodes, anime.Episodes).Render(r.Context(), w)
|
||||
}
|
||||
|
||||
@@ -51,15 +51,3 @@ func (s *Service) GetAnimeDetails(ctx context.Context, id int, userID string) (j
|
||||
func (s *Service) GetRelations(id int) []jikan.RelationEntry {
|
||||
return s.jikanClient.GetFullRelations(id)
|
||||
}
|
||||
|
||||
func (s *Service) GetEpisodes(id int, page int) (jikan.EpisodesResult, error) {
|
||||
return s.jikanClient.GetEpisodes(id, page)
|
||||
}
|
||||
|
||||
func (s *Service) GetAllEpisodes(id int) ([]jikan.Episode, error) {
|
||||
return s.jikanClient.GetAllEpisodes(id)
|
||||
}
|
||||
|
||||
func (s *Service) GetAnime(id int) (jikan.Anime, error) {
|
||||
return s.jikanClient.GetAnimeByID(id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user