| @@ -91,7 +91,8 @@ class VideoLooper: | |||||
| # Set GPIO Pin to input mode | # Set GPIO Pin to input mode | ||||
| if self._gpio_control: | if self._gpio_control: | ||||
| wiringpi.pinMode(self._gpio_control_pin, 0) | |||||
| wiringpi.wiringPiSetup() | |||||
| wiringpi.pinMode(int(self._gpio_control_pin), 0) | |||||
| def _print(self, message): | def _print(self, message): | ||||
| @@ -244,8 +245,7 @@ class VideoLooper: | |||||
| self._prepare_to_run_playlist(playlist) | self._prepare_to_run_playlist(playlist) | ||||
| # Main loop to play videos in the playlist and listen for file changes. | # Main loop to play videos in the playlist and listen for file changes. | ||||
| while self._running: | while self._running: | ||||
| if not self._gpio_control or wiringpi.digitalRead(self._gpio_control_pin) == self._gpio_control_upstate: | |||||
| if not self._gpio_control or wiringpi.digitalRead(int(self._gpio_control_pin)) == int(self._gpio_control_upstate): | |||||
| # Load and play a new movie if nothing is playing. | # Load and play a new movie if nothing is playing. | ||||
| if not self._player.is_playing(): | if not self._player.is_playing(): | ||||
| movie = playlist.get_next() | movie = playlist.get_next() | ||||
| @@ -271,8 +271,8 @@ class VideoLooper: | |||||
| else: | else: | ||||
| self._player.stop() | self._player.stop() | ||||
| # Give the CPU some time to do other tasks. | |||||
| time.sleep(0.002) | |||||
| # Give the CPU some time to do other tasks. | |||||
| time.sleep(0.1) | |||||
| def quit(self): | def quit(self): | ||||
| """Shut down the program""" | """Shut down the program""" | ||||