gamebanana: add function for downloading mods
kinda janky with the implementation right now, later i would like to improve the way files are copied and allow for mods with multiple downloads attached to the mod. probably split off some of the functionality later to add installing mods not on gamebanana easier.
This commit is contained in:
parent
226c6a0e93
commit
527994abba
5 changed files with 188 additions and 19 deletions
|
|
@ -29,24 +29,7 @@ type GameBananaMod struct {
|
|||
Description string `json:"description"`
|
||||
Downloads int `json:"downloads"`
|
||||
FeedbackInstructions string `json:"feedback_instructions"`
|
||||
FilesAFiles struct {
|
||||
Num884808 struct {
|
||||
IDRow string `json:"_idRow"`
|
||||
SFile string `json:"_sFile"`
|
||||
NFilesize int `json:"_nFilesize"`
|
||||
TsDateAdded int `json:"_tsDateAdded"`
|
||||
NDownloadCount int `json:"_nDownloadCount"`
|
||||
SDownloadURL string `json:"_sDownloadUrl"`
|
||||
SMd5Checksum string `json:"_sMd5Checksum"`
|
||||
SAnalysisState string `json:"_sAnalysisState"`
|
||||
SAnalysisResult string `json:"_sAnalysisResult"`
|
||||
SAnalysisResultVerbose string `json:"_sAnalysisResultVerbose"`
|
||||
SAvState string `json:"_sAvState"`
|
||||
SAvResult string `json:"_sAvResult"`
|
||||
BIsArchived bool `json:"_bIsArchived"`
|
||||
BHasContents bool `json:"_bHasContents"`
|
||||
} `json:"884808"`
|
||||
} `json:"Files().aFiles()"`
|
||||
FilesAFiles map[string]gamebananaDownloadInformation `json:"Files().aFiles()"`
|
||||
GameName string `json:"Game().name"`
|
||||
InstallInstructions string `json:"install_instructions"`
|
||||
IsObsolete string `json:"is_obsolete"`
|
||||
|
|
@ -91,6 +74,22 @@ type GameBananaMod struct {
|
|||
WithholdBIsWithheld bool `json:"Withhold().bIsWithheld()"`
|
||||
}
|
||||
|
||||
type gamebananaDownloadInformation struct {
|
||||
IDRow string `json:"_idRow"`
|
||||
SFile string `json:"_sFile"`
|
||||
NFilesize int `json:"_nFilesize"`
|
||||
TsDateAdded int `json:"_tsDateAdded"`
|
||||
NDownloadCount int `json:"_nDownloadCount"`
|
||||
SDownloadURL string `json:"_sDownloadUrl"`
|
||||
SMd5Checksum string `json:"_sMd5Checksum"`
|
||||
SAnalysisState string `json:"_sAnalysisState"`
|
||||
SAnalysisResult string `json:"_sAnalysisResult"`
|
||||
SAnalysisResultVerbose string `json:"_sAnalysisResultVerbose"`
|
||||
SAvState string `json:"_sAvState"`
|
||||
SAvResult string `json:"_sAvResult"`
|
||||
BIsArchived bool `json:"_bIsArchived"`
|
||||
BHasContents bool `json:"_bHasContents"`
|
||||
}
|
||||
|
||||
func GetGameBananaMod(id string) (GameBananaMod, error) {
|
||||
// build URL params
|
||||
|
|
@ -105,7 +104,7 @@ func GetGameBananaMod(id string) (GameBananaMod, error) {
|
|||
params.Add("itemid", id)
|
||||
params.Add("format", "json_min")
|
||||
params.Add("return_keys", "1")
|
||||
params.Add("fields", "apps_used,authors,Category().name,catid,contestid,creator,Credits().aAuthors(),Credits().aAuthorsAndGroups(),Credits().ssvAuthorNames(),date,description,downloads,feedback_instructions,Files().aFiles(),Game().name,install_instructions,is_obsolete,lastpost_date,lastpost_userid,likes,mdate,modnote,name,Nsfw().bIsNsfw(),obsol_notice,Owner().name,postcount,Posts().LastPost().idPosterRow(),Posts().LastPost().sText(),Posts().LastPost().tsDateAdded(),Posts().Postcount().nPostCount(),Preview().sStructuredDataFullsizeUrl(),Preview().sSubFeedImageUrl(),RootCategory().id,RootCategory().name,screenshots,studioid,text,Trash().bIsTrashed(),udate,Updates().aGetLatestUpdates(),Updates().aLatestUpdates(),Updates().bSubmissionHasUpdates(),Updates().nUpdatesCount(),Url().sDownloadUrl(),Url().sEditUrl(),Url().sEmbeddablesUrl(),Url().sHistoryUrl(),Url().sProfileUrl(),Url().sTrashUrl(),Url().sUntrashUrl(),Url().sUpdatesUrl(),Url().sWithholdUrl(),userid,views,Withhold().bIsWithheld()")
|
||||
params.Add("fields", "apps_used,authors,Category().name,catid,contestid,creator,Credits().ssvAuthorNames(),date,description,downloads,feedback_instructions,Files().aFiles(),Game().name,install_instructions,is_obsolete,lastpost_date,lastpost_userid,likes,mdate,modnote,name,Nsfw().bIsNsfw(),obsol_notice,Owner().name,postcount,Posts().LastPost().idPosterRow(),Posts().LastPost().sText(),Posts().LastPost().tsDateAdded(),Posts().Postcount().nPostCount(),Preview().sStructuredDataFullsizeUrl(),Preview().sSubFeedImageUrl(),RootCategory().id,RootCategory().name,screenshots,studioid,text,Trash().bIsTrashed(),udate,Updates().aGetLatestUpdates(),Updates().aLatestUpdates(),Updates().bSubmissionHasUpdates(),Updates().nUpdatesCount(),Url().sDownloadUrl(),Url().sEditUrl(),Url().sEmbeddablesUrl(),Url().sHistoryUrl(),Url().sProfileUrl(),Url().sTrashUrl(),Url().sUntrashUrl(),Url().sUpdatesUrl(),Url().sWithholdUrl(),userid,views,Withhold().bIsWithheld()")
|
||||
base.RawQuery = params.Encode()
|
||||
|
||||
// send request
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue