fix: movie content

This commit is contained in:
Simon Ding
2024-07-16 14:41:55 +08:00
parent 81ebcb4870
commit 9dd8cb2d21
2 changed files with 6 additions and 2 deletions

View File

@@ -217,10 +217,14 @@ func (s *Server) SearchAvailableMovies(c *gin.Context) (interface{}, error) {
if len(res) == 0 { if len(res) == 0 {
return nil, fmt.Errorf("no resource found") return nil, fmt.Errorf("no resource found")
} }
ss := strings.Split(movieDetail.AirDate, "-")[0]
year, _ := strconv.Atoi(ss)
var searchResults []TorznabSearchResult var searchResults []TorznabSearchResult
for _, r := range res { for _, r := range res {
if !strings.Contains(r.Name, strconv.Itoa(year)) && !strings.Contains(r.Name, strconv.Itoa(year+1)) && !strings.Contains(r.Name, strconv.Itoa(year-1)) {
continue //not the same movie, if year is not correct
}
searchResults = append(searchResults, TorznabSearchResult{ searchResults = append(searchResults, TorznabSearchResult{
Name: r.Name, Name: r.Name,
Size: r.Size, Size: r.Size,

View File

@@ -208,7 +208,7 @@ class MovieTorrentResource
if (rsp.code != 0) { if (rsp.code != 0) {
throw rsp.message; throw rsp.message;
} }
return (resp.data as List).map((v) => TorrentResource.fromJson(v)).toList(); return (rsp.data as List).map((v) => TorrentResource.fromJson(v)).toList();
} }
Future<void> download(String link) async { Future<void> download(String link) async {