Menu

[r144]: / trunk / GoogleAPI / src / extensions / mediarss.cs  Maximize  Restore  History

Download this file

907 lines (841 with data), 31.5 kB

  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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
/* Copyright (c) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Xml;
using Google.GData.Client;
using System.Globalization;
namespace Google.GData.Extensions.MediaRss {
/// <summary>
/// helper to instantiate all factories defined in here and attach
/// them to a base object
/// </summary>
public class MediaRssExtensions
{
/// <summary>
/// helper to add all MediaRss extensions to a base object
/// </summary>
/// <param name="baseObject"></param>
public static void AddExtension(AtomBase baseObject)
{
baseObject.AddExtension(new MediaGroup());
}
}
/// <summary>
/// short table for constants related to mediaRss declarations
/// </summary>
public class MediaRssNameTable
{
/// <summary>static string to specify the mediarss namespace
/// TODO: picasa has the namespace slighly wrong.
/// </summary>
public const string NSMediaRss = "http://search.yahoo.com/mrss/";
/// <summary>static string to specify the used mediarss prefix</summary>
public const string mediaRssPrefix = "media";
/// <summary>static string to specify the media:group element</summary>
public const string MediaRssGroup = "group";
/// <summary>static string to specify the media:credit element</summary>
public const string MediaRssCredit = "credit";
/// <summary>static string to specify the media:content element</summary>
public const string MediaRssContent = "content";
/// <summary>static string to specify the media:category element</summary>
public const string MediaRssCategory = "category";
/// <summary>static string to specify the media:description element</summary>
public const string MediaRssDescription = "description";
/// <summary>static string to specify the media:keywords element</summary>
public const string MediaRssKeywords = "keywords";
/// <summary>static string to specify the media:thumbnail element</summary>
public const string MediaRssThumbnail = "thumbnail";
/// <summary>static string to specify the media:title element</summary>
public const string MediaRssTitle = "title";
/// <summary>static string to specify the media:rating element</summary>
public const string MediaRssRating = "rating";
/// <summary>static string to specify the media:restriction element</summary>
public const string MediaRssRestriction = "restriction";
/// <summary>static string to specify the media:player element</summary>
public const string MediaRssPlayer = "player";
/// <summary>
/// the attribute string for the URL attribute
/// </summary>
public const string AttributeUrl = "url";
/// <summary>
/// the attribute string for the height attribute
/// </summary>
public const string AttributeHeight = "height";
/// <summary>
/// the attribute string for the width attribute
/// </summary>
public const string AttributeWidth = "width";
/// <summary>
/// the attribute string for the time attribute
/// </summary>
public const string AttributeTime = "time";
/// <summary>
/// the attribute string for the type attribute
/// </summary>
public const string AttributeType = "type";
/// <summary>
/// the attribute string for the isDefault attribute
/// </summary>
public const string AttributeDefault = "isDefault";
/// <summary>
/// the attribute string for the expression attribute
/// </summary>
public const string AttributeExpression = "expression";
/// <summary>
/// the attribute string for the duration attribute
/// </summary>
public const string AttributeDuration = "duration";
}
/// <summary>
/// MediaGroup container element for the MediaRss namespace
/// </summary>
public class MediaGroup : SimpleContainer
{
private ExtensionCollection<MediaThumbnail> thumbnails;
private ExtensionCollection<MediaContent> contents;
private ExtensionCollection<MediaCategory> categories;
/// <summary>
/// default constructor for media:group
/// </summary>
public MediaGroup() :
base(MediaRssNameTable.MediaRssGroup,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.ExtensionFactories.Add(new MediaCredit());
this.ExtensionFactories.Add(new MediaDescription());
this.ExtensionFactories.Add(new MediaContent());
this.ExtensionFactories.Add(new MediaKeywords());
this.ExtensionFactories.Add(new MediaThumbnail());
this.ExtensionFactories.Add(new MediaTitle());
this.ExtensionFactories.Add(new MediaCategory());
this.ExtensionFactories.Add(new MediaRating());
this.ExtensionFactories.Add(new MediaRestriction());
this.ExtensionFactories.Add(new MediaPlayer());
}
/// <summary>
/// returns the media:credit element
/// </summary>
public MediaCredit Credit
{
get
{
return FindExtension(MediaRssNameTable.MediaRssCredit,
MediaRssNameTable.NSMediaRss) as MediaCredit;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssCredit,
MediaRssNameTable.NSMediaRss,
value);
}
}
/// <summary>
/// returns the media:credit element
/// </summary>
public MediaRestriction Restriction
{
get
{
return FindExtension(MediaRssNameTable.MediaRssRestriction,
MediaRssNameTable.NSMediaRss) as MediaRestriction;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssRestriction,
MediaRssNameTable.NSMediaRss,
value);
}
}
/// <summary>
/// returns the media:content element
/// </summary>
public MediaContent Content
{
get
{
return FindExtension(MediaRssNameTable.MediaRssContent,
MediaRssNameTable.NSMediaRss) as MediaContent;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssContent,
MediaRssNameTable.NSMediaRss,
value);
}
}
/// <summary>
/// returns the media:credit element
/// </summary>
public MediaDescription Description
{
get
{
return FindExtension(MediaRssNameTable.MediaRssDescription,
MediaRssNameTable.NSMediaRss) as MediaDescription;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssDescription,
MediaRssNameTable.NSMediaRss,
value);
}
}
/// <summary>
/// The media:keywords tag contains a comma-separated list of words associated with a video.
/// You must provide at least one keyword for each video in your feed. This field has a
/// maximum length of 120 characters, including commas, and may contain all valid UTF-8
/// characters except &gt; and &lt; In addition, each keyword must be at least two characters
/// long and may not be longer than 25 characters.
/// </summary>
public MediaKeywords Keywords
{
get
{
return FindExtension(MediaRssNameTable.MediaRssKeywords,
MediaRssNameTable.NSMediaRss) as MediaKeywords;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssKeywords,
MediaRssNameTable.NSMediaRss,
value);
}
}
/// <summary>
/// returns the media:credit element
/// </summary>
public MediaTitle Title
{
get
{
return FindExtension(MediaRssNameTable.MediaRssTitle,
MediaRssNameTable.NSMediaRss) as MediaTitle;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssTitle,
MediaRssNameTable.NSMediaRss,
value);
}
}
/// <summary>
/// returns the media:rating element
/// </summary>
public MediaRating Rating
{
get
{
return FindExtension(MediaRssNameTable.MediaRssRating,
MediaRssNameTable.NSMediaRss) as MediaRating;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssRating,
MediaRssNameTable.NSMediaRss,
value);
}
}
/// <summary>
/// property accessor for the Thumbnails
/// </summary>
public ExtensionCollection<MediaThumbnail> Thumbnails
{
get
{
if (this.thumbnails == null)
{
this.thumbnails = new ExtensionCollection<MediaThumbnail>(this);
}
return this.thumbnails;
}
}
/// <summary>
/// property accessor for the Contents Collection
/// </summary>
public ExtensionCollection<MediaContent> Contents
{
get
{
if (this.contents == null)
{
this.contents = new ExtensionCollection<MediaContent>(this);
}
return this.contents;
}
}
/// <summary>
/// property accessor for the Category Collection
/// </summary>
public ExtensionCollection<MediaCategory> Categories
{
get
{
if (this.categories == null)
{
this.categories = new ExtensionCollection<MediaCategory>(this);
}
return this.categories;
}
}
/// <summary>
/// returns the media:player element
/// </summary>
public MediaPlayer Player
{
get
{
return FindExtension(MediaRssNameTable.MediaRssPlayer,
MediaRssNameTable.NSMediaRss) as MediaPlayer;
}
set
{
ReplaceExtension(MediaRssNameTable.MediaRssPlayer,
MediaRssNameTable.NSMediaRss,
value);
}
}
}
/// <summary>
/// media:credit schema extension describing an credit given to media
/// it's a child of media:group
/// </summary>
public class MediaCredit : SimpleElement
{
/// <summary>
/// default constructor for media:credit
/// </summary>
public MediaCredit()
: base(MediaRssNameTable.MediaRssCredit,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add("role", null);
this.Attributes.Add("scheme", null);
}
/// <summary>
/// default constructor for media:credit with an initial value
/// </summary>
/// <param name="initValue"/>
public MediaCredit(string initValue)
: base(MediaRssNameTable.MediaRssCredit,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss, initValue)
{
this.Attributes.Add("role", null);
this.Attributes.Add("scheme", null);
}
/// <summary>
/// returns the schem of the credit element
/// </summary>
/// <returns></returns>
public string Scheme
{
get
{
return this.Attributes["scheme"] as string;
}
set
{
this.Attributes["scheme"] = value;
}
}
/// <summary>
/// returns the role of the credit element
/// </summary>
/// <returns></returns>
public string Role
{
get
{
return this.Attributes["role"] as string;
}
set
{
this.Attributes["role"] = value;
}
}
}
/// <summary>
/// media:restriction schema extension identifies the country or countries where a
/// video may or may not be played. The attribute value is a space-delimited
/// list of ISO 3166 two-letter country codes.
/// </summary>
public class MediaRestriction : SimpleElement
{
const string AttributeType = "type";
const string AttributeRel = "relationship";
/// <summary>
/// default constructor for media:credit
/// </summary>
public MediaRestriction()
: base(MediaRssNameTable.MediaRssRestriction,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add(AttributeType, null);
this.Attributes.Add(AttributeRel, null);
}
/// <summary>
/// default constructor for media:credit with an initial value
/// </summary>
/// <param name="initValue"/>
public MediaRestriction(string initValue)
: base(MediaRssNameTable.MediaRssRestriction,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss, initValue)
{
this.Attributes.Add(AttributeType, null);
this.Attributes.Add(AttributeRel, null);
}
/// <summary>
/// returns the schem of the credit element
/// </summary>
/// <returns></returns>
public string Type
{
get
{
return this.Attributes[AttributeType] as string;
}
set
{
this.Attributes[AttributeType] = value;
}
}
/// <summary>
/// returns the role of the credit element
/// </summary>
/// <returns></returns>
public string Relationship
{
get
{
return this.Attributes[AttributeRel] as string;
}
set
{
this.Attributes[AttributeRel] = value;
}
}
}
/// <summary>
/// media:description schema extension describing an description given to media
/// it's a child of media:group
/// </summary>
public class MediaDescription : SimpleElement
{
/// <summary>
/// default constructor for media:description
/// </summary>
public MediaDescription()
: base(MediaRssNameTable.MediaRssDescription,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add("type", null);
}
/// <summary>
/// default constructor for media:description with an initial value
/// </summary>
/// <param name="initValue"/>
public MediaDescription(string initValue)
: base(MediaRssNameTable.MediaRssDescription,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss, initValue)
{
this.Attributes.Add("type", null);
}
}
/// <summary>
/// media:player schema extension describing the player URL
/// it's a child of media:group
/// </summary>
public class MediaPlayer : SimpleElement
{
/// <summary>
/// default constructor for media:content
/// </summary>
public MediaPlayer()
: base(MediaRssNameTable.MediaRssPlayer,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add(MediaRssNameTable.AttributeUrl, null);
}
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Url</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Url
{
get
{
return this.Attributes[MediaRssNameTable.AttributeUrl] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeUrl] = value;
}
}
// end of accessor public string Url
}
/// <summary>
/// media:content schema extension describing the content URL
/// it's a child of media:group
/// </summary>
public class MediaContent : SimpleElement
{
/// <summary>
/// default constructor for media:content
/// </summary>
public MediaContent()
: base(MediaRssNameTable.MediaRssContent,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add(MediaRssNameTable.AttributeUrl, null);
this.Attributes.Add(MediaRssNameTable.AttributeType, null);
this.Attributes.Add(MediaRssNameTable.AttributeDefault, null);
this.Attributes.Add(MediaRssNameTable.AttributeExpression, null);
this.Attributes.Add(MediaRssNameTable.AttributeDuration, null);
}
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Url</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Url
{
get
{
return this.Attributes[MediaRssNameTable.AttributeUrl] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeUrl] = value;
}
}
// end of accessor public string Url
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Height</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Height
{
get
{
return this.Attributes[MediaRssNameTable.AttributeHeight] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeHeight] = value;
}
}
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Width</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Width
{
get
{
return this.Attributes[MediaRssNameTable.AttributeWidth] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeWidth] = value;
}
}
// end of accessor public string Url
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Width</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Type
{
get
{
return this.Attributes[MediaRssNameTable.AttributeType] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeType] = value;
}
}
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Duration</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Duration
{
get
{
return this.Attributes[MediaRssNameTable.AttributeDuration] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeDuration] = value;
}
}
}
/// <summary>
/// media:content schema extension describing the content URL
/// it's a child of media:group
/// </summary>
public class MediaCategory : SimpleElement
{
/// <summary>
/// default constructor for media:content
/// </summary>
public MediaCategory()
: base(MediaRssNameTable.MediaRssCategory,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add("scheme", null);
this.Attributes.Add("label", null);
}
/// <summary>
/// default constructor for media:credit with an initial value
/// </summary>
/// <param name="initValue"/>
public MediaCategory(string initValue)
: base(MediaRssNameTable.MediaRssCategory,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss, initValue)
{
this.Attributes.Add("scheme", null);
this.Attributes.Add("lable", null);
}
/// <summary>
/// Constructor for MediaCategory with an initial value
/// and a scheme.
/// </summary>
/// <param name="initValue">The value of the tag</param>
/// <param name="scheme">The scheme of the tag</param>
public MediaCategory(string initValue, string scheme)
: this(initValue)
{
this.Attributes["scheme"] = scheme;
}
}
/// <summary>
/// media:keywords schema extension describing a
/// comma seperated list of keywords
/// it's a child of media:group
/// </summary>
public class MediaKeywords : SimpleElement
{
/// <summary>
/// default constructor for media:keywords
/// </summary>
public MediaKeywords()
: base(MediaRssNameTable.MediaRssKeywords,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{}
/// <summary>
/// default constructor for media:keywords with an initial value
/// </summary>
/// <param name="initValue"/>
public MediaKeywords(string initValue)
: base(MediaRssNameTable.MediaRssKeywords,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss, initValue)
{}
}
/// <summary>
/// media:thumbnail schema extension describing a
/// thumbnail URL with height/width
/// it's a child of media:group
/// </summary>
public class MediaThumbnail : SimpleElement
{
/// <summary>
/// default constructor for media:thumbnail
/// </summary>
public MediaThumbnail()
: base(MediaRssNameTable.MediaRssThumbnail,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add(MediaRssNameTable.AttributeUrl, null);
this.Attributes.Add(MediaRssNameTable.AttributeHeight, null);
this.Attributes.Add(MediaRssNameTable.AttributeWidth, null);
this.Attributes.Add(MediaRssNameTable.AttributeTime, null);
}
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Url</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Url
{
get
{
return this.Attributes[MediaRssNameTable.AttributeUrl] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeUrl] = value;
}
}
// end of accessor public string Url
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Height</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Height
{
get
{
return this.Attributes[MediaRssNameTable.AttributeHeight] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeHeight] = value;
}
}
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the Width</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Width
{
get
{
return this.Attributes[MediaRssNameTable.AttributeWidth] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeWidth] = value;
}
}
//////////////////////////////////////////////////////////////////////
/// <summary>convienience accessor for the time attribute</summary>
/// <returns> </returns>
//////////////////////////////////////////////////////////////////////
public string Time
{
get
{
return this.Attributes[MediaRssNameTable.AttributeTime] as string;
}
set
{
this.Attributes[MediaRssNameTable.AttributeTime] = value;
}
}
// end of accessor public string Url
}
/// <summary>
/// media:title schema extension describing the title given to media
/// it's a child of media:group
/// </summary>
public class MediaTitle : SimpleElement
{
/// <summary>
/// default constructor for media:title
/// </summary>
public MediaTitle()
: base(MediaRssNameTable.MediaRssTitle,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add("type", null);
}
/// <summary>
/// default constructor for media:title with an initial value
/// </summary>
/// <param name="initValue"/>
public MediaTitle(string initValue)
: base(MediaRssNameTable.MediaRssTitle,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss, initValue)
{
this.Attributes.Add("type", null);
}
}
/// <summary>
/// media:rating schema extension describing the rating given to media
/// it's a child of media:group
/// </summary>
public class MediaRating : SimpleElement
{
/// <summary>
/// default constructor for media:rating
/// </summary>
public MediaRating()
: base(MediaRssNameTable.MediaRssRating,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss)
{
this.Attributes.Add("scheme", null);
this.Attributes.Add("country", null);
}
/// <summary>
/// default constructor for media:rating with an initial value
/// </summary>
/// <param name="initValue"/>
public MediaRating(string initValue)
: base(MediaRssNameTable.MediaRssRating,
MediaRssNameTable.mediaRssPrefix,
MediaRssNameTable.NSMediaRss, initValue)
{
this.Attributes.Add("scheme", null);
this.Attributes.Add("country", null);
}
/// <summary>
/// Constructor for MediaRating with an initial value
/// and a scheme.
/// </summary>
/// <param name="initValue">The value of the tag</param>
/// <param name="scheme">The scheme of the tag</param>
public MediaRating(string initValue, string scheme)
: this(initValue)
{
this.Attributes["scheme"] = scheme;
}
/// <summary>
/// returns the schem for the media rating
/// </summary>
/// <returns></returns>
public string Scheme
{
get
{
return this.Attributes["scheme"] as string;
}
set
{
this.Attributes["scheme"] = value;
}
}
/// <summary>
/// returns the country for this rating
/// </summary>
/// <returns></returns>
public string Country
{
get
{
return this.Attributes["country"] as string;
}
set
{
this.Attributes["country"] = value;
}
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.