Originally reported by: The Sighter (Bitbucket: sighter, GitHub: sighter)
Alsonso said:
Hello chaps,
Apologies for the big delay on this. I hope it is not too late. These are the files you can expect to have available on the http server (not yet, but soon). Assuming www is a simplification of the real URL, you will have
www/updater/metadata.json
#!json
{
"timestamp" : "YYYY-MM-DD_Epoch",
"mods" :
[
{ "name" : "Tactical Battlefield v3.10.1", "foldername" : "@TacBF", "torrent-timestamp" : "YYYY-MM-DD_Epoch" },
{ "name" : "Community Base Addons v1.09", "foldername" : "@CBA_A3", "torrent-timestamp" : "YYYY-MM-DD_Epoch" }
],
"teamspeak" : "ts.tacbf.com",
"servers" :
[
{"name" : "Official #1", "URL" : "31.210.129.135" }
]
}
The timestamp of the metadata file is the last modification time, so you know whether something has changed if you keep that value on the user box. Epoch will be given in seconds.
The name is extracted from mod.cpp, if provided, and can be used for presentation purposes.
The folder name matches the root folder in the torrent and the folder by which the mod can be accessed via http, as in www/updater/@TacBF
www/updater/obsole-mods.json
#!json
[
{ "YYYY-MM-DD_Epoch" : [ "foldername3", "foldername4" ] },
{ "YYYY-MM-DD_Epoch" : [ "foldername1", "foldername2" ] }
]
In this file each entry os sorted chronologically by the first field, oldest first. This file can be used to tell the user some mods are no longer in used. It should be used as follows: once the metadata has been updated on the user box, take its timestamp and compare it against each of the timestamp entries in the obsolete-mods file. If found, collect all the mods from that entry and all the entries that folllow until the end of the file and ask if the user wants the updater to remove those mods only once. This way we don't have to pest the user whether they want to remove each obsolete mod everytime an update happens.
Finally, for each mod, a file that indexes every file and directory, so you can clean up after downloading the torrent, the torrent file itself named after the mod and a mirror of the mod itself, so every file is available via http
www/updater/'foldername'.index.json
#!json
[
{ "p" : "mod.cpp", "t" : "file" },
{ "p" : "addons", "t" : "dir" },
{ "p" : "addons\\ice_fps.pbo", "t" : "file" }
...
]
www/updater/'foldername'-'torrent-timestamp'.torrent
www/updater/'foldername'
where 'foldername' and 'torrent-timestamp' matches the values in www/updater/metadata.json