Skip to content

Commit

Permalink
fix: subscene.com best match
Browse files Browse the repository at this point in the history
  • Loading branch information
tympanix committed Jun 10, 2018
1 parent 1351e3a commit 9d4a195
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions provider/subscene.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (r resultList) Best(m types.Media) (*searchResult, error) {
keyword = fmt.Sprintf("%s (%v)", movie.MovieName(), movie.Year())
} else if episode, ok := m.TypeEpisode(); ok {
season := parse.PhoneticNumber(episode.Season())
keyword = fmt.Sprintf("%s - %s Season", episode.TVShow(), season)
keyword = fmt.Sprintf("%s - %v Season", episode.TVShow(), season)
}

if keyword == "" {
Expand All @@ -186,11 +186,11 @@ func (r resultList) Best(m types.Media) (*searchResult, error) {

var result *searchResult
min := math.MaxInt32
for _, e := range r {
score := smetrics.WagnerFischer(e.Title, keyword, 1, 1, 2)
for i, e := range r {
score := smetrics.WagnerFischer(keyword, e.Title, 1, 1, 2)
if score < min {
min = score
result = &e
result = &r[i]
}
}

Expand Down Expand Up @@ -234,6 +234,8 @@ func (s *subscene) SearchSubtitles(local types.LocalMedia) (subs []types.OnlineS
return nil, err
}

log.WithField("uri", best.Path).Debug("Best match subscene.com")

url, err := url.Parse(subsceneHost)

if err != nil {
Expand Down

0 comments on commit 9d4a195

Please sign in to comment.