Kodi plugin to to play various online streams (mostly Latvian)

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # -*- coding: utf-8 -*-
  2. """
  3. kodiswift.constants
  4. --------------------
  5. This module contains some helpful constants which ease interaction
  6. with Kodi.
  7. :copyright: (c) 2012 by Jonathan Beluch
  8. :license: GPLv3, see LICENSE for more details.
  9. """
  10. from __future__ import absolute_import
  11. from kodiswift import xbmcplugin
  12. __all__ = ['SortMethod']
  13. class SortMethod(object):
  14. """Static class to hold all of the available sort methods. The prefix
  15. of 'SORT_METHOD_' is stripped.
  16. e.g. SORT_METHOD_TITLE becomes SortMethod.TITLE
  17. """
  18. ALBUM = xbmcplugin.SORT_METHOD_ALBUM
  19. ALBUM_IGNORE_THE = xbmcplugin.SORT_METHOD_ALBUM_IGNORE_THE
  20. ARTIST = xbmcplugin.SORT_METHOD_ARTIST
  21. ARTIST_IGNORE_THE = xbmcplugin.SORT_METHOD_ARTIST_IGNORE_THE
  22. BITRATE = xbmcplugin.SORT_METHOD_BITRATE
  23. CHANNEL = xbmcplugin.SORT_METHOD_CHANNEL
  24. COUNTRY = xbmcplugin.SORT_METHOD_COUNTRY
  25. DATE = xbmcplugin.SORT_METHOD_DATE
  26. DATEADDED = xbmcplugin.SORT_METHOD_DATEADDED
  27. DATE_TAKEN = xbmcplugin.SORT_METHOD_DATE_TAKEN
  28. DRIVE_TYPE = xbmcplugin.SORT_METHOD_DRIVE_TYPE
  29. DURATION = xbmcplugin.SORT_METHOD_DURATION
  30. EPISODE = xbmcplugin.SORT_METHOD_EPISODE
  31. FILE = xbmcplugin.SORT_METHOD_FILE
  32. FULLPATH = xbmcplugin.SORT_METHOD_FULLPATH
  33. GENRE = xbmcplugin.SORT_METHOD_GENRE
  34. LABEL = xbmcplugin.SORT_METHOD_LABEL
  35. LABEL_IGNORE_FOLDERS = xbmcplugin.SORT_METHOD_LABEL_IGNORE_FOLDERS
  36. LABEL_IGNORE_THE = xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE
  37. LASTPLAYED = xbmcplugin.SORT_METHOD_LASTPLAYED
  38. LISTENERS = xbmcplugin.SORT_METHOD_LISTENERS
  39. MPAA_RATING = xbmcplugin.SORT_METHOD_MPAA_RATING
  40. NONE = xbmcplugin.SORT_METHOD_NONE
  41. PLAYCOUNT = xbmcplugin.SORT_METHOD_PLAYCOUNT
  42. PLAYLIST_ORDER = xbmcplugin.SORT_METHOD_PLAYLIST_ORDER
  43. PRODUCTIONCODE = xbmcplugin.SORT_METHOD_PRODUCTIONCODE
  44. PROGRAM_COUNT = xbmcplugin.SORT_METHOD_PROGRAM_COUNT
  45. SIZE = xbmcplugin.SORT_METHOD_SIZE
  46. SONG_RATING = xbmcplugin.SORT_METHOD_SONG_RATING
  47. STUDIO = xbmcplugin.SORT_METHOD_STUDIO
  48. STUDIO_IGNORE_THE = xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE
  49. TITLE = xbmcplugin.SORT_METHOD_TITLE
  50. TITLE_IGNORE_THE = xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE
  51. TRACKNUM = xbmcplugin.SORT_METHOD_TRACKNUM
  52. UNSORTED = xbmcplugin.SORT_METHOD_UNSORTED
  53. VIDEO_RATING = xbmcplugin.SORT_METHOD_VIDEO_RATING
  54. VIDEO_RUNTIME = xbmcplugin.SORT_METHOD_VIDEO_RUNTIME
  55. VIDEO_SORT_TITLE = xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE
  56. VIDEO_SORT_TITLE_IGNORE_THE = xbmcplugin.SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE
  57. VIDEO_TITLE = xbmcplugin.SORT_METHOD_VIDEO_TITLE
  58. VIDEO_USER_RATING = xbmcplugin.SORT_METHOD_VIDEO_USER_RATING
  59. VIDEO_YEAR = xbmcplugin.SORT_METHOD_VIDEO_YEAR
  60. @classmethod
  61. def from_string(cls, sort_method):
  62. """Returns the sort method specified. sort_method is case insensitive.
  63. Will raise an AttributeError if the provided sort_method does not
  64. exist.
  65. >>> SortMethod.from_string('title')
  66. """
  67. return getattr(cls, sort_method.upper())