-
Notifications
You must be signed in to change notification settings - Fork 6
/
entry.go
123 lines (118 loc) · 8.08 KB
/
entry.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package itunes_search
import (
"os"
"fmt"
"text/template"
)
// Entry holds iTunes track item
type Entry struct {
TrackID int64 `json:"trackId"` // Track
TrackName string `json:"trackName"`
TrackCensoredName string `json:"trackCensoredName"`
TrackViewURL string `json:"trackViewUrl"`
BundleID string `json:"bundleId"` // App bundle
ArtistID int64 `json:"artistId"` // Artist
ArtistName string `json:"artistName"`
ArtistViewURL string `json:"artistViewUrl"`
SellerName string `json:"sellerName"` // Seller
SellerURL string `json:"sellerUrl"`
PrimaryGenreID int64 `json:"primaryGenreId"` // Genre
GenreIDs []string `json:"genreIds"`
PrimaryGenreName string `json:"primaryGenreName"`
Genres []string `json:"genres"`
ArtworkURL60 string `json:"artworkUrl60"` // Icon
ArtworkURL100 string `json:"artworkUrl100"`
ArtworkURL512 string `json:"artworkUrl512"`
Price float64 `json:"price"` // Price
Currency string `json:"currency"`
FormattedPrice string `json:"formattedPrice"`
LanguageCodesISO2A []string `json:"languageCodesISO2A"` // Platform
Features []string `json:"features"`
SupportedDevices []string `json:"supportedDevices"`
MinimumOsVersion string `json:"minimumOsVersion"`
TrackContentRating string `json:"trackContentRating"`
ContentAdvisoryRating string `json:"contentAdvisoryRating"` // Rating
Advisories []string `json:"advisories"`
UserRatingCount int64 `json:"userRatingCount"` // Ranking
AverageUserRating float64 `json:"averageUserRating"`
UserRatingCountForCurrentVersion int64 `json:"userRatingCountForCurrentVersion"`
AverageUserRatingForCurrentVersion float64 `json:"averageUserRatingForCurrentVersion"`
Kind string `json:"kind"` // Type
WrapperType string `json:"wrapperType"`
ScreenshotURLs []string `json:"screenshotUrls"` // Screenshots
IpadScreenshotURLs []string `json:"ipadScreenshotUrls"`
AppletvScreenshotURLs []string `json:"appletvScreenshotUrls"`
IsGameCenterEnabled bool `json:"isGameCenterEnabled"` // Flags
IsVppDeviceBasedLicensingEnabled bool `json:"isVppDeviceBasedLicensingEnabled"`
FileSizeBytes string `json:"fileSizeBytes"` // Attribute
Version string `json:"version"`
Description string `json:"description"`
ReleaseNotes string `json:"releaseNotes"`
ReleaseDate string `json:"releaseDate"`
CurrentVersionReleaseDate string `json:"currentVersionReleaseDate"`
}
const entryTemplateStr = `
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ iTunes Track [ {{.Kind}} / {{.WrapperType}} ]
┃ {{ .TrackID }} {{.TrackName}} ({{.TrackCensoredName}})
┃ [{{.BundleID}}] {{.TrackViewURL}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Artist:
┃ {{.ArtistID}} {{.ArtistName}} {{.ArtistViewURL}}
┃ {{.SellerName}} {{.SellerURL}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Genre:
┃ {{.PrimaryGenreID}} {{.GenreIDs}}
┃ {{.PrimaryGenreName}} {{.Genres}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Icon:
┃ 60: {{.ArtworkURL60}}
┃ 100:{{.ArtworkURL100}}
┃ 512:{{.ArtworkURL512}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Price: {{.Price}} {{.Currency}} {{.FormattedPrice}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Environ:
┃ Languages: | {{.LanguageCodesISO2A}}
┃ Features: | {{.Features}}
┃ Devices: | {{.SupportedDevices}}
┃ System: | {{.MinimumOsVersion}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Rating:
┃ TrackContentRating: | {{.TrackContentRating}}
┃ ContentAdvisoryRating: | {{.ContentAdvisoryRating}}
┃ RatingReason: | {{.Advisories}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Ranking:
┃ Current: | {{.AverageUserRating}}/{{.UserRatingCount}}
┃ Historic: | {{.AverageUserRatingForCurrentVersion}}/{{.UserRatingCountForCurrentVersion}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Screenshots:
┃ URLs: {{.ScreenshotURLs}}
┃ Ipad: {{.IpadScreenshotURLs}}
┃ TV: {{.AppletvScreenshotURLs}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ GameCenter Enabled | {{.IsGameCenterEnabled}}
┃ VppDevice Enabled | {{.IsVppDeviceBasedLicensingEnabled}}
┣┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ Size | {{.FileSizeBytes}}
┃ Version | {{.Version}}
┗┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
Description:
{{.Description}}
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ReleaseNotes:
{{.ReleaseNotes}}
┏┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
┃ ReleaseDate | {{.ReleaseDate }}
┃ CurrentVersionReleaseDate | {{.CurrentVersionReleaseDate }}
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`
// iosAppTmpl is text template for printing
var entryTmpl, _ = template.New("entry").Parse(entryTemplateStr)
// Entry_Print will print human-readable entry
func (self *Entry) Print() {
if err := entryTmpl.Execute(os.Stdout, self); err != nil {
fmt.Println(err.Error())
}
return
}