mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-17 12:31:03 +01:00
Compare commits
7 Commits
intern/moc
...
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
|
# no need to modify anything below
|
||||||
tool = kleingebaeck
|
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
|
archs = darwin freebsd linux windows
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
UID = root
|
UID = root
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VERSION string = "0.0.4"
|
VERSION string = "0.0.5"
|
||||||
Baseuri string = "https://www.kleinanzeigen.de"
|
Baseuri string = "https://www.kleinanzeigen.de"
|
||||||
Listuri string = "/s-bestandsliste.html"
|
Listuri string = "/s-bestandsliste.html"
|
||||||
Defaultdir string = "."
|
Defaultdir string = "."
|
||||||
|
|||||||
5
mkrel.sh
5
mkrel.sh
@@ -40,6 +40,11 @@ for D in $DIST; do
|
|||||||
os=${D/\/*/}
|
os=${D/\/*/}
|
||||||
arch=${D/*\//}
|
arch=${D/*\//}
|
||||||
binfile="releases/${tool}-${os}-${arch}-${version}"
|
binfile="releases/${tool}-${os}-${arch}-${version}"
|
||||||
|
|
||||||
|
if test "$os" = "windows"; then
|
||||||
|
binfile="${binfile}.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
tardir="${tool}-${os}-${arch}-${version}"
|
tardir="${tool}-${os}-${arch}-${version}"
|
||||||
tarfile="releases/${tool}-${os}-${arch}-${version}.tar.gz"
|
tarfile="releases/${tool}-${os}-${arch}-${version}.tar.gz"
|
||||||
set -x
|
set -x
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@@ -176,7 +177,7 @@ func ScrapeImages(dir string, ad *Ad) error {
|
|||||||
failure := make(chan string)
|
failure := make(chan string)
|
||||||
|
|
||||||
for _, imguri := range ad.Images {
|
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() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
err := Getimage(imguri, file)
|
err := Getimage(imguri, file)
|
||||||
|
|||||||
5
store.go
5
store.go
@@ -21,20 +21,21 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
tpl "text/template"
|
tpl "text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WriteAd(dir string, ad *Ad, template string) error {
|
func WriteAd(dir string, ad *Ad, template string) error {
|
||||||
// prepare output dir
|
// prepare output dir
|
||||||
dir = dir + "/" + ad.Slug
|
dir = filepath.Join(dir, ad.Slug)
|
||||||
err := Mkdir(dir)
|
err := Mkdir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// write ad file
|
// write ad file
|
||||||
listingfile := strings.Join([]string{dir, "Adlisting.txt"}, "/")
|
listingfile := filepath.Join(dir, "Adlisting.txt")
|
||||||
f, err := os.Create(listingfile)
|
f, err := os.Create(listingfile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user