mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-17 20:41:01 +01:00
Compare commits
7 Commits
generic-at
...
v0.0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
def063afe9 | ||
| f1908f02cb | |||
| 4a528ad9d1 | |||
| 5c1161f227 | |||
| bd9d8fdb2c | |||
|
|
1ee886c504 | ||
|
|
d7b13e8a9a |
2
Makefile
2
Makefile
@@ -17,7 +17,7 @@
|
||||
#
|
||||
# no need to modify anything below
|
||||
tool = kleingebaeck
|
||||
VERSION = $(shell grep VERSION main.go | head -1 | cut -d '"' -f2)
|
||||
VERSION = $(shell grep VERSION config.go | head -1 | cut -d '"' -f2)
|
||||
archs = darwin freebsd linux windows
|
||||
PREFIX = /usr/local
|
||||
UID = root
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION string = "0.0.4"
|
||||
VERSION string = "0.0.5"
|
||||
Baseuri string = "https://www.kleinanzeigen.de"
|
||||
Listuri string = "/s-bestandsliste.html"
|
||||
Defaultdir string = "."
|
||||
|
||||
5
mkrel.sh
5
mkrel.sh
@@ -40,6 +40,11 @@ for D in $DIST; do
|
||||
os=${D/\/*/}
|
||||
arch=${D/*\//}
|
||||
binfile="releases/${tool}-${os}-${arch}-${version}"
|
||||
|
||||
if test "$os" = "windows"; then
|
||||
binfile="${binfile}.exe"
|
||||
fi
|
||||
|
||||
tardir="${tool}-${os}-${arch}-${version}"
|
||||
tarfile="releases/${tool}-${os}-${arch}-${version}.tar.gz"
|
||||
set -x
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -176,7 +177,7 @@ func ScrapeImages(dir string, ad *Ad) error {
|
||||
failure := make(chan string)
|
||||
|
||||
for _, imguri := range ad.Images {
|
||||
file := fmt.Sprintf("%s/%d.jpg", dir, img)
|
||||
file := filepath.Join(dir, ad.Slug, fmt.Sprintf("%d.jpg", img))
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
err := Getimage(imguri, file)
|
||||
|
||||
5
store.go
5
store.go
@@ -21,20 +21,21 @@ import (
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
tpl "text/template"
|
||||
)
|
||||
|
||||
func WriteAd(dir string, ad *Ad, template string) error {
|
||||
// prepare output dir
|
||||
dir = dir + "/" + ad.Slug
|
||||
dir = filepath.Join(dir, ad.Slug)
|
||||
err := Mkdir(dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// write ad file
|
||||
listingfile := strings.Join([]string{dir, "Adlisting.txt"}, "/")
|
||||
listingfile := filepath.Join(dir, "Adlisting.txt")
|
||||
f, err := os.Create(listingfile)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user