Created
March 26, 2021 21:22
-
-
Save DaneGardner/a97ed1b4b2e4e0eb1793597372d278a4 to your computer and use it in GitHub Desktop.
"Red alert" for locally run script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
raise NotImplementedError() | |
if __name__ == "__main__": | |
try: | |
main() | |
except Exception: | |
import vlc | |
from time import sleep | |
player = vlc.MediaPlayer("https://www.trekcore.com/audio/redalertandklaxons/tng_red_alert2.mp3") | |
player.audio_set_volume(100) | |
player.play() | |
sleep(7.0) # MP3 is 5 seconds long; play() is async | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment