giffer

Create .gif images from sites like youtube.com
Log | Files | Refs | LICENSE

commit 510cd2851cf23032e2596b77541db2f5d5bf510c
parent 44f223ad711eb83972e3c0be46031e1bae0d81f0
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date:   Tue, 13 Nov 2018 10:31:45 +1300

[~] Hash all of the inputs.

Diffstat:
Mdownload.go | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/download.go b/download.go @@ -41,10 +41,10 @@ type Downloader struct { // Download the video from URL into Dir and return the full path to the // downloaded file. -func (dl Downloader) Download(URL string, q Quality) (string, error) { +func (dl Downloader) Download(URL string, start, end float64, q Quality) (string, error) { h := xxhash.New64() - if _, err := h.WriteString(URL); err != nil { - return "", errors.Wrap(err, "hashing URL") + if _, err := h.WriteString(fmt.Sprintf("%s_%f_%f_%s", URL, start, end, q)); err != nil { + return "", errors.Wrap(err, "hashing inputs") } hash := fmt.Sprintf("%d", h.Sum64()) dir := filepath.Join(dl.Dir, hash) @@ -65,7 +65,7 @@ func (dl Downloader) Download(URL string, q Quality) (string, error) { if err := os.MkdirAll(dir, 0755); err != nil && !os.IsExist(err) { return "", errors.Wrap(err, "preparing directories") } - tmp, err := Download(URL, q) + tmp, err := Download(URL, start, end, q) if err != nil { return "", err } @@ -146,7 +146,7 @@ func (q Quality) String() string { } // Download a video from the specified url. -func Download(videoURL string, quality Quality) (string, error) { +func Download(videoURL string, start, end float64, quality Quality) (string, error) { var ( domain string err error