/* * This file is part of goboru. (https://git.redxen.eu/caskd/goboru) * Copyright (c) 2022 Alex-David Denes * * goboru is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * goboru is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with goboru. If not, see . */ package goboru import ( "errors" "io" "net/http" "time" ) type Tags []string type Jobs uint type Page uint type Media struct { Source string MD5 string Tags []string } func (m Media) Content() (rc io.ReadCloser, err error) { if m.Source == "" { err = errors.New("This media has no content") } client := http.Client{Timeout: 0, Transport: &http.Transport{ResponseHeaderTimeout: 10 * time.Second}} var resp *http.Response if resp, err = client.Get(m.Source); err != nil { return } rc = resp.Body return }