06-15-2014, 03:33 PM
(This post was last modified: 06-15-2014, 03:44 PM by Dean Roddey.)
And, as of 4.4.927, the XML GW server is updated to support the new media scheme. Instead of the piecemeal downloading of metadata the clients can now download the whole database. Each repository now calculates a serial number that should only change if data that the repo driver cares about changes. This means that clients only need to download new data if it has changed, which is fairly rare. Otherwise, they can just cache the data and use it over and over. This will vastly speed up the process of accessing media and also allow XML GW based clients, as it has allowed the IV, so do much nicer, less page-oriented access to media, since it's all locally accessed now.
Just the metadata, not the media files themselves of course.
I will update the XMLGW technical document soon, but basically all of the previous media oriented messages (other than the art downloading ones) have been removed and replaced with two new ones:
So there is a query, where you pass in the moniker of the repo, and the last serial number you got, an empty one if starting from scratch. If your serial number is different from the current one, you will get back new data, else you'll just get back a 'no changes' indicator.
So the reply indicates a result of Failed, NoChanges, or NewData. If NewData then you get back a new serial number (else ignore it), and the body of the reply messages is the XML'ized database, which has been first ZLib compressed, and then Base64 encoded.
So, you will get the message body text, and Base64 decode it to a binary buffer. You'll then ZLib decompress that to another binary buffer. And that should be the UTF-8 encoded XML data which you can pass to your XML parser and parse out.
The XML format is kept reasonably compact, so reduce size. The names are short and no namespace prefixes are used. Though I may have missed a couple, any values that are just the default value are not formatted out, so that we don't pay the price for transmitting redundant data. I'll post a DTD below that you can use to both validate and to provide the non-transmitted default values, so that your parsed XML will have all of the values present. This can make it easier to on you when parsing it into whatever your own representation is.
Here is a sample of the XML. In this case movies only. There can be movies, music, or both. I've chopped down the cast and description values on the collections to keep it much shorter.
Just the metadata, not the media files themselves of course.
I will update the XMLGW technical document soon, but basically all of the previous media oriented messages (other than the art downloading ones) have been removed and replaced with two new ones:
Code:
<!ELEMENT CQCGW:QueryMediaDB EMPTY>
<!ATTLIST CQCGW:QueryMediaDB
CQCGW:DBSerialNum CDATA #REQUIRED
CQCGW:Moniker CDATA #REQUIRED>
<!ELEMENT CQCGW:MediaDBInfo (#PCDATA)>
<!ATTLIST CQCGW:MediaDBInfo
CQCGW:Result (Failed | NoChanges | NewData) #REQUIRED
CQCGW:DBSerialNum CDATA #REQUIRED>
So there is a query, where you pass in the moniker of the repo, and the last serial number you got, an empty one if starting from scratch. If your serial number is different from the current one, you will get back new data, else you'll just get back a 'no changes' indicator.
So the reply indicates a result of Failed, NoChanges, or NewData. If NewData then you get back a new serial number (else ignore it), and the body of the reply messages is the XML'ized database, which has been first ZLib compressed, and then Base64 encoded.
So, you will get the message body text, and Base64 decode it to a binary buffer. You'll then ZLib decompress that to another binary buffer. And that should be the UTF-8 encoded XML data which you can pass to your XML parser and parse out.
The XML format is kept reasonably compact, so reduce size. The names are short and no namespace prefixes are used. Though I may have missed a couple, any values that are just the default value are not formatted out, so that we don't pay the price for transmitting redundant data. I'll post a DTD below that you can use to both validate and to provide the non-transmitted default values, so that your parsed XML will have all of the values present. This can make it easier to on you when parsing it into whatever your own representation is.
Here is a sample of the XML. In this case movies only. There can be movies, music, or both. I've chopped down the cast and description values on the collections to keep it much shorter.
Code:
<MediaDB>
<Movie>
<Imgs Cnt="7">
<Img LrgPId="e1b3f5bb-f402-455c-90b3-90963c0d9f26Lrg" SmlPId="e1b3f5bb-f402-455c-90b3-90963c0d9f26Sml" Id="2" UID="e1b3f5bb-f402-455c-90b3-90963c0d9f26"></Img>
<Img LrgPId="a6dc55f1-4b4f-48d6-b34b-8cd306a6168bLrg" SmlPId="a6dc55f1-4b4f-48d6-b34b-8cd306a6168bSml" Id="3" UID="a6dc55f1-4b4f-48d6-b34b-8cd306a6168b"></Img>
<Img LrgPId="7ea80737-9d0c-466e-b858-901d2d98db69Lrg" SmlPId="7ea80737-9d0c-466e-b858-901d2d98db69Sml" Id="4" UID="7ea80737-9d0c-466e-b858-901d2d98db69"></Img>
<Img LrgPId="ea940e71-e50e-49f5-bfe6-69a1bec89691Lrg" SmlPId="ea940e71-e50e-49f5-bfe6-69a1bec89691Sml" Id="5" UID="ea940e71-e50e-49f5-bfe6-69a1bec89691"></Img>
<Img LrgPId="6804867a-780b-4766-9894-747b8ce56ab2Lrg" SmlPId="6804867a-780b-4766-9894-747b8ce56ab2Sml" Id="6" UID="6804867a-780b-4766-9894-747b8ce56ab2"></Img>
<Img LrgPId="5ca2d385-449d-484b-a9d7-e9a4827b9abcLrg" SmlPId="5ca2d385-449d-484b-a9d7-e9a4827b9abcSml" Id="7" UID="5ca2d385-449d-484b-a9d7-e9a4827b9abc"></Img>
<Img LrgPId="931379dd-4043-4a10-bf19-1cc313b20a1eLrg" SmlPId="931379dd-4043-4a10-bf19-1cc313b20a1eSml" Id="8" UID="931379dd-4043-4a10-bf19-1cc313b20a1e"></Img>
</Imgs>
<Cats Cnt="12">
<Cat Id="1" Name="All Movies" UID="ALL MOVIES"></Cat>
<Cat Id="11" Name="Martial Arts" UID="MARTIAL ARTS"></Cat>
<Cat Id="12" Name="Science-Fiction" UID="SCIENCE-FICTION"></Cat>
<Cat Id="13" Name="Action" UID="ACTION"></Cat>
<Cat Id="14" Name="Drama" UID="DRAMA"></Cat>
<Cat Id="15" Name="Comedy" UID="COMEDY"></Cat>
<Cat Id="16" Name="Romance" UID="ROMANCE"></Cat>
<Cat Id="17" Name="Suspense/Thriller" UID="SUSPENSE/THRILLER"></Cat>
<Cat Id="18" Name="Crime" UID="CRIME"></Cat>
<Cat Id="19" Name="Fantasy" UID="FANTASY"></Cat>
<Cat Id="20" Name="Foreign" UID="FOREIGN"></Cat>
<Cat Id="21" Name="Mystery" UID="MYSTERY"></Cat>
</Cats>
<Items Cnt="7">
<Item Artist="Andy Wachowski" Id="2" Name="Movie" UID="MyMvTitle-11-1"><InCats></InCats></Item>
<Item Artist="Anand Tucker" Id="3" Name="Movie" UID="MyMvTitle-21-1"><InCats></InCats></Item>
<Item Artist="George Armitage" Id="4" Name="Movie" UID="MyMvTitle-31-1"><InCats></InCats></Item>
<Item Artist="Harold Ramis" Id="5" Name="Movie" UID="MyMvTitle-41-1"><InCats></InCats></Item>
<Item Artist="Ang Lee" Id="6" Name="Movie" UID="MyMvTitle-61-1"><InCats></InCats></Item>
<Item Artist="Ron Howard" Id="7" Name="Movie" UID="MyMvTitle-71-1"><InCats></InCats></Item>
<Item Artist="Jason Reitman" Id="8" Name="Movie" UID="MyMvTitle-81-1"><InCats></InCats></Item>
</Items>
<Cols Cnt="7">
<Col Ana="N" IsPL="N" Secs="8160" Year="1999" LType="FileCol" AR="2.35:1" Artist="Andy Wachowski" Lab="Warner Bros." LAct="Keanu Reeves" Loc="\\MARY\ExtMedia1\MainMovie\10 Years\VIDEO_TS\VIDEO_TS.IFO" Fmt="DVD" Rat="R" UPC="085391163176" Id="2" ArtId="2" Name="Disc 1" UID="MyMvTitle-11"><InCats>1 11 12 13 </InCats><CItems>2 </CItems><Cast>Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving </Cast><Desc>Perception: Our day-in, day-out world is real...</Desc></Col>
<Col Ana="N" IsPL="N" Secs="6240" Year="2005" LType="FileCol" AR="2.35:1" Artist="Anand Tucker" Lab="Touchstone Pictures" LAct="Steve Martin" Loc="\\MARY\IntMedia1\MainMovie\Shop Girl\VIDEO_TS\VIDEO_TS.IFO" Fmt="DVD" Rat="R" UPC="786936282986" Id="3" ArtId="3" Name="Disc 1" UID="MyMvTitle-21"><InCats>1 14 15 16 </InCats><CItems>3 </CItems><Cast>Steve Martin, Claire Danes, Jason Schwartzman</Cast><Desc>Based on Steve Martin's best-selling novella...</Desc></Col>
<Col Ana="N" IsPL="N" Secs="6420" Year="1997" LType="FileCol" AR="1.85:1" Artist="George Armitage" Lab="Caravan Pictures" LAct="John Cusack" Loc="\\MARY\IntMedia1\MainMovie\Gross Pointe Blank\VIDEO_TS\VIDEO_TS.IFO" Fmt="DVD" Rat="R" UPC="717951000408" Id="4" ArtId="4" Name="Disc 1 Grosse Pointe Blank" UID="MyMvTitle-31"><InCats>1 17 18 15 16 </InCats><CItems>4 </CItems><Cast>John Cusack, Minnie Driver</Cast><Desc>Here's the killer comedy hit ...</Desc></Col>
<Col Ana="N" IsPL="N" Secs="5580" Year="2000" LType="FileCol" AR="2.35:1" Artist="Harold Ramis" Lab="20th Century Fox" LAct="Brendan Fraser" Loc="\\MARY\ExtMedia1\FullDisc\Bedazzled\VIDEO_TS\VIDEO_TS.IFO" Fmt="DVD" Rat="PG-13" UPC="024543008132" Id="5" ArtId="5" Name="Disc 1" UID="MyMvTitle-41"><InCats>1 19 15 16 </InCats><CItems>5 </CItems><Cast>Brendan Fraser, Elizabeth Hurley, Frances O'Connor</Cast><Desc>The Devil's never been so ...</Desc></Col>
<Col Ana="N" IsPL="N" Secs="7440" Year="1994" LType="FileCol" AR="1.85:1" Artist="Ang Lee" Lab="Metro-Goldwyn-Mayer Pictures" LAct="Sihung Lung" Loc="\\MARY\IntMedia1\MainMovie\Eat Drink Man Woman\VIDEO_TS\VIDEO_TS.IFO" Fmt="DVD" Rat="Unrated" UPC="027616867858" Id="6" ArtId="6" Name="Disc 1" UID="MyMvTitle-61"><InCats>1 14 20 15 16 </InCats><CItems>6 </CItems><Cast>Sihung Lung, Yu-Wen Wang, </Cast><Desc>From celebrated director Ang Lee...</Desc></Col>
<Col Ana="N" IsPL="N" Secs="8940" Year="2006" LType="FileCol" AR="1.33:1" Artist="Ron Howard" Lab="Sony Pictures Home Entertainment" LAct="Tom Hanks" Loc="\\MARY\ExtMedia1\MainMovie\The Da Vinci Code\VIDEO_TS\VIDEO_TS.IFO" Fmt="DVD" Rat="PG-13" UPC="043396150362" Id="7" ArtId="7" Name="Disc 2" UID="MyMvTitle-71"><InCats>1 21 17 14 </InCats><CItems>7 </CItems><Cast>Tom Hanks, Audrey Tautou</Cast><Desc>Dan Brown's international bestseller comes alive "</Desc></Col>
<Col Ana="N" IsPL="N" Secs="5760" Year="2007" LType="FileCol" AR="1.85:1" Artist="Jason Reitman" Lab="Fox Searchlight Pictures" LAct="Ellen Page" Loc="\\MARY\IntMedia1\MainMovie\Juno\VIDEO_TS\VIDEO_TS.IFO" Fmt="DVD" Rat="PG-13" UPC="024543506874" Id="8" ArtId="8" Name="Disc 1" UID="MyMvTitle-81"><InCats>1 14 15 16 </InCats><CItems>8 </CItems><Cast>Ellen Page, Michael Cera, </Cast><Desc>Don't miss the outrageously ...</Desc></Col>
</Cols>
<Sets Cnt="7">
<Titl Ana="N" Added="3153DC6A4A8000" URat="9" Year="1999" Artist="Andy Wachowski" STitle="MATRIX, THE 01" Id="2" Name="The Matrix" UID="MyMvTitle-1"><CCols>2 </CCols></Titl>
<Titl Ana="N" Added="3153DC6A4A8000" URat="10" Year="2005" Artist="Anand Tucker" STitle="SHOPGIRL" Id="3" Name="Shopgirl" UID="MyMvTitle-2"><CCols>3 </CCols></Titl>
<Titl Ana="N" Added="3153DC6A4A8000" URat="8" Year="1997" Artist="George Armitage" STitle="GROSSE POINTE BLANK" Id="4" Name="Grosse Pointe Blank" UID="MyMvTitle-3"><CCols>4 </CCols></Titl>
<Titl Ana="N" Added="3153DC6A4A8000" Year="2000" Artist="Harold Ramis" STitle="BEDAZZLED" Id="5" Name="Bedazzled" UID="MyMvTitle-4"><CCols>5 </CCols></Titl>
<Titl Ana="N" Added="3153DC6A4A8000" Year="1994" Artist="Ang Lee" STitle="EAT DRINK MAN WOMAN" Id="6" Name="Yin shi nan nu" UID="MyMvTitle-6"><CCols>6 </CCols></Titl>
<Titl Ana="N" Added="3153DC6A4A8000" Year="2006" Artist="Ron Howard" STitle="DA VINCI CODE, THE" Id="7" Name="The Da Vinci Code" UID="MyMvTitle-7"><CCols>7 </CCols></Titl>
<Titl Ana="N" Added="3153DC6A4A8000" Year="2007" Artist="Jason Reitman" STitle="JUNO" Id="8" Name="Juno" UID="MyMvTitle-8"><CCols>8 </CCols></Titl>
</Sets>
</Movie>
</MediaDB>
Dean Roddey
Explorans limites defectum
Explorans limites defectum