lib/mkv2m4v/track_ranker.rb in mkv2m4v-0.1.2 vs lib/mkv2m4v/track_ranker.rb in mkv2m4v-0.2.0

- old
+ new

@@ -15,11 +15,11 @@ filtered_tracks = @tracks.select { |t| language_okay?(t) } self.class.new(filtered_tracks, @options) end def rank - ranked_tracks = @tracks.sort_by { |t| score(t) }.reverse + ranked_tracks = @tracks.sort_by { |t| -score(t) } self.class.new(ranked_tracks, @options) end protected @@ -55,10 +55,13 @@ score end end class TextRanker < TrackRanker - # scoring not implemented yet - # def score(track) - # end + def score(track) + score = 0 + score += 3 if track == first + score += 4 if language_match?(track) + score + end end end