/core/externals/update-engine/externals/gdata-objectivec-client/Source/Media/GDataMediaPlayer.m

http://macfuse.googlecode.com/ · Objective C · 82 lines · 42 code · 20 blank · 20 comment · 2 complexity · f9ac4274b9099f512de5090efae2585a MD5 · raw file

  1. /* Copyright (c) 2008 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. //
  16. // GDataMediaPlayer.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE \
  19. || GDATA_INCLUDE_YOUTUBE_SERVICE
  20. #import "GDataMediaPlayer.h"
  21. #import "GDataMediaGroup.h"
  22. static NSString* const kURLAttr = @"url";
  23. static NSString* const kHeightAttr = @"height";
  24. static NSString* const kWidthAttr = @"width";
  25. @implementation GDataMediaPlayer
  26. // like <media:player url="http://www.foo.com/player?id=1111" height="200" width="400" />
  27. //
  28. // http://search.yahoo.com/mrss
  29. + (NSString *)extensionElementURI { return kGDataNamespaceMedia; }
  30. + (NSString *)extensionElementPrefix { return kGDataNamespaceMediaPrefix; }
  31. + (NSString *)extensionElementLocalName { return @"player"; }
  32. + (GDataMediaPlayer *)mediaPlayerWithURLString:(NSString *)str {
  33. GDataMediaPlayer* obj = [self object];
  34. [obj setURLString:str];
  35. return obj;
  36. }
  37. - (void)addParseDeclarations {
  38. NSArray *attrs = [NSArray arrayWithObjects:
  39. kURLAttr, kHeightAttr, kWidthAttr, nil];
  40. [self addLocalAttributeDeclarations:attrs];
  41. }
  42. #pragma mark -
  43. - (NSString *)URLString {
  44. return [self stringValueForAttribute:kURLAttr];
  45. }
  46. - (void)setURLString:(NSString *)str {
  47. [self setStringValue:str forAttribute:kURLAttr];
  48. }
  49. - (NSNumber *)height {
  50. return [self intNumberForAttribute:kHeightAttr];
  51. }
  52. - (void)setHeight:(NSNumber *)num {
  53. [self setStringValue:[num stringValue] forAttribute:kHeightAttr];
  54. }
  55. - (NSNumber *)width {
  56. return [self intNumberForAttribute:kWidthAttr];
  57. }
  58. - (void)setWidth:(NSNumber *)num {
  59. [self setStringValue:[num stringValue] forAttribute:kWidthAttr];
  60. }
  61. @end
  62. #endif // #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_*_SERVICE