-
Notifications
You must be signed in to change notification settings - Fork 1
/
image_property_urls.go
65 lines (58 loc) · 1.69 KB
/
image_property_urls.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package vangogh_local_data
import (
"github.com/arelate/southern_light/gog_integration"
"net/url"
)
func ImagePropertyUrls(imageIds []string, it ImageType) ([]*url.URL, error) {
urls := make([]*url.URL, 0, len(imageIds))
var ext string
switch it {
case Image:
fallthrough
case VerticalImage:
fallthrough
case Screenshots:
ext = gog_integration.JpgExt
}
for _, imageId := range imageIds {
if imageId == "" {
continue
}
imageUrl, err := gog_integration.ImageUrl(imageId, ext)
if err != nil {
return urls, err
}
urls = append(urls, imageUrl)
}
return urls, nil
}
//type DefaultProductUrl func(key string) *url.URL
//
//var defaultProductUrls = map[ProductType]DefaultProductUrl{
// CatalogPage: gog_integration.DefaultCatalogPageUrl,
// AccountPage: gog_integration.DefaultAccountPageUrl,
// UserWishlist: gog_integration.DefaultUserWishlistUrl,
// Details: gog_integration.DetailsUrl,
// ApiProductsV1: gog_integration.ApiProductV1Url,
// ApiProductsV2: gog_integration.ApiProductV2Url,
// Licences: gog_integration.DefaultLicencesUrl,
// OrderPage: gog_integration.DefaultOrdersPageUrl,
//
// SteamAppList: steam_integration.DefaultSteamAppListUrl,
// // steam data types typically require app level transformation of GOG.com id -> Steam AppID
// SteamAppNews: nil,
// SteamReviews: nil,
// SteamStorePage: nil,
//}
//func RemoteProductsUrl(pt ProductType) (ptUrl DefaultProductUrl, err error) {
// if !IsValidProductType(pt) {
// return nil, fmt.Errorf("vangogh_urls: no remote source for %s\n", pt)
// }
//
// ptUrl, ok := defaultProductUrls[pt]
// if !ok {
// err = fmt.Errorf("vangogh_urls: no remote source for %s\n", pt)
// }
//
// return ptUrl, err
//}