1: /// <summary>
2: /// List of titles
3: /// </summary>
4: public class Titles
5: {
6: #region Constructor
7:
8: /// <summary>
9: /// Constructor
10: /// </summary>
11: /// <param name="XMLContent">XML Content</param>
12: public Titles(string XMLContent)
13: {
14: XmlDocument Document = new XmlDocument();
15: Document.LoadXml(XMLContent);
16: TitleList = new List<Title>();
17:
18: foreach (XmlNode Children in Document.ChildNodes)
19: {
20: if (Children.Name.Equals("catalog_titles", StringComparison.CurrentCultureIgnoreCase)
21: || Children.Name.Equals("similars", StringComparison.CurrentCultureIgnoreCase))
22: {
23: foreach (XmlNode Child in Children.ChildNodes)
24: {
25: if (Child.Name.Equals("catalog_title", StringComparison.CurrentCultureIgnoreCase)
26: || Child.Name.Equals("similars_item", StringComparison.CurrentCultureIgnoreCase))
27: {
28: TitleList.Add(new Title((XmlElement)Child));
29: }
30: else if (Child.Name.Equals("number_of_results", StringComparison.CurrentCultureIgnoreCase))
31: {
32: NumberOfResults = int.Parse(Child.InnerText);
33: }
34: else if (Child.Name.Equals("start_index", StringComparison.CurrentCultureIgnoreCase))
35: {
36: StartIndex = int.Parse(Child.InnerText);
37: }
38: else if (Child.Name.Equals("results_per_page", StringComparison.CurrentCultureIgnoreCase))
39: {
40: ResultsPerPage = int.Parse(Child.InnerText);
41: }
42: }
43: }
44: }
45: }
46:
47: #endregion
48:
49: #region Properties
50:
51: /// <summary>
52: /// Number of results
53: /// </summary>
54: public int NumberOfResults { get; set; }
55:
56: /// <summary>
57: /// Start index
58: /// </summary>
59: public int StartIndex { get; set; }
60:
61: /// <summary>
62: /// Results per page
63: /// </summary>
64: public int ResultsPerPage { get; set; }
65:
66: /// <summary>
67: /// List of titles
68: /// </summary>
69: public List<Title> TitleList { get; set; }
70:
71: #endregion
72: }
73:
74:
75:
76: /// <summary>
77: /// Title information
78: /// </summary>
79: public class Title
80: {
81: #region Constructor
82:
83: /// <summary>
84: /// Constructor
85: /// </summary>
86: /// <param name="Element">Title information</param>
87: public Title(XmlElement Element)
88: {
89: Categories = new List<string>();
90: foreach (XmlNode Children in Element.ChildNodes)
91: {
92: if (Children.Name.Equals("id", StringComparison.CurrentCultureIgnoreCase))
93: {
94: ID = Children.InnerText;
95: }
96: else if (Children.Name.Equals("title", StringComparison.CurrentCultureIgnoreCase))
97: {
98: TitleInformation = new TitleInformation((XmlElement)Children);
99: }
100: else if (Children.Name.Equals("box_art", StringComparison.CurrentCultureIgnoreCase))
101: {
102: BoxArt = new BoxArt((XmlElement)Children);
103: }
104: else if (Children.Name.Equals("release_year", StringComparison.CurrentCultureIgnoreCase))
105: {
106: ReleaseYear = Children.InnerText;
107: }
108: else if (Children.Name.Equals("runtime", StringComparison.CurrentCultureIgnoreCase))
109: {
110: RunTime = int.Parse(Children.InnerText);
111: }
112: else if (Children.Name.Equals("average_rating", StringComparison.CurrentCultureIgnoreCase))
113: {
114: AverageRating = double.Parse(Children.InnerText);
115: }
116:
117: else if (Children.Name.Equals("category", StringComparison.CurrentCultureIgnoreCase))
118: {
119: if (Children.Attributes["scheme"] != null
120: && (Children.Attributes["scheme"].Value.Equals("http://api.netflix.com/categories/mpaa_ratings",
121: StringComparison.CurrentCultureIgnoreCase)
122: || Children.Attributes["scheme"].Value.Equals("http://api.netflix.com/categories/tv_ratingss",
123: StringComparison.CurrentCultureIgnoreCase)))
124: {
125: Rating = Children.Attributes["label"].Value;
126: }
127: else if (Children.Attributes["scheme"].Value.Equals("http://api.netflix.com/categories/genres",
128: StringComparison.CurrentCultureIgnoreCase))
129: {
130: Categories.Add(Children.Attributes["label"].Value);
131: }
132: }
133: else if (Children.Name.Equals("link", StringComparison.CurrentCultureIgnoreCase))
134: {
135: if (Children.Attributes["rel"] != null
136: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/titles/synopsis",
137: StringComparison.CurrentCultureIgnoreCase))
138: {
139: SynopsisLink = Children.Attributes["href"].Value;
140: }
141: else if (Children.Attributes["rel"] != null
142: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/people.cast",
143: StringComparison.CurrentCultureIgnoreCase))
144: {
145: CastLink = Children.Attributes["href"].Value;
146: }
147: else if (Children.Attributes["rel"] != null
148: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/people.directors",
149: StringComparison.CurrentCultureIgnoreCase))
150: {
151: DirectorsLink = Children.Attributes["href"].Value;
152: }
153: else if (Children.Attributes["rel"] != null
154: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/titles/format_availability",
155: StringComparison.CurrentCultureIgnoreCase))
156: {
157: FormatsAvailableLink = Children.Attributes["href"].Value;
158: }
159: else if (Children.Attributes["rel"] != null
160: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/titles/screen_formats",
161: StringComparison.CurrentCultureIgnoreCase))
162: {
163: ScreenFormatsLink = Children.Attributes["href"].Value;
164: }
165: else if (Children.Attributes["rel"] != null
166: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/titles/languages_and_audio",
167: StringComparison.CurrentCultureIgnoreCase))
168: {
169: LanguagesLink = Children.Attributes["href"].Value;
170: }
171: else if (Children.Attributes["rel"] != null
172: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/titles.similars",
173: StringComparison.CurrentCultureIgnoreCase))
174: {
175: SimilarTitleLink = Children.Attributes["href"].Value;
176: }
177: else if (Children.Attributes["rel"] != null
178: && Children.Attributes["rel"].Value.Equals("alternate",
179: StringComparison.CurrentCultureIgnoreCase))
180: {
181: this.NetflixWebPage= Children.Attributes["href"].Value;
182: }
183: else if (Children.Attributes["rel"] != null
184: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/titles.series",
185: StringComparison.CurrentCultureIgnoreCase))
186: {
187: this.SeriesLink = Children.Attributes["href"].Value;
188: }
189: else if (Children.Attributes["rel"] != null
190: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/programs",
191: StringComparison.CurrentCultureIgnoreCase))
192: {
193: this.EpisodeLink = Children.Attributes["href"].Value;
194: }
195: else if (Children.Attributes["rel"] != null
196: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catalog/titles/official_url",
197: StringComparison.CurrentCultureIgnoreCase))
198: {
199: this.StudioWebPage = Children.Attributes["href"].Value;
200: }
201: }
202: }
203: }
204:
205: #endregion
206:
207: #region Properties
208:
209: /// <summary>
210: /// Title ID
211: /// </summary>
212: public string ID { get; set; }
213:
214: /// <summary>
215: /// Title information
216: /// </summary>
217: public TitleInformation TitleInformation { get; set; }
218:
219: /// <summary>
220: /// Box artwork
221: /// </summary>
222: public BoxArt BoxArt { get; set; }
223:
224: /// <summary>
225: /// Synopsis link
226: /// </summary>
227: public string SynopsisLink { get; set; }
228:
229: /// <summary>
230: /// Year released
231: /// </summary>
232: public string ReleaseYear { get; set; }
233:
234: /// <summary>
235: /// Average rating
236: /// </summary>
237: public string Rating { get; set; }
238:
239: /// <summary>
240: /// list of categories
241: /// </summary>
242: public List<string> Categories { get; set; }
243:
244: /// <summary>
245: /// Run time in seconds
246: /// </summary>
247: public int RunTime { get; set; }
248:
249: /// <summary>
250: /// Link to cast information
251: /// </summary>
252: public string CastLink { get; set; }
253:
254: /// <summary>
255: /// Link to directories information
256: /// </summary>
257: public string DirectorsLink { get; set; }
258:
259: /// <summary>
260: /// Formats available link
261: /// </summary>
262: public string FormatsAvailableLink { get; set; }
263:
264: /// <summary>
265: /// Screen formats available link
266: /// </summary>
267: public string ScreenFormatsLink { get; set; }
268:
269: /// <summary>
270: /// Language information link
271: /// </summary>
272: public string LanguagesLink { get; set; }
273:
274: /// <summary>
275: /// Average rating
276: /// </summary>
277: public double AverageRating { get; set; }
278:
279: /// <summary>
280: /// Similar titles to this one link
281: /// </summary>
282: public string SimilarTitleLink { get; set; }
283:
284: /// <summary>
285: /// Link to netflix webpage
286: /// </summary>
287: public string NetflixWebPage { get; set; }
288:
289: /// <summary>
290: /// Link to studio web page
291: /// </summary>
292: public string StudioWebPage { get; set; }
293:
294: /// <summary>
295: /// Link to awards
296: /// </summary>
297: public string Awards { get; set; }
298:
299: /// <summary>
300: /// Link to bonus material
301: /// </summary>
302: public string BonusMaterial { get; set; }
303:
304: /// <summary>
305: /// Link for series info
306: /// </summary>
307: public string SeriesLink { get; set; }
308:
309: /// <summary>
310: /// Link for episodes
311: /// </summary>
312: public string EpisodeLink { get; set; }
313:
314: /// <summary>
315: /// Season info link
316: /// </summary>
317: public string SeasonLink { get; set; }
318:
319: #endregion
320: }
321:
322:
323:
324: /// <summary>
325: /// Title information
326: /// </summary>
327: public class TitleInformation
328: {
329: #region Constructor
330:
331: /// <summary>
332: /// Constructor
333: /// </summary>
334: /// <param name="Element">Element information</param>
335: public TitleInformation(XmlElement Element)
336: {
337: if (Element.Attributes["short"] != null)
338: {
339: ShortName = Element.Attributes["short"].Value;
340: }
341: if (Element.Attributes["regular"] != null)
342: {
343: RegularName = Element.Attributes["regular"].Value;
344: }
345: }
346:
347: #endregion
348:
349: #region Public Properties
350:
351: /// <summary>
352: /// Short name
353: /// </summary>
354: public string ShortName { get; set; }
355:
356: /// <summary>
357: /// Regular name
358: /// </summary>
359: public string RegularName { get; set; }
360:
361: #endregion
362: }
363:
364:
365:
366: /// <summary>
367: /// Box art information
368: /// </summary>
369: public class BoxArt
370: {
371: #region Constructor
372:
373: /// <summary>
374: /// Constructor
375: /// </summary>
376: /// <param name="Element">Element information</param>
377: public BoxArt(XmlElement Element)
378: {
379: if (Element.Attributes["small"] != null)
380: {
381: SmallPicture = Element.Attributes["small"].Value;
382: }
383: if (Element.Attributes["medium"] != null)
384: {
385: MediumPicture = Element.Attributes["medium"].Value;
386: }
387: if (Element.Attributes["large"] != null)
388: {
389: LargePicture = Element.Attributes["large"].Value;
390: }
391: }
392:
393: #endregion
394:
395: #region Public Properties
396:
397: /// <summary>
398: /// Small picture
399: /// </summary>
400: public string SmallPicture { get; set; }
401:
402: /// <summary>
403: /// Medium picture
404: /// </summary>
405: public string MediumPicture { get; set; }
406:
407: /// <summary>
408: /// Large picture
409: /// </summary>
410: public string LargePicture { get; set; }
411:
412: #endregion
413: }
414:
415:
416:
417: /// <summary>
418: /// People list
419: /// </summary>
420: public class People
421: {
422: #region Constructor
423:
424: /// <summary>
425: /// Constructor
426: /// </summary>
427: /// <param name="XMLContent">XML content</param>
428: public People(string XMLContent)
429: {
430: XmlDocument Document = new XmlDocument();
431: Document.LoadXml(XMLContent);
432: PeopleList = new List<Person>();
433:
434: foreach (XmlNode Children in Document.ChildNodes)
435: {
436: if (Children.Name.Equals("people", StringComparison.CurrentCultureIgnoreCase))
437: {
438: foreach (XmlNode Child in Children.ChildNodes)
439: {
440: if (Child.Name.Equals("person", StringComparison.CurrentCultureIgnoreCase))
441: {
442: PeopleList.Add(new Person((XmlElement)Child));
443: }
444: else if (Child.Name.Equals("number_of_results", StringComparison.CurrentCultureIgnoreCase))
445: {
446: NumberOfResults = int.Parse(Child.InnerText);
447: }
448: else if (Child.Name.Equals("start_index", StringComparison.CurrentCultureIgnoreCase))
449: {
450: StartIndex = int.Parse(Child.InnerText);
451: }
452: else if (Child.Name.Equals("results_per_page", StringComparison.CurrentCultureIgnoreCase))
453: {
454: ResultsPerPage = int.Parse(Child.InnerText);
455: }
456: }
457: }
458: }
459: }
460:
461: #endregion
462:
463: #region Properties
464:
465: /// <summary>
466: /// List of people
467: /// </summary>
468: public List<Person> PeopleList { get; set; }
469:
470: /// <summary>
471: /// Number of results
472: /// </summary>
473: public int NumberOfResults { get; set; }
474:
475: /// <summary>
476: /// Start index
477: /// </summary>
478: public int StartIndex { get; set; }
479:
480: /// <summary>
481: /// Number of results per page
482: /// </summary>
483: public int ResultsPerPage { get; set; }
484:
485: #endregion
486: }
487:
488:
489:
490: /// <summary>
491: /// Person class
492: /// </summary>
493: public class Person
494: {
495: #region Constructor
496:
497: /// <summary>
498: /// Constructor
499: /// </summary>
500: /// <param name="Element">person node</param>
501: public Person(XmlElement Element)
502: {
503: foreach (XmlNode Children in Element.ChildNodes)
504: {
505: if (Children.Name.Equals("id", StringComparison.CurrentCultureIgnoreCase))
506: {
507: ID = Children.InnerText;
508: }
509: else if (Children.Name.Equals("name", StringComparison.CurrentCultureIgnoreCase))
510: {
511: Name = Children.InnerText;
512: }
513: else if (Children.Name.Equals("bio", StringComparison.CurrentCultureIgnoreCase))
514: {
515: Bio = Children.InnerText;
516: }
517: else if (Children.Name.Equals("link", StringComparison.CurrentCultureIgnoreCase))
518: {
519: if (Children.Attributes["rel"] != null
520: && Children.Attributes["rel"].Value.Equals("http://schemas.netflix.com/catlog/person/filmography",
521: StringComparison.CurrentCultureIgnoreCase))
522: {
523: Filmography = Children.Attributes["href"].Value;
524: }
525: else if (Children.Attributes["rel"] != null
526: && Children.Attributes["rel"].Value.Equals("alternate",
527: StringComparison.CurrentCultureIgnoreCase))
528: {
529: Webpage = Children.Attributes["href"].Value;
530: }
531: }
532: }
533: }
534:
535: #endregion
536:
537: #region Properties
538:
539: /// <summary>
540: /// ID for the person
541: /// </summary>
542: public string ID { get; set; }
543:
544: /// <summary>
545: /// Name of the person
546: /// </summary>
547: public string Name { get; set; }
548:
549: /// <summary>
550: /// Bio information for the person
551: /// </summary>
552: public string Bio { get; set; }
553:
554: /// <summary>
555: /// Filmography link
556: /// </summary>
557: public string Filmography { get; set; }
558:
559: /// <summary>
560: /// Webpage link
561: /// </summary>
562: public string Webpage { get; set; }
563:
564: #endregion
565: }