Transcript for:
Simplifying Life Through Python Automation

okay I am really excited for this video getting to build with python different scripts to automate my life sounds like a really good idea there's so much in my life that I can automate and I'm going to share with you today some really cool and honestly really simple python projects that you can build to automate your life but not only are these scripts really interesting for actually automating your life and doing really cool stuff but it's a great way to show potential and future employers different projects or things that you are working on a lot of these scripts can really be built out into quite large projects that you can make around them push them to your GitHub show you are constantly building and it's just a really fun thing to do okay let's get started oh wait make sure to hit that subscribe button for more Tech coding career related videos leave in the comments other videos you want to see and let's get to it where are we going we're not going too far before we get into it though I want to say a big thank you to Intel and their one API tools and libraries for sponsoring this video this is across architecture developers Dream Suite making it easy to port code between platforms and even providing a certain level of future proofing this is a great tool for devs working with AI Internet of Things cloud and so much more one API is not only a huge benefit for your toolkit but also it saves a ton of time I link them down below so make sure to go check them out for more details and to start building with them foreign something I've been wanting to build for a while is a script that will take a PDF and turn it into an audio file oftentimes if I'm studying or learning something new and it's in PDF format and I have to spend so much time reading it I would prefer to just be listening to it so I built a script with python that will take any PDF and convert it into an audio file let's get building first thing we are going to be building as I mentioned is turning a PDF into an MP3 file and this is super simple there's two packages required but before we get into it last time I made a python project I got a lot of questions around setting up the project in Python because last time we used replit this time we are in vs code so I'm going to share with you a few commands to a ensure you are installed python is installed and really how to get your virtual environment running first thing we need to do is check that you have python installed or what python version you have and of course if you don't have python installed pause this video and go install it we're not going to do that in this video because it's pretty Excel explanatory online all right so you can see I have python 3.9.10 installed then what we need to do is get our virtual environment up and running so first of all you can see um in the project I already have it up and running but just to show you what I did so type in this command here then we type in source it's not not there okay so now you can see we are in our virtual environment next up we need to install these two packages so we go and once again I am the worst seller on the planet so let me just copy this command I've written down install and p y t t x x three and this is actually a module that is a text to speech conversion library in Python and this is going to be a huge help in getting us to convert our text into speech go next up we need to install py PDF and I already installed this as well but I just want to go through the process with you to ensure you understand and this one here that we just installed is a python Library used for performing major tasks on PDF files and in this case we have a book PDF so any PDF you want to turn into audio put it in your project directory okay now let's get into some coding the fun part so first of all what we need to do is open the PDF so let's call this PDF reader I told you we can't spell today and then let's use this package here [Music] and here we are going to pass in the PDF in this case mine is called EDF foreign we need to initiate speaker you could use the other package [Music] [Music] [Music] foreign [Music] text strip the text [Music] foreign there then we want to actually take that speaker and save it to file to save it as an MP3 I pass in the clean text and what do we now we pass and whatever we want to call is MP3 file I'm going to call it story time [Music] then we stop it all right moment of truth [Music] here we go we can see printed printed out text and we have our MP3 this is really simple it's really fun easy project I need two modules from Python and it's a really really simple thing to build but you can imagine how powerful it can get when you are using large PDFs if you want specific Pages there's so much you can play around with this so I will link all the code below and I really encourage you to uh really take this clone this and build on top of it build a really cool project and it really shows initiative when you are pushing things to GitHub that you're building things like this and expanding on them and also too when you are looking for uh future drafts okay project two this is a big one I'm not even going to show you if you've seen past videos you've seen my desktop folder or my desktop and it's a disaster equally as bad if even worse is actually my downloads folder so I wanted to build a python script that we could actually use to clean out my downloads folder and for this I wanted to be specific into which file formats I wanted to be able to delete let's get into it okay project number two that we are going to be doing is being able to access our downloads folder and then delete specific files from that folder and this is something that I'm sure you've all had the instances of where your downloads folder is just kind of out of control for this I'm going to do it that it deletes specific files but you could also really add on to this so it's for the entire downloads folder or different extensions but I really wanted to do this is the base you can build upon it and I'm not going to go through again the showing you how to start the virtual environment I'm assuming that you have done that from the previous project first thing we need to do is import and install the OS module which really gives us access to our operating system then we need to give a file path that we want to access and in this case there's construction going on and in this case we are going to be accessing our downloads so replace Tiffany Jansen with your name or the name that's on your computer [Music] so check if um the file path exists let's remove it and let's print something to let us know successfully being deleted ah delete Ted okay there we go and then else the style oh it's really annoying that I did one with one quote and everything um okay so we have a file path here as you can see but we need to give it a specific file so let me go my downloads folder I am not going to show you this folder because it's a disaster this is why we are doing this and one file that I want to delete today is two dogs surgery but once again you could we could replace this and make it Dynamic to delete all PDFs or delete everything in the downloads folder I just wanted to start small to show you this also if you didn't catch it from last time a simple way to run a python in your terminal is right click and then I was like right or left click right click and then go run python file and terminal should get successfully deleted this file has successfully been deleted yay but then if I was to run it again because now it doesn't exist it should say this balance on exist there you have it those are two really small but fun things to do think of different ways that you could even put these together and it's really just playing around with different modules in Python doing some kind of conditional statements and um whatnot but it's such a fun way to think of different projects to build and expand upon so I linked my GitHub down below which will feature both of these and okay we've done our work here okay we have built some really cool scripts if you ask me I'm curious to know what else should we automate what should we automate next leave down in the comments and let's continue building together I link the projects down below too so make sure to go check them out build them then build on top of them like I said it's a great way to add to your portfolio to contribute to you know bulk up your GitHub all of that okay you can see the sun is out it's time to go enjoy the weekend bye everyone [Music]