other.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. class OtherEndpointsMixin:
  2. """
  3. Various endpoints dealing with the Showroom service and menus
  4. """
  5. def avatar_server_settings(self):
  6. """
  7. Some info about where avatars are stored, e.g.:
  8. {
  9. "version": 41,
  10. "path": "https://image.showroom-live.com/showroom-prod/image/avatar/",
  11. "f_ext": "png"
  12. }
  13. :return:
  14. """
  15. endpoint = "/api/avatar/server_settings"
  16. result = self._api_get(endpoint)
  17. return result
  18. def radio_images(self):
  19. """
  20. A list of background images for radio broadcasts
  21. :return:
  22. """
  23. endpoint = "/api/radio_images"
  24. result = self._api_get(endpoint)
  25. return result.get('radio_images')
  26. def service_settings(self):
  27. """
  28. Global(?) default settings for showroom streams
  29. Includes avatar_server_settings in the avatar_url field
  30. :return:
  31. """
  32. endpoint = "/api/service_settings/"
  33. result = self._api_get(endpoint)
  34. return result
  35. def side_navigation_menu(self):
  36. """
  37. Gets contents of the side navigation menu, including language specific labels
  38. Three fields, the main one of interest is menu_list
  39. :return:
  40. """
  41. endpoint = "/api/menu/side_navi"
  42. result = self._api_get(endpoint)
  43. return result
  44. def broadcast_menu(self):
  45. """
  46. No idea. Just returns {"menu_list":[]} for me. Maybe only returns something if you are streaming?
  47. :return:
  48. """
  49. endpoint = "/api/menu/broadcast"
  50. result = self._api_get(endpoint)
  51. return result
  52. def talks(self):
  53. """
  54. Get lists of talks
  55. Three lists, of popular, live, and followed talks
  56. Formatted for display, so included in the lists are headers and messages to the user
  57. :return:
  58. """
  59. endpoint = "/api/talk/talks"
  60. result = self._api_get(endpoint)
  61. return result.get('talks')
  62. def time_tables(self, started_at=None, order=None):
  63. """
  64. :param started_at: int
  65. :param order: str
  66. :return:
  67. """
  68. # TODO: find out what valid values for order are. NEXT/PREV?
  69. endpoint = "/api/time_table/time_tables"
  70. result = self._api_get(endpoint, params=dict(started_at=started_at, order=order))
  71. return result