Fix poster URL for shows
This commit is contained in:
parent
421605bb38
commit
34305ade6c
@ -248,7 +248,7 @@ func (s *Show) GetDetails(env *web.Env, force bool) error {
|
|||||||
// GetPosterURL returns the image URL or the default image if the poster is not yet downloaded
|
// GetPosterURL returns the image URL or the default image if the poster is not yet downloaded
|
||||||
func (s *Show) GetPosterURL(env *web.Env) string {
|
func (s *Show) GetPosterURL(env *web.Env) string {
|
||||||
// Check if the movie image exists
|
// Check if the movie image exists
|
||||||
if _, err := os.Stat(s.imgURL(env, "poster")); os.IsNotExist(err) {
|
if _, err := os.Stat(s.imgFile(env, "poster")); os.IsNotExist(err) {
|
||||||
// TODO image in the config ?
|
// TODO image in the config ?
|
||||||
return "img/noimage.png"
|
return "img/noimage.png"
|
||||||
}
|
}
|
||||||
@ -273,11 +273,16 @@ func (s *Show) downloadImages(env *web.Env) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// imgFile returns the image location on disk
|
// imgFile returns the image location on disk
|
||||||
func (s *Show) imgURL(env *web.Env, imgType string) string {
|
func (s *Show) imgFile(env *web.Env, imgType string) string {
|
||||||
fileURL := fmt.Sprintf("img/shows/%s-%s.jpg", s.ImdbID, imgType)
|
fileURL := fmt.Sprintf("img/shows/%s-%s.jpg", s.ImdbID, imgType)
|
||||||
return filepath.Join(env.Config.PublicDir, fileURL)
|
return filepath.Join(env.Config.PublicDir, fileURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// imgURL returns the default image url
|
||||||
|
func (s *Show) imgURL(env *web.Env, imgType string) string {
|
||||||
|
return fmt.Sprintf("img/shows/%s-%s.jpg", s.ImdbID, imgType)
|
||||||
|
}
|
||||||
|
|
||||||
// GetDetailsAsUser like GetDetails but with User context
|
// GetDetailsAsUser like GetDetails but with User context
|
||||||
func (s *Show) GetDetailsAsUser(db *sqlx.DB, user *users.User, log *logrus.Entry) error {
|
func (s *Show) GetDetailsAsUser(db *sqlx.DB, user *users.User, log *logrus.Entry) error {
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user