Skip to content

Commit 9257e9d

Browse files
committed
chore: add title param to query search in case of hash not found any subtitle
1 parent 8adadc0 commit 9257e9d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

services/opensubtitles.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ type SubtitleDownloadInfo struct {
102102

103103
var userAgent string = "Subzero CLI over Go HTTP"
104104

105+
// https://opensubtitles.stoplight.io/docs/opensubtitles-api/
106+
105107
func Search(fileInfo domain.FileInfo, key string) (SubtitleData, error) {
106108
logger := utils.GetLogger()
107109

@@ -123,6 +125,9 @@ func Search(fileInfo domain.FileInfo, key string) (SubtitleData, error) {
123125
if len(fileInfo.Year) > 0 {
124126
queryParams.Set("year", fileInfo.Year)
125127
}
128+
if fileInfo.Title != "" {
129+
queryParams.Set("query", fileInfo.Title)
130+
}
126131

127132
url := fmt.Sprintf("%s?%s", baseURL, queryParams.Encode())
128133

0 commit comments

Comments
 (0)