Fix spacing & close sound file.

This commit is contained in:
Tony DiCola 2015-05-04 04:54:40 +00:00
parent 6ddb802fc7
commit 6cd7a794a0
2 changed files with 20 additions and 21 deletions

View File

@ -125,14 +125,13 @@ class VideoLooper(object):
# Get the video volume from the file in the usb key # Get the video volume from the file in the usb key
sound_vol_file_path = '{0}/{1}'.format(path.rstrip('/'), self._sound_vol_file) sound_vol_file_path = '{0}/{1}'.format(path.rstrip('/'), self._sound_vol_file)
if os.path.exists(sound_vol_file_path): if os.path.exists(sound_vol_file_path):
sound_file = open(sound_vol_file_path, 'r') with open(sound_vol_file_path, 'r') as sound_file:
sound_vol_string = sound_file.readline() sound_vol_string = sound_file.readline()
if self._is_number(sound_vol_string): if self._is_number(sound_vol_string):
self._sound_vol = int(float(sound_vol_string)) self._sound_vol = int(float(sound_vol_string))
# Create a playlist with the sorted list of movies. # Create a playlist with the sorted list of movies.
return Playlist(sorted(movies)) return Playlist(sorted(movies))
def _blank_screen(self): def _blank_screen(self):
"""Render a blank screen filled with the background color.""" """Render a blank screen filled with the background color."""
self._screen.fill(self._bgcolor) self._screen.fill(self._bgcolor)