Ensure that scanner does not die on non-existant folders

This commit is contained in:
Thomas Adamcik 2010-10-28 00:47:18 +02:00
parent 2ebaa38ed9
commit d9d393ac21
2 changed files with 7 additions and 2 deletions

View File

@ -99,8 +99,9 @@ class Scanner(object):
self.pipe.set_state(gst.STATE_PAUSED)
def start(self):
self.next_uri()
self.loop.run()
if self.uris:
self.next_uri()
self.loop.run()
def stop(self):
self.pipe.set_state(gst.STATE_NULL)

View File

@ -90,6 +90,10 @@ class ScannerTest(unittest.TestCase):
self.scan('scanner/simple')
self.check('scanner/simple/song1.mp3', 'title', 'trackname')
def test_nonexistant_folder_does_not_fail(self):
self.scan('scanner/does-not-exist')
self.assert_(not self.errors)
def test_other_media_is_ignored(self):
self.scan('scanner/image')
self.assert_(self.errors)