import datetime
import connexion
import six

from src.rest.models.play_log_entry import PlayLogEntry  # noqa: E501
from src.rest import util

from flask import current_app


def current_track():  # noqa: E501
    """Get current track

    Retrieves the currently playing track.  # noqa: E501


    :rtype: PlayLogEntry
    """
    service = current_app.config['SERVICE']
    return service.current_track()


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']
    return service.list_tracks(offset, limit)