API Index¶
Module snakejazz.snakejazz
¶
SnakeJazz.
Listen to the running status of your ~~Snake~~ Python functions.
-
exception
snakejazz.snakejazz.
SnakeNotFoundError
[source]¶ Bases:
FileNotFoundError
Raised when the file can’t be found.
-
snakejazz.snakejazz.
play_sound
(sound_path, loops=0)[source]¶ Reproduce the sound.
The library PyGame is used to reproduce sounds.
- Parameters
sound_path (string, path) – Path to the sound file.
loops (int) –
Number of times the sound will be played.
0: A single time
-1: Inifinte loop
-
snakejazz.snakejazz.
get_sound
(yt_url=None, yt_id='ahgcD1xjRiQ', use_cache=True)[source]¶ Download the sound.
The library youtube-dl is used to download sounds.
- Parameters
yt_url (string, link) – Youtube link. The audio will be extracted from the video.
yt_id (str, id) – Youtube video id. Is this is given the full url will be completed as https://www.youtube.com/watch?v=yt_id
use_cache (bool) – When True, a sound will be downloaded just once and save it for later use if needed.
-
snakejazz.snakejazz.
zzz
(method=None, *, when_start=False, when_finish=True, when_error=False)[source]¶ Sound decorator to notify the execution status of a function.
- Parameters
method (callable) – Function, class method or any callable object. SnakeJazz will track the strating and finishing event and play the desired sound.
when_start (string, path, optional) – Path to the sound file that will be played at the same instant that the execution of ‘method’ starts. A new process handles the reproduction of the sound.
when_finish (string, path, optional) – Path to the sound file that will be played at the same instant that the execution of ‘method’ ends. A new process handles the reproduction of the sound.
when_error (string, path, optional) – Path to the sound file that will be played if an exception occurs during the execution of ‘method’. If an error occurs, no finishing sound is played. A new process handles the reproduction of the sound.
Notes
SnakeJazz uses PyGame API to reproduce sounds. The default sounds distributed with SnakeJazz belong to the respective creators.
Rhodesmas:
>> Downloaded from https://freesound.org/people/rhodesmas/packs/17958/
-
snakejazz.snakejazz.
www
(method=None, *, when_start=False, when_finish=True, when_error=False)[source]¶ Sound decorator to notify the execution status of a function.
- Parameters
method (callable) – Function, class method or any callable object. SnakeJazz will track the strating and finishing event and play the desired sound.
when_start (string, link, optional) – Youtube link to the audio that will be played at the same instant that the execution of ‘method’ starts. A new process handles the reproduction of the sound.
when_finish (string, link, optional) – Youtube link to the audio that will be played at the same instant that the execution of ‘method’ ends. A new process handles the reproduction of the sound.
when_error (string, link, optional) – Youtube link to the audio that will be played if an exception occurs during the execution of ‘method’. If an error occurs, no finishing sound is played. A new process handles the reproduction of the sound.
Notes
SnakeJazz uses PyGame API to reproduce sounds and YoutubeDL to download audio from youtube videos. The default sounds distributed with SnakeJazz belong to the respective creators.
Rhodesmas:
>> Downloaded from https://freesound.org/people/rhodesmas/packs/17958/
-
snakejazz.snakejazz.
rattle
(method=None, *, zound=None, url='https://youtu.be/ahgcD1xjRiQ')[source]¶ Reproduce the sound in loop until the execution is completed.
- Parameters
method (callable) – Function, class method or any callable object. SnakeJazz will track the strating and finishing event and play the desired sound.
zound (string, path, optional) – Path to the sound file that will be played during the execution of ‘method’. A new process handles the reproduction of the sound.
url (string, path, optional) – Youtube link to the audio that will be played during the execution of ‘method’. A new process handles the reproduction of the sound.
Notes
SnakeJazz uses PyGame API to reproduce sounds and YoutubeDL to download audio from youtube videos. The default sounds distributed with SnakeJazz belong to the respective creators.
Rhodesmas:
>> Downloaded from https://freesound.org/people/rhodesmas/packs/17958/