Skip to content
Snippets Groups Projects
public_controller.py 882 B
Newer Older
  • Learn to ignore specific revisions
  • David Trattnig's avatar
    David Trattnig committed
    
    import datetime
    
    David Trattnig's avatar
    David Trattnig committed
    import connexion
    import six
    
    
    from src.rest.models.play_log_entry import PlayLogEntry  # noqa: E501
    from src.rest import util
    
    David Trattnig's avatar
    David Trattnig committed
    
    
    from flask import current_app
    
    
    David Trattnig's avatar
    David Trattnig committed
    def current_track():  # noqa: E501
        """Get current track
    
        Retrieves the currently playing track.  # noqa: E501
    
    
        :rtype: PlayLogEntry
        """
    
        service = current_app.config['SERVICE']
    
    David Trattnig's avatar
    David Trattnig committed
        return service.current_track()
    
    David Trattnig's avatar
    David Trattnig committed
    
    
    def list_tracks(offset=None, limit=None):  # noqa: E501
        """List recent tracks in the play-log
    
        Lists the most recent track-service entries.  # noqa: E501
    
        :param offset: The number of items to skip before starting to collect the result set
        :type offset: int
        :param limit: The numbers of items to return
        :type limit: int
    
        :rtype: List[PlayLogEntry]
        """
    
        service = current_app.config['SERVICE']
    
    David Trattnig's avatar
    David Trattnig committed
        return service.list_tracks(offset, limit)