devices.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. # Default Device Conversion Parameters
  4. _DEVICES = {
  5. 'Xoom': {
  6. 'group': 'Android',
  7. 'width': '1280',
  8. 'height': '800'
  9. },
  10. 'Droid': {
  11. 'group': 'Android',
  12. 'width': '854',
  13. 'height': '480'
  14. },
  15. 'G2': {
  16. 'group': 'Android',
  17. 'width': '800',
  18. 'height': '480'
  19. },
  20. 'Dream': {
  21. 'group': 'Android',
  22. 'width': '480',
  23. 'height': '320'
  24. },
  25. 'Galaxy Tab': {
  26. 'group': 'Android',
  27. 'width': '1024',
  28. 'height': '800'
  29. },
  30. 'Epic': {
  31. 'group': 'Android',
  32. 'width': '800',
  33. 'height': '480'
  34. },
  35. 'KindleFire': {
  36. 'group': 'Other',
  37. 'width': '1024',
  38. 'height': '600'
  39. },
  40. 'Playstation': {
  41. 'group': 'Other',
  42. 'width': '320',
  43. 'height': '480'
  44. },
  45. 'iPhone': {
  46. 'group': 'Apple',
  47. 'width': '480',
  48. 'height': '320'
  49. },
  50. 'iPhone 4': {
  51. 'group': 'Apple',
  52. 'width': '640',
  53. 'height': '480'
  54. },
  55. 'iPad': {
  56. 'group': 'Apple',
  57. 'width': '1024',
  58. 'height': '768'
  59. },
  60. 'Apple Universal': {
  61. 'group': 'Apple',
  62. 'width': '1280',
  63. 'height': '720'
  64. },
  65. 'MP4': {
  66. 'group': 'Format',
  67. 'width': None,
  68. 'height': None
  69. },
  70. 'MP3': {
  71. 'group': 'Format',
  72. 'width': None,
  73. 'height': None
  74. },
  75. 'Ogg Theora': {
  76. 'group': 'Format',
  77. 'width': None,
  78. 'height': None
  79. },
  80. 'Ogg Vorbis': {
  81. 'group': 'Format',
  82. 'width': None,
  83. 'height': None
  84. },
  85. 'WebM': {
  86. 'group': 'Format',
  87. 'width': None,
  88. 'height': None
  89. },
  90. }
  91. def dev_attr(device, default):
  92. return _DEVICES[device][default]
  93. def devices(group):
  94. device_list = []
  95. for (k, v) in _DEVICES.iteritems():
  96. if group in v['group']:
  97. device_list.append(k)
  98. return device_list
  99. # Dream, Magic, Eris, Hero Cliq are all the same
  100. # iphone, ipod touch, ipod nano, ipod classic are all the same