Return the video details embedded in the torrents This requires the eventers to have the app env
31 lines
500 B
Go
31 lines
500 B
Go
package models
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// Public gobal variables
|
|
var (
|
|
PublicDir string
|
|
ImgURLPrefix string
|
|
)
|
|
|
|
// SetPublicDir sets the public dir
|
|
func SetPublicDir(s string) {
|
|
PublicDir = s
|
|
}
|
|
|
|
// SetImgURLPrefix sets the img url prefix
|
|
func SetImgURLPrefix(s string) {
|
|
ImgURLPrefix = s
|
|
}
|
|
|
|
func imageURL(suffix string) string {
|
|
imgFile := filepath.Join(PublicDir, "img", suffix)
|
|
if _, err := os.Stat(imgFile); !os.IsNotExist(err) {
|
|
return ImgURLPrefix + suffix
|
|
}
|
|
return ""
|
|
}
|