-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prints out of data info
- Loading branch information
Showing
8 changed files
with
90 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package library | ||
|
||
type GameUpdatePair struct { | ||
Title string | ||
TitleID uint64 | ||
CurrentVersion uint32 | ||
LatestVersion uint32 | ||
} | ||
|
||
func (lib *Library) GetGamesNeedingUpdate() []GameUpdatePair { | ||
//For all known games in the library, find out all the games that need an update | ||
results := make([]GameUpdatePair, 0, 50) | ||
if lib.versiondb == nil || lib.FileIndex == nil { | ||
return results | ||
} | ||
for _, title := range lib.FileIndex.ListTitleFiles() { | ||
titleInfo, _ := lib.FileIndex.GetTitleRecords(title.TitleID) | ||
latest := lib.versiondb.LookupLatestVersion(title.TitleID) | ||
updateLatest := uint32(0) | ||
if titleInfo.Update != nil { | ||
updateLatest = titleInfo.Update.Version | ||
} | ||
if latest > updateLatest { | ||
results = append(results, GameUpdatePair{ | ||
Title: title.Name, | ||
TitleID: title.TitleID, | ||
CurrentVersion: updateLatest, | ||
LatestVersion: latest, | ||
}) | ||
} | ||
} | ||
|
||
return results | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package server | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
) | ||
|
||
func (server *Server) handleServingUpdatesList(respWriter http.ResponseWriter, req *http.Request) { | ||
|
||
updates := server.library.GetGamesNeedingUpdate() | ||
data, _ := json.MarshalIndent(updates, "", " ") | ||
_, _ = respWriter.Write(data) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters