本文整理汇总了Python中mopidy.frontends.mpd.protocol.status.status函数的典型用法代码示例。如果您正苦于以下问题:Python status函数的具体用法?Python status怎么用?Python status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_status_method_when_starting_playing_contains_elapsed_zero
def test_status_method_when_starting_playing_contains_elapsed_zero(self):
self.core.tracklist.add([Track(uri='dummy:a', length=10000)])
self.core.playback.play()
self.core.playback.pause()
result = dict(status.status(self.context))
self.assertIn('elapsed', result)
self.assertEqual(result['elapsed'], '0.000')
示例2: test_status_method_when_playing_contains_elapsed
def test_status_method_when_playing_contains_elapsed(self):
self.core.tracklist.add([Track(uri='dummy:a', length=60000)])
self.core.playback.play()
self.core.playback.pause()
self.core.playback.seek(59123)
result = dict(status.status(self.context))
self.assertIn('elapsed', result)
self.assertEqual(result['elapsed'], '59.123')
示例3: test_status_method_when_playing_contains_time_with_length
def test_status_method_when_playing_contains_time_with_length(self):
self.backend.current_playlist.append([Track(length=10000)])
self.backend.playback.play()
result = dict(status.status(self.context))
self.assert_("time" in result)
(position, total) = result["time"].split(":")
position = int(position)
total = int(total)
self.assert_(position <= total)
示例4: test_status_method_when_playing_contains_time_with_no_length
def test_status_method_when_playing_contains_time_with_no_length(self):
self.backend.current_playlist.append([Track(length=None)])
self.backend.playback.play()
result = dict(status.status(self.context))
self.assertIn('time', result)
(position, total) = result['time'].split(':')
position = int(position)
total = int(total)
self.assert_(position <= total)
示例5: test_status_method_when_playing_contains_time_with_length
def test_status_method_when_playing_contains_time_with_length(self):
self.core.tracklist.add([Track(uri='dummy:a', length=10000)])
self.core.playback.play()
result = dict(status.status(self.context))
self.assertIn('time', result)
(position, total) = result['time'].split(':')
position = int(position)
total = int(total)
self.assertLessEqual(position, total)
示例6: test_status_method_contains_volume
def test_status_method_contains_volume(self):
self.mixer.volume = 17
result = dict(status.status(self.context))
self.assert_("volume" in result)
self.assertEqual(int(result["volume"]), 17)
示例7: test_status_method_when_playing_contains_bitrate
def test_status_method_when_playing_contains_bitrate(self):
self.backend.current_playlist.append([Track(bitrate=320)])
self.backend.playback.play()
result = dict(status.status(self.context))
self.assert_("bitrate" in result)
self.assertEqual(int(result["bitrate"]), 320)
示例8: test_status_method_contains_state_is_pause
def test_status_method_contains_state_is_pause(self):
self.backend.playback.state = PLAYING
self.backend.playback.state = PAUSED
result = dict(status.status(self.context))
self.assert_("state" in result)
self.assertEqual(result["state"], "pause")
示例9: test_status_method_contains_xfade
def test_status_method_contains_xfade(self):
result = dict(status.status(self.context))
self.assert_("xfade" in result)
self.assert_(int(result["xfade"]) >= 0)
示例10: test_status_method_contains_playlist
def test_status_method_contains_playlist(self):
result = dict(status.status(self.context))
self.assert_("playlist" in result)
self.assert_(int(result["playlist"]) in xrange(0, 2 ** 31 - 1))
示例11: test_status_method_contains_repeat_is_1
def test_status_method_contains_repeat_is_1(self):
self.backend.playback.repeat = 1
result = dict(status.status(self.context))
self.assertIn('repeat', result)
self.assertEqual(int(result['repeat']), 1)
示例12: test_status_method_contains_volume
def test_status_method_contains_volume(self):
self.backend.playback.volume = 17
result = dict(status.status(self.context))
self.assertIn('volume', result)
self.assertEqual(int(result['volume']), 17)
示例13: test_status_method_contains_volume_with_na_value
def test_status_method_contains_volume_with_na_value(self):
result = dict(status.status(self.context))
self.assertIn('volume', result)
self.assertEqual(int(result['volume']), -1)
示例14: test_status_method_when_starting_playing_contains_elapsed_zero
def test_status_method_when_starting_playing_contains_elapsed_zero(self):
self.backend.playback.state = PAUSED
self.backend.playback.play_time_accumulated = 123 # Less than 1000ms
result = dict(status.status(self.context))
self.assertIn('elapsed', result)
self.assertEqual(result['elapsed'], '0.123')
示例15: test_status_method_when_playing_contains_elapsed
def test_status_method_when_playing_contains_elapsed(self):
self.backend.playback.state = PAUSED
self.backend.playback.play_time_accumulated = 59123
result = dict(status.status(self.context))
self.assertIn('elapsed', result)
self.assertEqual(result['elapsed'], '59.123')