Skip to content

Commit

Permalink
Use strings.HasPrefix instead of regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Zhang committed Dec 25, 2013
1 parent c5806a9 commit 4a67774
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import "log"
import "os"
import "time"
import "lru" // https://github.com/golang/groupcache/blob/master/lru/lru.go
import "regexp"
import "strings"
import "github.com/grafov/m3u8"

const VERSION = "1.0.2beta"
Expand Down Expand Up @@ -96,8 +96,7 @@ func getPlaylist(urlStr string, duration time.Duration, useLocalTime bool, feed
for _, v := range mpl.Segments {
if v != nil {
var msURI string
matched, _ := regexp.Match("^http", []byte(v.URI))
if matched {
if strings.HasPrefix(v.URI, "http") {
msURI = v.URI
} else {
msUrl, err := playlistUrl.Parse(v.URI)
Expand Down

0 comments on commit 4a67774

Please sign in to comment.