Full video file path is now saved in db
This commit is contained in:
@@ -135,7 +135,8 @@ CREATE TABLE episodes(
|
|||||||
title TEXT,
|
title TEXT,
|
||||||
show_title TEXT,
|
show_title TEXT,
|
||||||
number INTEGER,
|
number INTEGER,
|
||||||
season INTEGER
|
season INTEGER,
|
||||||
|
original_filename TEXT
|
||||||
);
|
);
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -228,11 +229,12 @@ func insert_tvshow_nfo(show_dir string, stmt *sql.Stmt) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Episode struct {
|
type Episode struct {
|
||||||
XMLName xml.Name `xml:"episodedetails"`
|
XMLName xml.Name `xml:"episodedetails"`
|
||||||
Title string `xml:"title"`
|
Title string `xml:"title"`
|
||||||
ShowTitle string `xml:"showtitle"`
|
ShowTitle string `xml:"showtitle"`
|
||||||
Season int `xml:"season"`
|
Season int `xml:"season"`
|
||||||
Episode int `xml:"episode"`
|
Episode int `xml:"episode"`
|
||||||
|
OriginalFilename string `xml:"original_filename"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func scan_tvshow_episodes(show_dir string, tx *sql.Tx) error {
|
func scan_tvshow_episodes(show_dir string, tx *sql.Tx) error {
|
||||||
@@ -246,7 +248,7 @@ func scan_tvshow_episodes(show_dir string, tx *sql.Tx) error {
|
|||||||
|
|
||||||
num_episodes := 0
|
num_episodes := 0
|
||||||
|
|
||||||
stmt, err := tx.Prepare("insert into episodes(title, show_title, number, season) values(?, ?, ?, ?)")
|
stmt, err := tx.Prepare("insert into episodes(title, show_title, number, season, original_filename) values(?, ?, ?, ?, ?)")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Could not prepare statement: %v", err)
|
return fmt.Errorf("Could not prepare statement: %v", err)
|
||||||
}
|
}
|
||||||
@@ -292,8 +294,11 @@ func scan_tvshow_episodes(show_dir string, tx *sql.Tx) error {
|
|||||||
log.Debugf(" Season %v\n", episode.Season)
|
log.Debugf(" Season %v\n", episode.Season)
|
||||||
log.Debugf(" Episode %v\n", episode.Episode)
|
log.Debugf(" Episode %v\n", episode.Episode)
|
||||||
log.Debugf(" Show: %v\n", episode.ShowTitle)
|
log.Debugf(" Show: %v\n", episode.ShowTitle)
|
||||||
|
log.Debugf(" Original Filename: %v\n", episode.OriginalFilename)
|
||||||
|
|
||||||
_, err = stmt.Exec(episode.Title, episode.ShowTitle, episode.Episode, episode.Season)
|
full_original_filename := filepath.Join(show_dir, episode.OriginalFilename)
|
||||||
|
|
||||||
|
_, err = stmt.Exec(episode.Title, episode.ShowTitle, episode.Episode, episode.Season, full_original_filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("Could not insert episode %v of tvshow \"%v\" into database: %v\n", episode.Episode, episode.ShowTitle, err)
|
log.Debugf("Could not insert episode %v of tvshow \"%v\" into database: %v\n", episode.Episode, episode.ShowTitle, err)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user