Sync Logic
zenwong edited this page Feb 16, 2014
·
2 revisions
The client will sync the following tables to the server, and select all rows with synced column = 0
- Vids
- Tags
- VidTags
- Recommendations
{
"vids": [
{ "title": "RBD-555", "hash": "sdf987asd098fsdfsdf897" },
{ "title": "RBD-555", "hash": "sdf987asd098fsdfsdf897" }
],
"tags": [ "teacher", "milf", "amateur", "boobies" ],
"vidtags": [
{ "title": "RBD-555", "tags": "teacher,boobies,amateur" },
{ "title": "RBD-555", "tags": "milf,nurse" }
],
"recommendations": [
{ "title": "RBD-555", "recommendation": "SHKD-454" },
{ "title": "RBD-555", "recommendation": "HBAD-290" }
]
}
when server responds successfully, client will update the synced column = 1;
- check if the title is new
- if it is new, add the title to vids table & add vid to uservids table
- if it is not new, add the vid to uservids table
- insert tags into tags table
- check tag name and insert tid into vidtags table
- check recommended title and insert into recommendations title
{
"vids": [ "NHDTA-939", "SCOP-633" ],
"tags": [ "tights", "train", "cosplay", "doctor" ],
"tag_alias": [
{ "official_tag" : "tights", "alias": "leotards" },
{ "official_tag" : "train", "alias": "on.the.train" },
{ "official_tag" : "cosplay", "alias": "anime.costume" },
{ "official_tag" : "doctor", "alias": "doctors.office" }
],
"vidtags": [
{ "title": "NHDTA-939", "tags": "tights,train" },
{ "title": "SCOP-633", "tags": "doctor,nurse,cosplay" }
],
"recommendations": [
{ "title": "NHDTA-233", "recommendation": "NHDTA-939" },
{ "title": "CRS-110", "recommendation": "SCOP-633" }
]
}
Client will track new vids, tags, vidtags that are from the server, and set the remote column = 1;