Plex plugin to to play various online streams (mostly Latvian).

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # -*- coding: utf-8 -*-
  2. from .structures import LookupDict
  3. _codes = {
  4. # Informational.
  5. 100: ('continue',),
  6. 101: ('switching_protocols',),
  7. 102: ('processing',),
  8. 103: ('checkpoint',),
  9. 122: ('uri_too_long', 'request_uri_too_long'),
  10. 200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/', '✓'),
  11. 201: ('created',),
  12. 202: ('accepted',),
  13. 203: ('non_authoritative_info', 'non_authoritative_information'),
  14. 204: ('no_content',),
  15. 205: ('reset_content', 'reset'),
  16. 206: ('partial_content', 'partial'),
  17. 207: ('multi_status', 'multiple_status', 'multi_stati', 'multiple_stati'),
  18. 208: ('already_reported',),
  19. 226: ('im_used',),
  20. # Redirection.
  21. 300: ('multiple_choices',),
  22. 301: ('moved_permanently', 'moved', '\\o-'),
  23. 302: ('found',),
  24. 303: ('see_other', 'other'),
  25. 304: ('not_modified',),
  26. 305: ('use_proxy',),
  27. 306: ('switch_proxy',),
  28. 307: ('temporary_redirect', 'temporary_moved', 'temporary'),
  29. 308: ('permanent_redirect',
  30. 'resume_incomplete', 'resume',), # These 2 to be removed in 3.0
  31. # Client Error.
  32. 400: ('bad_request', 'bad'),
  33. 401: ('unauthorized',),
  34. 402: ('payment_required', 'payment'),
  35. 403: ('forbidden',),
  36. 404: ('not_found', '-o-'),
  37. 405: ('method_not_allowed', 'not_allowed'),
  38. 406: ('not_acceptable',),
  39. 407: ('proxy_authentication_required', 'proxy_auth', 'proxy_authentication'),
  40. 408: ('request_timeout', 'timeout'),
  41. 409: ('conflict',),
  42. 410: ('gone',),
  43. 411: ('length_required',),
  44. 412: ('precondition_failed', 'precondition'),
  45. 413: ('request_entity_too_large',),
  46. 414: ('request_uri_too_large',),
  47. 415: ('unsupported_media_type', 'unsupported_media', 'media_type'),
  48. 416: ('requested_range_not_satisfiable', 'requested_range', 'range_not_satisfiable'),
  49. 417: ('expectation_failed',),
  50. 418: ('im_a_teapot', 'teapot', 'i_am_a_teapot'),
  51. 421: ('misdirected_request',),
  52. 422: ('unprocessable_entity', 'unprocessable'),
  53. 423: ('locked',),
  54. 424: ('failed_dependency', 'dependency'),
  55. 425: ('unordered_collection', 'unordered'),
  56. 426: ('upgrade_required', 'upgrade'),
  57. 428: ('precondition_required', 'precondition'),
  58. 429: ('too_many_requests', 'too_many'),
  59. 431: ('header_fields_too_large', 'fields_too_large'),
  60. 444: ('no_response', 'none'),
  61. 449: ('retry_with', 'retry'),
  62. 450: ('blocked_by_windows_parental_controls', 'parental_controls'),
  63. 451: ('unavailable_for_legal_reasons', 'legal_reasons'),
  64. 499: ('client_closed_request',),
  65. # Server Error.
  66. 500: ('internal_server_error', 'server_error', '/o\\', '✗'),
  67. 501: ('not_implemented',),
  68. 502: ('bad_gateway',),
  69. 503: ('service_unavailable', 'unavailable'),
  70. 504: ('gateway_timeout',),
  71. 505: ('http_version_not_supported', 'http_version'),
  72. 506: ('variant_also_negotiates',),
  73. 507: ('insufficient_storage',),
  74. 509: ('bandwidth_limit_exceeded', 'bandwidth'),
  75. 510: ('not_extended',),
  76. 511: ('network_authentication_required', 'network_auth', 'network_authentication'),
  77. }
  78. codes = LookupDict(name='status_codes')
  79. for code, titles in _codes.items():
  80. for title in titles:
  81. setattr(codes, title, code)
  82. if not title.startswith('\\'):
  83. setattr(codes, title.upper(), code)