Added helper functions to tmdb package

This commit is contained in:
2025-02-23 17:29:00 +11:00
parent a3e9ffb012
commit 8fa20e05c0
2 changed files with 31 additions and 1 deletions

23
tmdb/functions.go Normal file
View File

@@ -0,0 +1,23 @@
package tmdb
import (
"fmt"
"net/url"
"path"
)
func FormatRuntime(minutes int) string {
hours := minutes / 60
mins := minutes % 60
return fmt.Sprintf("%dh %02dm", hours, mins)
}
func GetPoster(image *Image, size, imgpath string) string {
base, err := url.Parse(image.SecureBaseURL)
if err != nil {
return ""
}
fullPath := path.Join(base.Path, size, imgpath)
base.Path = fullPath
return base.String()
}