-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtab_xml.php
312 lines (284 loc) · 12.9 KB
/
tab_xml.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<div class="section">
<h1>Interface Specification</h1>
<p>The following are the specifications for the database interfaces. I recommend allowing your users to configure their list of mirrors, in case the primary server ever goes down. Set this list of mirrors to include the primary server by default.</p>
<p><b>We have two requirements for anyone that uses these interfaces:</b>
<ul><li>First, you <b>MUST</b> inform your users about this site and ask them to contribute.
<li>Second, once you publicly release your program, plugin, or script, you <b>MUST</b> <a href="mailto: [email protected]">inform us</a> about it. This way we can link back to you and keep tabs on everyone accessing the interfaces.
</ul></p>
<p>An update of a client-side library should work as follows (it looks more complicated than it is):</p>
<ol>
<li>Query GetMirrors using a random server from the client's mirror list.
<li>Update their mirrors list with the results.
<li>Randomly select a banner and interface site for your updates. If you cannot contact a banner or interface site, check the next one. Rinse, repeat.
<li>Loop through the database. For each series:
<ul>
<li>Look up series that are missing a tvdb seriesid. Look up and store their seriesid using the GetSeries interface.
<li>Append the seriesid to a comma-separated list for all shows (new and existing).
</ul>
<li>Send the comma-separated list of tvdb seriesids to the SeriesUpdates interface along with the client's last update timestamp (returned in the last update as SyncTime).
<li>For each item returned:
<ul>
<li>Update the associated series record with the returned data.
<li>If <NotValid>1</NotValid> is set:
<ul>
<li>Look up the series using GetSeries.
<li>Send the id along with a lasttime of 0 to SeriesUpdates.
<li>Update the series record if there is returned data.
</ul>
</ul>
<li>For each episode:
<ul>
<li>Look up episodes that are missing a tvdb episodeid. Look up and store their episodeid using the GetEpisode interface.
<li>Append the episodeid to a comma-separated list for all episodes (new and existing).
</ul>
<li>Send the comma-separated list of tvdb episodeids to the EpisodeUpdates interface along with the client's last update timestamp (returned in the last update as SyncTime).
<li>For each item returned:
<ul>
<li>Update the associated episode record with the returned data.
<li>If <NotValid>1</NotValid> is set:
<ul>
<li>Look up the episode using GetEpisode.
<li>Send the id along with a lasttime of 0 to EpisodeUpdates.
<li>Update the episode record if there is returned data.
</ul>
</ul>
</ol>
<p>There is another logical method for checking the database for updates. This one is provided as an example.</p>
<p><b>For all of the following, <i>http://thetvdb.com</i> can be used as an example {mirrorsite}.</b>
</div>
<div class="section">
<h1>GetMirrors</h1>
<table width="100%" cellpadding="3" cellspacing="0" border="0" id="infotable">
<tr>
<td width="25%" valign="top">Purpose</td>
<td valign="top">Retrieve a list of all mirrors you can query from. This list is randomized, so you can always select the first one.</td>
</tr>
<tr>
<td valign="top">Location</td>
<td valign="top">{mirrorsite}/interface/GetMirrors.php</td>
</tr>
<tr>
<td valign="top">Parameters</td>
<td valign="top">none</td>
</tr>
<tr>
<td valign="top">Example POST/GET Data</td>
<td valign="top">none</td>
</tr>
<tr>
<td valign="top">Returned Data</td>
<td valign="top"><a target="_blank" href="http://thetvdb.com/interfaces/GetMirrors.php">View results</a>
</td>
</tr>
</table>
</div>
<div class="section">
<h1>GetLanguages</h1>
<table width="100%" cellpadding="3" cellspacing="0" border="0" id="infotable">
<tr>
<td width="25%" valign="top">Purpose</td>
<td valign="top">Retrieve a list of all database languages and their id's.</td>
</tr>
<tr>
<td valign="top">Location</td>
<td valign="top">{mirrorsite}/interface/GetLanguages.php</td>
</tr>
<tr>
<td valign="top">Parameters</td>
<td valign="top">none</td>
</tr>
<tr>
<td valign="top">Example POST/GET Data</td>
<td valign="top">none</td>
</tr>
<tr>
<td valign="top">Returned Data</td>
<td valign="top"><a target="_blank" href="http://thetvdb.com/interfaces/GetLanguages.php">View results</a>
</td>
</tr>
</table>
</div>
<div class="section">
<h1>GetBanners</h1>
<table width="100%" cellpadding="3" cellspacing="0" border="0" id="infotable">
<tr>
<td width="25%" valign="top">Purpose</td>
<td valign="top">Retrieve a list of banners associated with a series. This includes series and season banners.</td>
</tr>
<tr>
<td valign="top">Location</td>
<td valign="top">{mirrorsite}/interface/GetBanners.php</td>
</tr>
<tr>
<td valign="top">Parameters</td>
<td valign="top">
<b>seriesname:</b> The name of the series you want banners for.<br>
<b>seriesid:</b> The tvdb id of the series you want banners for. (overrides seriesname if sent)<br>
<b>lasttime:</b> The last time you queried the banners interface. Interface will return all banners added since this epoch time. (defaults to 0)<br>
<b>language:</b> The language id for the results. English is default.<br>
<b>user:</b> Does nothing now, but will soon return banners in the user's preferred language AND only their preferred banners if available.<br>
</td>
</tr>
<tr>
<td valign="top">Example POST/GET Data</td>
<td valign="top">
seriesid=75397<br>
seriesname=Battlestar%20Galactica<br>
seriesname=Battlestar%20Galactica&lasttime=1160551948<br>
</td>
</tr>
<tr>
<td valign="top">Returned Data</td>
<td valign="top">
<a target="_blank" href="http://thetvdb.com/interfaces/GetBanners.php?seriesid=75397">View results (example 1)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetBanners.php?seriesname=Battlestar%20Galactica">View results (example 2)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetBanners.php?seriesname=Battlestar%20Galactica&lasttime=1160551948">View results (example 3)</a>
</td>
</tr>
</table>
</div>
<div class="section">
<h1>GetSeries</h1>
<table width="100%" cellpadding="3" cellspacing="0" border="0" id="infotable">
<tr>
<td width="25%" valign="top">Purpose</td>
<td valign="top">Retrieve a tvdb seriesid using the series name. This uses fuzzy logic to find the most appropriate series and sort them accordingly.</td>
</tr>
<tr>
<td valign="top">Location</td>
<td valign="top">{mirrorsite}/interface/GetSeries.php</td>
</tr>
<tr>
<td valign="top">Parameters</td>
<td valign="top"><b>seriesname:</b> The name of the series.</td>
</tr>
<tr>
<td valign="top">Example POST/GET Data</td>
<td valign="top">seriesname=My+Name+Is+Earl</td>
</tr>
<tr>
<td valign="top">Returned Data</td>
<td valign="top"><a target="_blank" href="http://thetvdb.com/interfaces/GetSeries.php?seriesname=My+Name+Is+Earl">View results</a>
</td>
</tr>
</table>
</div>
<div class="section">
<h1>GetEpisodes</h1>
<table width="100%" cellpadding="3" cellspacing="0" border="0" id="infotable">
<tr>
<td width="25%" valign="top">Purpose</td>
<td valign="top">Retrieve a tvdb episodeid using a combination of seriesid, season, episode, and episodename.</td>
</tr>
<tr>
<td valign="top">Location</td>
<td valign="top">{mirrorsite}/interface/GetEpisodes.php</td>
</tr>
<tr>
<td valign="top">Parameters</td>
<td valign="top">
<b>seriesid:</b> The tvdb series id.<br>
<b>episode:</b> The episode number (optional).<br>
<b>season:</b> The season number (required if episode is sent).<br>
<b>episodename:</b> The name of the episode (optional. overrides episode and season parameters).<br>
<b>lasttime:</b> If set, the interface will return all episodes updated since this epoch time. (optional. defaults to 0).<br>
<b>firstaired:</b> First Airdate (optional) Only used if episode name and number do not match (YYYY-MM-DD)<br>
<b>order:</b> Episode Order (optional) If the get series interface returns an additional <EpisodeOrders> value of dvd or absolute then you can request that alternate order with this operator<br>
<b>language:</b> The language id for the results. English is default. If no translation is available, English is returned.<br>
<b>user:</b> The user's "Account Identifier" from their account settings page. Overrides the language parameter. Additional future features.<br>
</td>
</tr>
<tr>
<td valign="top">Example POST/GET Data</td>
<td valign="top">
seriesid=75397<br>
seriesid=75397&season=1<br>
seriesid=75397&season=1&episode=3<br>
seriesid=75397&episodename=Quit+Smoking<br>
seriesid=75397&firstaired=2007-01-18<br>
seriesid=78874&order=dvd<br>
seriesid=78857&order=absolute
</td>
</tr>
<tr>
<td valign="top">Returned Data</td>
<td valign="top">
<a target="_blank" href="http://thetvdb.com/interfaces/GetEpisodes.php?seriesid=75397">View results (example 1)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetEpisodes.php?seriesid=75397&season=1">View results (example 2)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetEpisodes.php?seriesid=75397&season=1&episode=3">View results (example 3)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetEpisodes.php?seriesid=75397&episodename=Quit+Smoking">View results (example 4)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetEpisodes.php?seriesid=75397&firstaired=2007-01-18">View results (example 5)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetEpisodes.php?seriesid=78874&order=dvd">View results (example 6)</a><br>
<a target="_blank" href="http://thetvdb.com/interfaces/GetEpisodes.php?seriesid=78857&order=absolute">View results (example 7)</a>
</td>
</tr>
</table>
</div>
<div class="section">
<h1>SeriesUpdates</h1>
<table width="100%" cellpadding="3" cellspacing="0" border="0" id="infotable">
<tr>
<td width="25%" valign="top">Purpose</td>
<td valign="top">Get all of the information for any series that have updated since the last time you checked. Includes <NotValid>{seriesid}</NotValid> if the ID isn't valid. Also returns SyncTime attribute that can be stored and used as lasttime for the next inport.</td>
</tr>
<tr>
<td valign="top">Location</td>
<td valign="top">{mirrorsite}/interface/SeriesUpdates.php</td>
</tr>
<tr>
<td valign="top">Parameters</td>
<td valign="top">
<b>lasttime:</b> The last time you queried the database in epochtime format. Set to 0 for first query of all data.<br>
<b>idlist:</b> A comma-separated list of all the tvdb series IDs in the user database.<br>
<b>language:</b> The language id for the results. English is default. If no translation is available, English is returned.<br>
<b>user:</b> The user's "Account Identifier" from their account settings page. Overrides the language parameter. Additional future features.<br>
</td>
</tr>
<tr>
<td valign="top">Example POST/GET Data</td>
<td valign="top">
lasttime=0&idlist=75397,70327,70328,70329,73762,1,72368,73420,73444
</td>
</tr>
<tr>
<td valign="top">Returned Data</td>
<td valign="top">
<a target="_blank" href="http://thetvdb.com/interfaces/SeriesUpdates.php?lasttime=0&idlist=75397,70327,70328,70329,73762,1,72368,73420,73444">View results</a>
</td>
</tr>
</table>
</div>
<div class="section">
<h1>EpisodeUpdates</h1>
<table width="100%" cellpadding="3" cellspacing="0" border="0" id="infotable">
<tr>
<td width="25%" valign="top">Purpose</td>
<td valign="top">Get all of the information for any episodes that have updated since the last time you checked. Includes <NotValid>{episodeid}</NotValid> if the ID isn't valid. Also returns SyncTime attribute that can be stored and used as lasttime for the next inport.</td>
</tr>
<tr>
<td valign="top">Location</td>
<td valign="top">{mirrorsite}/interface/EpisodeUpdates.php</td>
</tr>
<tr>
<td valign="top">Parameters</td>
<td valign="top">
<b>lasttime:</b> The last time you queried the database in epochtime format. Set to 0 for first query of all data.<br>
<b>idlist:</b> A comma-separated list of all the tvdb episode IDs in the user database.<br>
<b>language:</b> The language id for the results. English is default. If no translation is available, English is returned.<br>
<b>user:</b> The user's "Account Identifier" from their account settings page. Overrides the language parameter. Additional future features.<br>
</td>
</tr>
<tr>
<td valign="top">Example POST/GET Data</td>
<td valign="top">
lasttime=0&idlist=753970,222282,39920
</td>
</tr>
<tr>
<td valign="top">Returned Data</td>
<td valign="top">
<a target="_blank" href="http://thetvdb.com/interfaces/EpisodeUpdates.php?lasttime=0&idlist=753970,222282,39920">View results</a>
</td>
</tr>
</table>
</div>