mpd: Replace filterwarnings with deprecation helper

This commit is contained in:
Thomas Adamcik 2015-04-18 23:04:48 +02:00
parent 5acc3ea564
commit 9871d999bb

View File

@ -2,7 +2,6 @@ from __future__ import absolute_import, unicode_literals
import functools
import itertools
import warnings
from mopidy.models import Track
from mopidy.mpd import exceptions, protocol, translator
@ -174,10 +173,9 @@ def findadd(context, *args):
results = context.core.library.search(query=query, exact=True).get()
with warnings.catch_warnings():
with deprecation.ignore('core.tracklist.add:tracks_arg'):
# TODO: for now just use tracks as other wise we have to lookup the
# tracks we just got from the search.
warnings.filterwarnings('ignore', 'tracklist.add.*"tracks" argument.*')
context.core.tracklist.add(tracks=_get_tracks(results)).get()
@ -452,10 +450,9 @@ def searchadd(context, *args):
results = context.core.library.search(query).get()
with warnings.catch_warnings():
with deprecation.ignore('core.tracklist.add:tracks_arg'):
# TODO: for now just use tracks as other wise we have to lookup the
# tracks we just got from the search.
warnings.filterwarnings('ignore', 'tracklist.add.*"tracks".*')
context.core.tracklist.add(_get_tracks(results)).get()