Return what is currently playing.
966103
async def playing(self):
        """"""
        # TODO: This is hack-ish
        if self._setstate is None:
            await self.protocol.start()

        # No SET_STATE_MESSAGE received yet, use default
        if self._setstate is None:
            return MrpPlaying(protobuf.SetStateMessage(), None)

        return MrpPlaying(self._setstate, self._nowplaying)
1364839
def get_playcount(self):
        """"""

        doc = self._request(self.ws_prefix + ".getInfo", True)

        return _number(_extract(doc, "playcount"))
387702
def get_sound(self, title, group):
        '''
        
        '''
        return self.sounds[group.lower()][title.lower()]
411402
def get_current_cmus():
    
    result = subprocess.run('cmus-remote -Q'.split(' '), check=True,
                            stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
    info = {}
    for line in result.stdout.decode().split('\n'):
        line = line.split(' ')
        if line[0] != 'tag':
            continue
        key = line[1]
        if key in ['album', 'title', 'artist', 'albumartist'] and\
           key not in info:
            info[key] = ' '.join(line[2:])

    if 'albumartist' in info:
        info['artist'] = info['albumartist']
        del info['albumartist']

    return Song(**info)
45339
def stop_playback(self):
        """"""
        self._sink.flush()
        self._sink.stop()
        self._playing = False
529227
def _play(self):
        """"""
        # Use pause command only for sources which support NETAUDIO
        if self._input_func in self._netaudio_func_list:
            body = {"cmd0": "PutNetAudioCommand/CurEnter",
                    "cmd1": "aspMainZone_WebUpdateStatus/",
                    "ZoneName": "MAIN ZONE"}
            try:
                if self.send_post_command(
                        self._urls.command_netaudio_post, body):
                    self._state = STATE_PLAYING
                    return True
                else:
                    return False
            except requests.exceptions.RequestException:
                _LOGGER.error("Connection error: play command not sent.")
                return False
952616
def playlist(self, playlist_id, *, include_songs=False):
		

		playlist_info = next(
			(
				playlist
				for playlist in self.playlists(include_songs=include_songs)
				if playlist['id'] == playlist_id
			),
			None
		)

		return playlist_info
248649
async def status(dev: Device):
    """"""
    power = await dev.get_power()
    click.echo(click.style("%s" % power, bold=power))

    vol = await dev.get_volume_information()
    click.echo(vol.pop())

    play_info = await dev.get_play_info()
    if not play_info.is_idle:
        click.echo("Playing %s" % play_info)
    else:
        click.echo("Not playing any media")

    outs = await dev.get_inputs()
    for out in outs:
        if out.active:
            click.echo("Active output: %s" % out)

    sysinfo = await dev.get_system_info()
    click.echo("System information: %s" % sysinfo)
143815
def play():
    """"""
    with sqlite3.connect(ARGS.database) as connection:
        connection.text_factory = str
        cursor = connection.cursor()
        if ARGS.pattern:
            if not ARGS.strict:
                ARGS.pattern = '%{0}%'.format(ARGS.pattern)
            cursor.execute('SELECT * FROM Movies WHERE Name LIKE (?)',
                           [ARGS.pattern])
            try:
                path = sorted([row for row in cursor])[0][1]
                replace_map = {' ': '\\ ', '"': '\\"', "'": "\\'"}
                for key, val in replace_map.iteritems():
                    path = path.replace(key, val)
                os.system('{0} {1} &'.format(ARGS.player, path))
            except IndexError:
                exit('Error: Movie not found.')
1105933
def sound_mode(self):
        """"""
        sound_mode_matched = self._parent_avr.match_sound_mode(
            self._parent_avr.sound_mode_raw)
        return sound_mode_matched
849656
async def print_what_is_playing(loop):
    """"""
    print('Discovering devices on network...')
    atvs = await pyatv.scan_for_apple_tvs(loop, timeout=5)

    if not atvs:
        print('no device found', file=sys.stderr)
        return

    print('Connecting to {0}'.format(atvs[0].address))
    atv = pyatv.connect_to_apple_tv(atvs[0], loop)

    try:
        playing = await atv.metadata.playing()
        print('Currently playing:')
        print(playing)
    finally:
        # Do not forget to logout
        await atv.logout()
49619
def media_type(self):
        """"""
        state = parser.first(self.playstatus, 'cmst', 'caps')
        if not state:
            return const.MEDIA_TYPE_UNKNOWN

        mediakind = parser.first(self.playstatus, 'cmst', 'cmmk')
        if mediakind is not None:
            return convert.media_kind(mediakind)

        # Fallback: if artist or album exists we assume music (not present
        # for video)
        if self.artist or self.album:
            return const.MEDIA_TYPE_MUSIC

        return const.MEDIA_TYPE_VIDEO
180589
private void checkStatePlaying()
    {
        if (!reverse)
        {
            if (repeat)
            {
                state = AnimState.PLAYING;
                current = first;
            }
            else
            {
                state = AnimState.FINISHED;
            }
        }
        else
        {
            state = AnimState.REVERSING;
        }
    }
846711
def play(quiet, session_file, shell, speed, prompt, commentecho):
    """"""
    run(
        session_file.readlines(),
        shell=shell,
        speed=speed,
        quiet=quiet,
        test_mode=TESTING,
        prompt_template=prompt,
        commentecho=commentecho,
    )
143605
def media_type_str(mediatype):
    """"""
    if mediatype == const.MEDIA_TYPE_UNKNOWN:
        return 'Unknown'
    if mediatype == const.MEDIA_TYPE_VIDEO:
        return 'Video'
    if mediatype == const.MEDIA_TYPE_MUSIC:
        return 'Music'
    if mediatype == const.MEDIA_TYPE_TV:
        return 'TV'
    return 'Unsupported'
1349741
def position(self):
        """"""
        now_playing = self._setstate.nowPlayingInfo
        if now_playing.HasField('elapsedTime'):
            return int(now_playing.elapsedTime)

        return None
160839
def _goto_playing_station(self, changing_playlist=False):
        
        if (self.player.isPlaying() or self.operation_mode == PLAYLIST_MODE) and \
            (self.selection != self.playing or changing_playlist):
            if changing_playlist:
                self.startPos = 0
            max_lines = self.bodyMaxY - 2
            if logger.isEnabledFor(logging.INFO):
                logger.info('max_lines = {0}, self.playing = {1}'.format(max_lines, self.playing))
            if self.number_of_items < max_lines:
                self.startPos = 0
            elif self.playing < self.startPos or \
                    self.playing >= self.startPos + max_lines:
                if logger.isEnabledFor(logging.INFO):
                    logger.info('=== _goto:adjusting startPos')
                if self.playing < max_lines:
                    self.startPos = 0
                    if self.playing - int(max_lines/2) > 0:
                        self.startPos = self.playing - int(max_lines/2)
                elif self.playing > self.number_of_items - max_lines:
                    self.startPos = self.number_of_items - max_lines
                else:
                    self.startPos = int(self.playing+1/max_lines) - int(max_lines/2)
            if logger.isEnabledFor(logging.INFO):
                logger.info('===== _goto:startPos = {0}, changing_playlist = {1}'.format(self.startPos, changing_playlist))
            self.selection = self.playing
            self.refreshBody()