[Abandoned] SPA for tracking video games.
This repository has been archived on 2022-07-05. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
James Skemp c802d5209b Added a few more video games. 2014-11-02 18:38:17 -06:00
ApiParser Fixed issue if JSON for individual PSN games gets too large. 2014-03-23 14:33:30 -05:00
SimpleWebsite Added a few more video games. 2014-11-02 18:38:17 -06:00
.gitignore Initial commit 2013-04-27 07:26:31 -07:00
LICENSE.txt Add LICENSE file via addalicense.com 2013-07-20 16:33:30 -07:00
OfflineAchievements.xml Added my offline achievements. 2013-08-11 19:54:48 -05:00
README.md Update README.md 2013-09-01 09:11:09 -05:00
VideoGamesSpa.sln Renamed API parsing library. 2013-07-20 19:41:46 -05:00

README.md

Video Games SPA

SPA (single page application) for tracking video games.

Powered by AngularJS and unofficial PlayStation Network (PSN) and Xbox Live (XBL) APIs, since there are no official ones we can use.

While I use Visual Studio for development, the goal of this project is so that anyone can drop it onto a site, after generating the data it uses.

Getting started

Open the template (/Default.html) and update/remove the Google Analytics account, as needed.

You'll also want to update the home page language, in /app/partials/home.html, but please consider leaving the link back to this GitHub project page in some way.

Generating the necessary data

After updating the template to your taste, you'll need to actually generate your own data.

First, you'll need one or more of the following wrappers.

Follow the instructions for whichever one(s) you select to pull data from the APIs.

Once you've done that you can use the included library to compile the data. An example is below:

// Setup our spa.
var spa = new Spa();
spa.SpaDirectory = @"C:\Users\James\Desktop\Video games\";
// PlayStation Network
var psnGenerator = new VideoGamesSpa.ApiParser.PsnWrapper.Generator();
psnGenerator.ApiOutputDirectory = @"C:\Users\James\Projects\GitHub\VideoGamesSpa\_output\strivinglife\psnwrapper\";
psnGenerator.XmlNameFormat = "{0}";
// Xbox Live option 1
var xblApiGenerator = new VideoGamesSpa.ApiParser.XboxApi.Generator();
xblApiGenerator.ApiOutputDirectory = @"C:\Users\James\Projects\GitHub\VideoGamesSpa\_output\strivinglife\xboxapi\";
xblApiGenerator.XmlNameFormat = "{0}";
// Optional
xblApiGenerator.HiddenAchievementsDirectory = @"C:\Users\James\Projects\GitHub\XblAchievements\";
// Optional
xblApiGenerator.OfflineAchievementsXmlPath = @"C:\Users\James\Projects\GitHub\VideoGamesSpa\OfflineAchievements.xml";
// Xbox Live option 2
var xblLeadersGenerator = new VideoGamesSpa.ApiParser.XboxLeaders.Generator();
xblLeadersGenerator.ApiOutputDirectory = @"C:\Users\James\Projects\GitHub\VideoGamesSpa\_output\strivinglife\xboxleaders\";
xblLeadersGenerator.XmlNameFormat = "{0}";
// Optional
xblLeadersGenerator.HiddenAchievementsDirectory = @"C:\Users\James\Projects\GitHub\XblAchievements\";
// Optional
xblLeadersGenerator.OfflineAchievementsXmlPath = @"C:\Users\James\Projects\GitHub\VideoGamesSpa\OfflineAchievements.xml";

// Add the following PlayStation Network generator, if applicable.
spa.Generators.Add(psnGenerator);
// Add one of the following Xbox Live generators, if applicable.
spa.Generators.Add(xblApiGenerator);
//spa.Generators.Add(xblLeadersGenerator);

spa.GenerateAll();

Additional querying

While you use the Spa object to query against, you can also parse the output files after compiling and then run any queries you'd like.

For example:

// Setup our data parser.
var spaData = new SpaData();
// Set where compiled files have been saved to.
spaData.SpaDirectory = @"C:\Users\James\Desktop\Video games\";
// Parse the XML files saved in the directory and populate the model.
spaData.LoadData();

// Example query: get all unearned achievements that are worth more than 0, but less than or equal to 20, gamerscore.
var possibleAchievements = spaData.XblAchievements
	.Where (a => !a.Earned.HasValue)
	.Select (a => new { a.Title, a.Description, a.GameTitle, Gamerscore = int.Parse(a.GamerScore) })
	.Where (a => a.Gamerscore > 0 && a.Gamerscore <= 20)
	.Dump();