Add empty handlers for music database commands
This commit is contained in:
parent
f15967bcf3
commit
5c64a39ad4
@ -66,6 +66,10 @@ class MpdHandler(object):
|
||||
else:
|
||||
pass # TODO
|
||||
|
||||
@register(r'^count (?P<tag>\S+) (?P<needle>\S+)$')
|
||||
def _count(self, tag, needle):
|
||||
pass # TODO
|
||||
|
||||
@register(r'^crossfade "(?P<seconds>\d+)"$')
|
||||
def _crossfade(self, seconds):
|
||||
seconds = int(seconds)
|
||||
@ -87,6 +91,16 @@ class MpdHandler(object):
|
||||
def _empty(self):
|
||||
pass
|
||||
|
||||
@register(r'^find (?P<type>(album|artist|title)) (?P<what>.*)$')
|
||||
def _find(self, type, what):
|
||||
pass # TODO
|
||||
|
||||
@register(r'^findadd (?P<type>(album|artist|title)) (?P<what>.*)$')
|
||||
def _findadd(self, type, what):
|
||||
result = self._find(type, what)
|
||||
# TODO Add result to current playlist
|
||||
return result
|
||||
|
||||
@register(r'^idle( (?P<subsystems>.+))*$')
|
||||
def _idle(self, subsystems=None):
|
||||
pass # TODO
|
||||
@ -95,6 +109,20 @@ class MpdHandler(object):
|
||||
def _kill(self):
|
||||
self.session.do_kill()
|
||||
|
||||
@register(r'^list (?P<type>(artist|album))( (?P<artist>.*))*$')
|
||||
def _list(self, type, artist=None):
|
||||
if type == u'artist' and artist is not None:
|
||||
return False
|
||||
pass # TODO
|
||||
|
||||
@register(r'^listall "(?P<uri>[^"]+)"')
|
||||
def _listall(self, uri):
|
||||
pass # TODO
|
||||
|
||||
@register(r'^listallinfo "(?P<uri>[^"]+)"')
|
||||
def _listallinfo(self, uri):
|
||||
pass # TODO
|
||||
|
||||
@register(r'^listplaylist (?P<name>.+)$')
|
||||
def _listplaylist(self, name):
|
||||
pass # TODO
|
||||
@ -115,8 +143,7 @@ class MpdHandler(object):
|
||||
def _lsinfo(self, uri):
|
||||
if uri == u'/':
|
||||
return self._listplaylists()
|
||||
# TODO
|
||||
return self._listplaylists()
|
||||
pass # TODO
|
||||
|
||||
@register(r'^move ((?P<songpos>\d+)|(?P<start>\d+):(?P<end>\d+)*) (?P<to>\d+)$')
|
||||
def _move(self, songpos=None, start=None, end=None, to=None):
|
||||
@ -226,6 +253,10 @@ class MpdHandler(object):
|
||||
def _replay_gain_status(self):
|
||||
return u'off' # TODO
|
||||
|
||||
@register(r'^rescan( "(?P<uri>[^"]+)")*$')
|
||||
def _update(self, uri=None):
|
||||
return self._update(uri, rescan_unmodified_files=True)
|
||||
|
||||
@register(r'^rm (?P<name>\S+)$')
|
||||
def _rm(self, name):
|
||||
pass # TODO
|
||||
@ -234,6 +265,10 @@ class MpdHandler(object):
|
||||
def _save(self, name):
|
||||
pass # TODO
|
||||
|
||||
@register(r'^search (?P<type>(album|artist|filename|title)) (?P<what>.+)$')
|
||||
def _search(self, type, what):
|
||||
pass # TODO
|
||||
|
||||
@register(r'^seek (?P<songpos>.+) (?P<seconds>\d+)$')
|
||||
def _seek(self, songpos, seconds):
|
||||
pass # TODO
|
||||
@ -301,3 +336,7 @@ class MpdHandler(object):
|
||||
@register(r'^swapid (?P<songid1>\S+) (?P<songid2>\S+)$')
|
||||
def _swapid(self, songid1, songid2):
|
||||
pass # TODO
|
||||
|
||||
@register(r'^update( "(?P<uri>[^"]+)")*$')
|
||||
def _update(self, uri=None, rescan_unmodified_files=False):
|
||||
return u'updating_db: 0' # TODO
|
||||
|
||||
@ -400,7 +400,53 @@ class MusicDatabaseHandlerTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.h = handler.MpdHandler(backend=DummyBackend)
|
||||
|
||||
pass # TODO
|
||||
def test_count(self):
|
||||
result = self.h.handle_request(u'count tag needle')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_find_album(self):
|
||||
result = self.h.handle_request(u'find album what')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_find_artist(self):
|
||||
result = self.h.handle_request(u'find artist what')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_find_title(self):
|
||||
result = self.h.handle_request(u'find title what')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_find_else_should_fail(self):
|
||||
result = self.h.handle_request(u'find somethingelse what')
|
||||
self.assert_(result is False)
|
||||
|
||||
def test_findadd(self):
|
||||
result = self.h.handle_request(u'findadd album what')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_list_artist(self):
|
||||
result = self.h.handle_request(u'list artist')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_list_artist_with_artist_should_fail(self):
|
||||
result = self.h.handle_request(u'list artist anartist')
|
||||
self.assert_(result is False)
|
||||
|
||||
def test_list_album_without_artist(self):
|
||||
result = self.h.handle_request(u'list album')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_list_album_with_artist(self):
|
||||
result = self.h.handle_request(u'list album anartist')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_listall(self):
|
||||
result = self.h.handle_request(u'listall "file:///dev/urandom"')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_listallinfo(self):
|
||||
result = self.h.handle_request(u'listallinfo "file:///dev/urandom"')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_lsinfo_for_root_returns_same_as_listplaylists(self):
|
||||
lsinfo_result = self.h.handle_request(u'lsinfo "/"')
|
||||
@ -411,6 +457,54 @@ class MusicDatabaseHandlerTest(unittest.TestCase):
|
||||
result = self.h.handle_request(u'lsinfo ""')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_search_album(self):
|
||||
result = self.h.handle_request(u'search album analbum')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_search_artist(self):
|
||||
result = self.h.handle_request(u'search artist anartist')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_search_filename(self):
|
||||
result = self.h.handle_request(u'search filename afilename')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_search_title(self):
|
||||
result = self.h.handle_request(u'search title atitle')
|
||||
self.assert_(result is None)
|
||||
|
||||
def test_search_else_should_fail(self):
|
||||
result = self.h.handle_request(u'search sometype something')
|
||||
self.assert_(result is False)
|
||||
|
||||
def test_update_without_uri(self):
|
||||
result = self.h.handle_request(u'update')
|
||||
(label, jobid) = result.split(':', 1)
|
||||
self.assertEquals(u'updating_db', label)
|
||||
self.assert_(jobid.strip().isdigit())
|
||||
self.assert_(int(jobid) >= 0)
|
||||
|
||||
def test_update_with_uri(self):
|
||||
result = self.h.handle_request(u'update "file:///dev/urandom"')
|
||||
(label, jobid) = result.split(':', 1)
|
||||
self.assertEquals(u'updating_db', label)
|
||||
self.assert_(jobid.strip().isdigit())
|
||||
self.assert_(int(jobid) >= 0)
|
||||
|
||||
def test_rescan_without_uri(self):
|
||||
result = self.h.handle_request(u'rescan')
|
||||
(label, jobid) = result.split(':', 1)
|
||||
self.assertEquals(u'updating_db', label)
|
||||
self.assert_(jobid.strip().isdigit())
|
||||
self.assert_(int(jobid) >= 0)
|
||||
|
||||
def test_rescan_with_uri(self):
|
||||
result = self.h.handle_request(u'rescan "file:///dev/urandom"')
|
||||
(label, jobid) = result.split(':', 1)
|
||||
self.assertEquals(u'updating_db', label)
|
||||
self.assert_(jobid.strip().isdigit())
|
||||
self.assert_(int(jobid) >= 0)
|
||||
|
||||
|
||||
class StickersHandlerTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user