mpd: Add warnings to deprecated commands
This commit is contained in:
parent
a7f4ffb124
commit
2de897fb9c
@ -1,5 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import warnings
|
||||
|
||||
from mopidy.mpd import exceptions, protocol, translator
|
||||
|
||||
|
||||
@ -160,7 +162,8 @@ def playlist(context):
|
||||
|
||||
Do not use this, instead use ``playlistinfo``.
|
||||
"""
|
||||
# TODO: warn about this being deprecated
|
||||
warnings.warn(
|
||||
'Do not use this, instead use playlistinfo', DeprecationWarning)
|
||||
return playlistinfo(context)
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import warnings
|
||||
|
||||
from mopidy.core import PlaybackState
|
||||
from mopidy.mpd import exceptions, protocol
|
||||
|
||||
@ -102,7 +104,10 @@ def pause(context, state=None):
|
||||
- Calls ``pause`` without any arguments to toogle pause.
|
||||
"""
|
||||
if state is None:
|
||||
# TODO: emit warning about this being deprecated
|
||||
warnings.warn(
|
||||
'The use of pause command w/o the PAUSE argument is deprecated.',
|
||||
DeprecationWarning)
|
||||
|
||||
if (context.core.playback.state.get() == PlaybackState.PLAYING):
|
||||
context.core.playback.pause()
|
||||
elif (context.core.playback.state.get() == PlaybackState.PAUSED):
|
||||
@ -339,10 +344,10 @@ def seekcur(context, time):
|
||||
"""
|
||||
if time.startswith(('+', '-')):
|
||||
position = context.core.playback.time_position.get()
|
||||
position += int(time) * 1000
|
||||
position += protocol.INT(time) * 1000
|
||||
context.core.playback.seek(position).get()
|
||||
else:
|
||||
position = int(time) * 1000
|
||||
position = protocol.UINT(time) * 1000
|
||||
context.core.playback.seek(position).get()
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user