Skip to content
Snippets Groups Projects
Commit 92f58dee authored by Silvan's avatar Silvan
Browse files

fix #44

parent 4d229942
No related branches found
Tags 0.2.9
No related merge requests found
CurrentVersion=0.2.8
CurrentVersion=0.2.9
Project=github.com/cnsilvan/UnblockNeteaseMusic
Path="$Project/version"
ExecName="UnblockNeteaseMusic"
......
......@@ -3,14 +3,15 @@ package config
import (
"flag"
"fmt"
"github.com/cnsilvan/UnblockNeteaseMusic/common"
"github.com/cnsilvan/UnblockNeteaseMusic/utils"
"github.com/cnsilvan/UnblockNeteaseMusic/version"
"io"
"log"
"os"
"path/filepath"
"strings"
"github.com/cnsilvan/UnblockNeteaseMusic/common"
"github.com/cnsilvan/UnblockNeteaseMusic/utils"
"github.com/cnsilvan/UnblockNeteaseMusic/version"
)
var (
......@@ -22,7 +23,7 @@ var (
LogFile = flag.String("l", "", "specify log file ,such as : \"/var/log/unblockNeteaseMusic.log\"")
Mode = flag.Int("m", 1, "specify running mode(1:hosts) ,such as : \"1\"")
V = flag.Bool("v", false, "display version info")
EndPoint = flag.Bool("e", false, "replace song url")
EndPoint = flag.Bool("e", false, "enable replace song url")
ForceBestQuality = flag.Bool("b", false, "force the best music quality")
SearchLimit = flag.Int("sl", 0, "specify the number of songs searched on other platforms(the range is 0 to 3) ,such as : \"1\"")
)
......
......@@ -194,16 +194,7 @@ func parseSongFn(key common.MapType, music common.SearchMusic) *common.Song {
result := &common.Song{}
result.Size = 0
for _, song := range songs {
//songNameKeys := utils.ParseSongNameKeyWord(song.Name)
//log.Println("songNameKeys:", strings.Join(songNameKeys, "、"))
//songNameSores := utils.CalMatchScores(searchSongName, songNameKeys)
//log.Println("songNameSores:", songNameSores)
//artistKeys := utils.ParseSingerKeyWord(song.Artist)
//log.Println("artistKeys:", strings.Join(artistKeys, "、"))
//artistsNameSores := utils.CalMatchScores(searchArtistsName, artistKeys)
//log.Println("artistsNameSores:", artistsNameSores)
//songMatchScore := songNameSores*0.6 + artistsNameSores*0.4
//song.MatchScore = songMatchScore
if song.MatchScore > result.MatchScore {
result = song
} else if song.MatchScore == result.MatchScore && song.Size > result.Size {
......@@ -226,8 +217,9 @@ func getSongFromAllSource(key common.SearchSong, ch chan *common.Song) []*common
var songs []*common.Song
sum := 0
for _, p := range providers {
pt := p
go utils.PanicWrapper(func() {
ch <- calculateSongInfo(p.ParseSong(key))
ch <- calculateSongInfo(pt.ParseSong(key))
})
sum++
}
......@@ -252,8 +244,9 @@ func SearchSongFromAllSource(key common.SearchSong) []*common.Song {
ch := make(chan []*common.Song)
sum := 0
for _, p := range providers {
pt := p
go utils.PanicWrapper(func() {
ch <- p.SearchSong(key)
ch <- pt.SearchSong(key)
})
sum++
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment