Compare commits
2 Commits
d8a4bfd6f3
...
d4836c1d95
Author | SHA1 | Date | |
---|---|---|---|
d4836c1d95 | |||
e810c7d9a6 |
@ -26,6 +26,7 @@ func LoadBooks() ([]Book, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ProcessBooks(books []Book, update bool) error {
|
func ProcessBooks(books []Book, update bool) error {
|
||||||
|
utils.Sep()
|
||||||
fmt.Printf(" B O O K S\n")
|
fmt.Printf(" B O O K S\n")
|
||||||
utils.Sep()
|
utils.Sep()
|
||||||
for _, book := range books {
|
for _, book := range books {
|
||||||
|
@ -26,12 +26,12 @@ func LoadMovies() ([]Movie, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ProcessMovies(movies []Movie, update bool) error {
|
func ProcessMovies(movies []Movie, update bool) error {
|
||||||
|
utils.Sep()
|
||||||
fmt.Printf(" M O V I E S\n")
|
fmt.Printf(" M O V I E S\n")
|
||||||
utils.Sep()
|
utils.Sep()
|
||||||
for _, movie := range movies {
|
for _, movie := range movies {
|
||||||
// Debug print
|
// Debug print
|
||||||
fmt.Printf("Título: %s, Puntuación: %.1f, Fecha: %s\n",
|
fmt.Printf("Título: %s\n", movie.Title)
|
||||||
movie.Title, movie.Rate, movie.Date)
|
|
||||||
|
|
||||||
// If we're updating, the process is a bit different
|
// If we're updating, the process is a bit different
|
||||||
if update || !movie.New {
|
if update || !movie.New {
|
||||||
@ -126,6 +126,7 @@ func generateMovieMarkdown(movie Movie) error {
|
|||||||
"Subtitle": movie.Year,
|
"Subtitle": movie.Year,
|
||||||
"Year": movie.Year,
|
"Year": movie.Year,
|
||||||
"Rate": movie.Rate,
|
"Rate": movie.Rate,
|
||||||
|
"Progress": movie.Progress,
|
||||||
"Image": movie.Image,
|
"Image": movie.Image,
|
||||||
"Poster": movie.Poster,
|
"Poster": movie.Poster,
|
||||||
"Background": movie.Background,
|
"Background": movie.Background,
|
||||||
@ -138,6 +139,7 @@ func generateMovieMarkdown(movie Movie) error {
|
|||||||
|
|
||||||
// Helper function to update only YAML fields that exist in both the frontmatter and YAML data
|
// Helper function to update only YAML fields that exist in both the frontmatter and YAML data
|
||||||
func updateFrontmatterWithYAML(frontmatter utils.FrontMatter, movie Movie) utils.FrontMatter {
|
func updateFrontmatterWithYAML(frontmatter utils.FrontMatter, movie Movie) utils.FrontMatter {
|
||||||
|
frontmatter.Progress = movie.Progress
|
||||||
frontmatter.Date = movie.Date
|
frontmatter.Date = movie.Date
|
||||||
frontmatter.Rate = movie.Rate
|
frontmatter.Rate = movie.Rate
|
||||||
return frontmatter
|
return frontmatter
|
||||||
|
@ -12,6 +12,7 @@ type Movie struct {
|
|||||||
Link string `yaml:"link"`
|
Link string `yaml:"link"`
|
||||||
Year int `yaml:"year"`
|
Year int `yaml:"year"`
|
||||||
Rate float64 `yaml:"rate"`
|
Rate float64 `yaml:"rate"`
|
||||||
|
Progress string `yaml:"progress"`
|
||||||
Image string `yaml:"image"`
|
Image string `yaml:"image"`
|
||||||
Poster string `yaml:"poster-image"`
|
Poster string `yaml:"poster-image"`
|
||||||
Background string `yaml:"background-image"`
|
Background string `yaml:"background-image"`
|
||||||
|
@ -26,6 +26,7 @@ func LoadAlbums() ([]Album, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ProcessAlbum(albumList []Album, update bool) error {
|
func ProcessAlbum(albumList []Album, update bool) error {
|
||||||
|
utils.Sep()
|
||||||
fmt.Printf(" M U S I C\n")
|
fmt.Printf(" M U S I C\n")
|
||||||
utils.Sep()
|
utils.Sep()
|
||||||
for _, album := range albumList {
|
for _, album := range albumList {
|
||||||
|
@ -26,12 +26,12 @@ func LoadSeries() ([]Serie, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ProcessSeries(series []Serie, update bool) error {
|
func ProcessSeries(series []Serie, update bool) error {
|
||||||
|
utils.Sep()
|
||||||
fmt.Printf(" S E R I E S\n")
|
fmt.Printf(" S E R I E S\n")
|
||||||
utils.Sep()
|
utils.Sep()
|
||||||
for _, serie := range series {
|
for _, serie := range series {
|
||||||
// Debug print
|
// Debug print
|
||||||
fmt.Printf("Título: %s, Puntuación: %.1f, Fecha: %s\n",
|
fmt.Printf("Título: %s\n", serie.Title)
|
||||||
serie.Title, serie.Rate, serie.Date)
|
|
||||||
|
|
||||||
// If we're updating, the process is a bit different
|
// If we're updating, the process is a bit different
|
||||||
if update || !serie.New {
|
if update || !serie.New {
|
||||||
|
1
main.go
1
main.go
@ -14,7 +14,6 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
// Load .env file
|
// Load .env file
|
||||||
utils.LoadConfig()
|
utils.LoadConfig()
|
||||||
utils.Sep()
|
|
||||||
|
|
||||||
// --media parameter
|
// --media parameter
|
||||||
media := flag.String("media", "", "Specify the media type to process: movies, series, books, games, or music")
|
media := flag.String("media", "", "Specify the media type to process: movies, series, books, games, or music")
|
||||||
|
@ -4,6 +4,7 @@ link: "{{ .Link }}"
|
|||||||
subtitle: "{{ .Subtitle }}"
|
subtitle: "{{ .Subtitle }}"
|
||||||
year: {{ .Year }}
|
year: {{ .Year }}
|
||||||
rate: {{ .Rate }}
|
rate: {{ .Rate }}
|
||||||
|
progress: {{ .Progress }}
|
||||||
image: {{ .Image }}
|
image: {{ .Image }}
|
||||||
poster-image: {{ .Poster }}
|
poster-image: {{ .Poster }}
|
||||||
background-image: {{ .Background }}
|
background-image: {{ .Background }}
|
||||||
|
@ -97,7 +97,7 @@ func SaveUpdatedMarkdown(filepath string, frontmatter FrontMatter, content strin
|
|||||||
fileContent := string(fileBytes)
|
fileContent := string(fileBytes)
|
||||||
|
|
||||||
fieldPatterns := map[string]string{
|
fieldPatterns := map[string]string{
|
||||||
"progress": `(?m)^progress: "(.*)%"$`,
|
"progress": `(?m)^progress: (.*)%$`,
|
||||||
"episode": `(?m)^episode: "(.*)"$`,
|
"episode": `(?m)^episode: "(.*)"$`,
|
||||||
"date": `(?m)^date: "(.*)"$`,
|
"date": `(?m)^date: "(.*)"$`,
|
||||||
"rate": `(?m)^rate: (\d+\.?\d*)$`,
|
"rate": `(?m)^rate: (\d+\.?\d*)$`,
|
||||||
|
Loading…
Reference in New Issue
Block a user