Skip to content

Commit

Permalink
Version 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Zhang committed Nov 6, 2014
1 parent 6ddf716 commit 7b0446b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.0.5 - 11/06/2014
* Fix premature termination when downloading VOD streams with t=0
* Hide total recording time in log output when t=0
* Use forked version of m3u8 to fix EXT-X-PLAYLIST-TYPE parsing bug

1.0.4 - 12/30/2013

* Handle non-200 HTTP responses in downloadSegment()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
gohls - HTTP Live Streaming (HLS) downloader written in Golang


* Current version: **1.0.4**
* Current version: **1.0.5**
* Author: Kevin Zhang
* License: [GNU GPL version 3](http://www.gnu.org/licenses/gpl-3.0.txt)

Expand Down
16 changes: 10 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import "os"
import "time"
import "github.com/golang/groupcache/lru"
import "strings"
import "github.com/grafov/m3u8"
import "github.com/kz26/m3u8"

const VERSION = "1.0.4"
const VERSION = "1.0.5"

var USER_AGENT string

Expand Down Expand Up @@ -72,14 +72,18 @@ func downloadSegment(fn string, dlc chan *Download, recTime time.Duration) {
}
resp.Body.Close()
log.Printf("Downloaded %v\n", v.URI)
log.Printf("Recorded %v of %v\n", v.totalDuration, recTime)
if recTime != 0 {
log.Printf("Recorded %v of %v\n", v.totalDuration, recTime)
} else {
log.Printf("Recorded %v\n", v.totalDuration)
}
}
}

func getPlaylist(urlStr string, recTime time.Duration, useLocalTime bool, dlc chan *Download) {
startTime := time.Now()
var recDuration time.Duration = 0
cache := lru.New(64)
cache := lru.New(1024)
playlistUrl, err := url.Parse(urlStr)
if err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -130,7 +134,7 @@ func getPlaylist(urlStr string, recTime time.Duration, useLocalTime bool, dlc ch
}
dlc <- &Download{msURI, recDuration}
}
if recDuration != 0 && recDuration >= recTime {
if recTime != 0 && recDuration != 0 && recDuration >= recTime {
close(dlc)
return
}
Expand All @@ -156,7 +160,7 @@ func main() {
flag.Parse()

os.Stderr.Write([]byte(fmt.Sprintf("gohls %v - HTTP Live Streaming (HLS) downloader\n", VERSION)))
os.Stderr.Write([]byte("Copyright (C) 2013 Kevin Zhang. Licensed for use under the GNU GPL version 3.\n"))
os.Stderr.Write([]byte("Copyright (C) 2013-2014 Kevin Zhang. Licensed for use under the GNU GPL version 3.\n"))

if flag.NArg() < 2 {
os.Stderr.Write([]byte("Usage: gohls [-l=bool] [-t duration] [-ua user-agent] media-playlist-url output-file\n"))
Expand Down

0 comments on commit 7b0446b

Please sign in to comment.