 Hey Sangashan and you are up next Hey Sangashan and you are up next So I thought maybe my script could signal me a status with music If maybe it's running or if it's completed or maybe if it errors out It could place a music to indicate that that happened So kind of like background scores for scripts And I was like you know this is the weekend plan for me and I'm going to do it now I did build it but that was two weeks later So open source camp But how to do this with Python scripts it was you know quite straightforward You know I just start a demon thread or a process in the background that plays music And you know alter its state when needed Which means kill it when the job is done you know pause it and resume it Like I implemented this in Python using decorators You know that bad boy can fit so many functions So here's the code so you just to pip install jazzy to install it in your system And then you just have you just import painting track and then you can use that as a decorator in your function And then pass it an mp3 file which so when there's been the script runs It's going to play this file in the background There are also other decorators like when your script fails or when your script succeeds It can play you know any kinds of music For example on error track here it plays up your enthusiasm And on success it plays you know the anime wow soundtrack As the project you know went out issues were opened and some wounds were opened too And I mean some blatantly stupid things I didn't care about because it worked in my in my laptop So but the thing is playing music using Python or any other packages kind of dependent on your operating system It depends whether you're on Unix or if you're on Windows Like the the methods and that like the libraries used very greatly So I thought I could you know a lot of that and maybe implement it with Jupyter And maybe POS agnostic at the same time So if you don't know about how Jupyter plays music it just uses HTML audio tags to do this And you know you don't have to wrap your function you wrap your code in a function Because you have Jupyter matching that you can just attach to your cell And you know have it do anything you want So this is how a normal Jupyter audio tag looks like You just import audio and then you play a track and then the audio element shows up Where you can you know control your audio like pause play increase music You can download it and stuff like that So now I need to make the audio tag invisible to the users because I don't want that ugly audio tag to be visible And also I wanted to I want to control it even though it's invisible And I want to do it all you know programmatically So to do that I kind of write my own version of I Python audio which is like overloading on top of the existing audio So I just change the HTML element which renders on your notebook So what I do is I just replace the display as none so you don't get anything And also I add a control variable called loop so that I can also set a parameter if you want to you know keep looping my music over and over again So now that we have a custom audio tag I implemented a very basic player Which can play and pause music So to play music I just initialize the class like with an object and I'm just returning it out with a display ID It can be a UUID for here I'm just giving it one two just for the sake of it And also there is a stop using method which is not exactly a method it's kind of a destructor Because it just updates the display to an empty string so that you know the music stops playing So now once this is done you can instantiate the player to start the music and stop the music And it's all non-blocking and you know have us in the background So like just a quick in a quick thing I want to show my repository where all of this is written So there's also a collab notebook you can open it out So with Jupyter notebooks you can just have these audio tags with these magic elements you can attach And you just load the magic and then you just add it to your cell and then when you run it it's going to play the track I don't want to play it right now because I tried it once and it was really loud so I don't want to you know affect anyone's hearing So I'm just going to link you to this repository which is github.com slash angershwin slash jazzyd And you can you know open the notebook and you know give it a try and you know maybe you find it useful or maybe you find it fun Yeah I just wanted to tell you guys about it. Thank you very much