add DownloadBnnlists

This commit is contained in:
Dom 2019-06-16 14:34:11 +02:00
parent f4bae2a9b8
commit 3af92fa056
1 changed files with 19 additions and 0 deletions

View File

@ -168,6 +168,25 @@ func DownloadPricelists(client *http.Client) error {
return nil return nil
} }
// DownloadBnnlists - Download both price lists. The lists are public so we do not necessarily login before downloading.
func DownloadBnnlists(client *http.Client) error {
// Download PL.BNN
r, err := client.Get("https://static.paxan.de/2016/PL.BNN")
if err != nil {
return err
}
downloadFile(("PL-" + time.Now().Format("20060102150405") + ".BNN"), r)
// Download PLF.BNN
r, err = client.Get("https://static.paxan.de/2016/PLF.BNN")
if err != nil {
return err
}
downloadFile(("PLF-" + time.Now().Format("20060102150405") + ".BNN"), r)
return nil
}
// RetrievePricelist - Downloads and converts pricelist into an array // RetrievePricelist - Downloads and converts pricelist into an array
func RetrievePricelist(client *http.Client) ([]SpricelistEntry, error) { func RetrievePricelist(client *http.Client) ([]SpricelistEntry, error) {
// Download spreisliste // Download spreisliste