Add Og_url field to AnnuncioParsed and AnnunciDB for improved image handling
This commit is contained in:
parent
8f629c272a
commit
c0bf6f5156
2 changed files with 8 additions and 0 deletions
|
|
@ -214,6 +214,7 @@ func extractData_update(annuncio *AnnuncioXML, updateImages bool) AnnuncioParsed
|
||||||
}
|
}
|
||||||
tmpcaratt := parseCaratteristiche(annuncio)
|
tmpcaratt := parseCaratteristiche(annuncio)
|
||||||
tmp.Caratteristiche = &tmpcaratt
|
tmp.Caratteristiche = &tmpcaratt
|
||||||
|
|
||||||
if updateImages {
|
if updateImages {
|
||||||
processImages(&tmp, annuncio)
|
processImages(&tmp, annuncio)
|
||||||
}
|
}
|
||||||
|
|
@ -372,6 +373,11 @@ func processImages(tmp *AnnuncioParsed, annuncio *AnnuncioXML) {
|
||||||
if annuncio.Foto != nil {
|
if annuncio.Foto != nil {
|
||||||
fotos = *annuncio.Foto
|
fotos = *annuncio.Foto
|
||||||
}
|
}
|
||||||
|
tmp.Og_url = nil
|
||||||
|
if len(fotos) != 0 {
|
||||||
|
first := fotos[0]
|
||||||
|
tmp.Og_url = &first
|
||||||
|
}
|
||||||
for _, url := range fotos {
|
for _, url := range fotos {
|
||||||
fmt.Println("Processing image", url)
|
fmt.Println("Processing image", url)
|
||||||
imgpath := filepath.Join(path, fmt.Sprintf("%d", nfoto))
|
imgpath := filepath.Join(path, fmt.Sprintf("%d", nfoto))
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,7 @@ type AnnuncioParsed struct {
|
||||||
Url_foto *[]string
|
Url_foto *[]string
|
||||||
Url_video *[]string
|
Url_video *[]string
|
||||||
Web *bool
|
Web *bool
|
||||||
|
Og_url *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type AnnunciDB struct {
|
type AnnunciDB struct {
|
||||||
|
|
@ -310,6 +311,7 @@ type AnnunciDB struct {
|
||||||
Email *string
|
Email *string
|
||||||
Creato_il *time.Time
|
Creato_il *time.Time
|
||||||
Modificato_il *time.Time
|
Modificato_il *time.Time
|
||||||
|
Og_url *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type FilebrowserData struct {
|
type FilebrowserData struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue