2021-05-08 09:37:52 +00:00
|
|
|
package providers
|
2020-10-29 12:50:27 +00:00
|
|
|
|
2020-11-12 19:46:05 +00:00
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
2021-01-14 19:28:37 +00:00
|
|
|
"path/filepath"
|
2020-11-12 19:46:05 +00:00
|
|
|
)
|
|
|
|
|
2020-11-19 22:18:01 +00:00
|
|
|
const DatetimeFormat = "2006-01-02_15-04-05"
|
|
|
|
|
2021-05-08 09:37:52 +00:00
|
|
|
type ProviderOptions struct {
|
2021-02-16 12:28:43 +00:00
|
|
|
OutputPath *string
|
|
|
|
InputPath *string
|
|
|
|
DownloadCovers *bool
|
|
|
|
DryRun *bool
|
|
|
|
}
|
|
|
|
|
2020-10-29 12:50:27 +00:00
|
|
|
type Game struct {
|
2020-11-19 22:05:14 +00:00
|
|
|
ID string
|
2020-10-29 12:50:27 +00:00
|
|
|
Name string
|
|
|
|
Platform string
|
|
|
|
Provider string
|
|
|
|
Screenshots []Screenshot
|
2020-11-12 19:46:05 +00:00
|
|
|
Notes string
|
2021-01-05 14:19:21 +00:00
|
|
|
Cover Screenshot
|
2020-10-29 12:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Screenshot struct {
|
2020-11-12 19:46:05 +00:00
|
|
|
Path string
|
|
|
|
DestinationName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (screenshot Screenshot) GetDestinationName() string {
|
|
|
|
if screenshot.DestinationName != "" {
|
|
|
|
return screenshot.DestinationName
|
|
|
|
}
|
|
|
|
fileStat, statErr := os.Stat(screenshot.Path)
|
|
|
|
if statErr != nil {
|
|
|
|
log.Fatal(statErr)
|
|
|
|
}
|
2021-01-14 19:28:37 +00:00
|
|
|
return fileStat.ModTime().Format(DatetimeFormat) + filepath.Ext(screenshot.Path)
|
2020-10-29 12:50:27 +00:00
|
|
|
}
|