Refactor into client + server backends

This commit is contained in:
2023-01-04 21:34:26 -07:00
parent 2087cf2c03
commit 38127948bd
16 changed files with 361 additions and 120 deletions
+11 -2
View File
@@ -15,6 +15,15 @@ type TVShow struct {
OriginalTile string `xml:"originaltitle"`
ShowTitle string `xml:"showtitle"`
Year int `xml:"year"`
Description string `xml:"plot"`
Thumb []Thumb `xml:"thumb"`
}
type Thumb struct {
Aspect string `xml:"aspect,attr"`
Season string `xml:"season,attr"`
Type string `xml:"type,attr"`
Value string `xml:",chardata"`
}
func ScanTvshowRoot(root string, db *sql.DB) error {
@@ -31,7 +40,7 @@ func ScanTvshowRoot(root string, db *sql.DB) error {
}
defer tx.Commit()
stmt, err := tx.Prepare("insert into tvshows(title, original_title, show_title, year) values(?, ?, ?, ?)")
stmt, err := tx.Prepare("insert into tvshows(title, original_title, show_title, year, description, poster) values(?, ?, ?, ?, ?, ?)")
if err != nil {
return fmt.Errorf("Could not prepare statement: %v", err)
}
@@ -81,7 +90,7 @@ func insert_tvshow_nfo(show_dir string, stmt *sql.Stmt) bool {
log.Debugf(" Original Title: %v\n", tvshow.OriginalTile)
log.Debugf(" Show Title: %v\n", tvshow.ShowTitle)
_, err = stmt.Exec(tvshow.Title, tvshow.OriginalTile, tvshow.ShowTitle, tvshow.Year)
_, err = stmt.Exec(tvshow.Title, tvshow.OriginalTile, tvshow.ShowTitle, tvshow.Year, tvshow.Description, tvshow.Thumb[0].Value)
if err != nil {
log.Debugf("Could not insert tvshow \"%v\" into database: %v\n", tvshow.Title, err)
return false