How to use the pyatv.convert.media_kind function in pyatv

To help you get started, we’ve selected a few pyatv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github postlund / pyatv / tests / test_convert.py View on Github external
def test_video_media_kinds(self):
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MOVIE))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MUSICVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MUSICVIDEO2))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_VIDEOPASS))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_HOMEVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_FUTUREVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_ITUNESU))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_video_media_kinds(self):
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MOVIE))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MUSICVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MUSICVIDEO2))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_VIDEOPASS))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_HOMEVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_FUTUREVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_ITUNESU))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_music_media_kinds(self):
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_SONG))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_PODCAST))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_PODCAST2))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_COACHEDAUDIO))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_RINGTONE))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_VOICEMEMO))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_ALERTTONE))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_tv_kinds(self):
        self.assertEqual(MediaType.TV,
                         convert.media_kind(MEDIA_KIND_TVSHOW))
        self.assertEqual(MediaType.TV,
                         convert.media_kind(MEDIA_KIND_TVSHOW2))
github postlund / pyatv / tests / test_types.py View on Github external
def test_music_media_kinds(self):
        self.assertEqual(const.MEDIA_TYPE_MUSIC,
                         convert.media_kind(MEDIA_KIND_SONG))
        self.assertEqual(const.MEDIA_TYPE_MUSIC,
                         convert.media_kind(MEDIA_KIND_PODCAST))
        self.assertEqual(const.MEDIA_TYPE_MUSIC,
                         convert.media_kind(MEDIA_KIND_COACHEDAUDIO))
        self.assertEqual(const.MEDIA_TYPE_MUSIC,
                         convert.media_kind(MEDIA_KIND_RINGTONE))
        self.assertEqual(const.MEDIA_TYPE_MUSIC,
                         convert.media_kind(MEDIA_KIND_VOICEMEMO))
        self.assertEqual(const.MEDIA_TYPE_MUSIC,
                         convert.media_kind(MEDIA_KIND_ALERTTONE))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_music_media_kinds(self):
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_SONG))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_PODCAST))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_PODCAST2))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_COACHEDAUDIO))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_RINGTONE))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_VOICEMEMO))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_ALERTTONE))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_unknown_media_kind_throws(self):
        with self.assertRaises(exceptions.UnknownMediaKind):
            convert.media_kind(99999)
github postlund / pyatv / tests / test_convert.py View on Github external
def test_music_media_kinds(self):
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_SONG))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_PODCAST))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_PODCAST2))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_COACHEDAUDIO))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_RINGTONE))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_VOICEMEMO))
        self.assertEqual(MediaType.Music,
                         convert.media_kind(MEDIA_KIND_ALERTTONE))
github postlund / pyatv / tests / test_convert.py View on Github external
def test_video_media_kinds(self):
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MOVIE))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MUSICVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_MUSICVIDEO2))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_VIDEOPASS))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_HOMEVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_FUTUREVIDEO))
        self.assertEqual(MediaType.Video,
                         convert.media_kind(MEDIA_KIND_ITUNESU))
github postlund / pyatv / pyatv / dmap / __init__.py View on Github external
def media_type(self):
        """Type of media is currently playing, e.g. video, music."""
        state = parser.first(self.playstatus, 'cmst', 'caps')
        if not state:
            return MediaType.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 MediaType.Music

        return MediaType.Video