Skip to content
Browse files

Added NoImagesException

  • Loading branch information...
1 parent 46bbeb0 commit af355b147adc33e6ceb2b4170dbe8fb4c865ec33 @dersphere committed Jun 15, 2014
Showing with 10 additions and 1 deletion.
  1. +10 −1 screensaver.py
View
11 screensaver.py
@@ -56,6 +56,10 @@
ACTION_IDS_EXIT = [9, 10, 13, 92]
+class NoImagesException(Exception):
+ pass
+
+
class ScreensaverManager(object):
def __new__(cls):
@@ -192,6 +196,8 @@ def get_images(self):
self._get_json_images('VideoLibrary.GetMovies', 'movies', 'fanart')
or self._get_json_images('AudioLibrary.GetArtists', 'artists', 'fanart')
)
+ if not images:
+ raise NoImagesException
return images
def _get_json_images(self, method, key, prop):
@@ -574,7 +580,10 @@ def cycle(iterable):
if __name__ == '__main__':
screensaver = ScreensaverManager()
- screensaver.start_loop()
+ try:
+ screensaver.start_loop()
+ except NoImagesException:
+ pass
screensaver.close()
del screensaver
sys.modules.clear()

0 comments on commit af355b1

Please sign in to comment.
Something went wrong with that request. Please try again.