Placeholder Image

字幕列表 影片播放

  • all right, so it's time for another one they build.

  • And today, the one they build is getting me really excited.

  • Because today what we're going to build is a time tracking tool or basically an automatic time Frank until using Python.

  • What this is going to be able to do is basically the plan at least is for it to be ableto automatically track whatever we're whatever, like application, we're using whatever website we're on and basically give us a time spent on each task.

  • That's kind of the idea to automatically track where your act when you're on the computer and then kind of display that.

  • I think we're going to just use a Jason file for now and just display the daughter saved the daughter somewhere so that we then can use that in whatever way we want.

  • And the idea for is for me to then create this script and then uploaded to get tub so that you can then download it and use it for whatever you want, because then you will have the Jason daughter and you'll be able to then display it in whatever way you want to display it, whether you want to make a website for it or whether you want to make just a knack for it.

  • Whatever you want to do, you can do it.

  • So that's gonna be the test for today.

  • I think I'm also going to make a second video, like in company to this one where I will actually make it flutter at just locally on my computer, where I'll actually display this Jason Datta in some sort of like, visual way.

  • So, like a graph for some like that?

  • Yeah, that's what we're building today.

  • All right, so what, We're going to start with this trying to figure out kind of what requirements are needed for this Build off what the requirements are for this build.

  • And this is something that I like to do at the start of each build, just to kind of get an idea of what I have to do on break down each task.

  • And this kind of helps simplify the process for me so that I can focus my energy on separate tasks and not just kind of try to attack the whole thing.

  • And also, the app that I'm using is called Evernote and the recent on saying that is because a lot of people have been commenting.

  • What's up?

  • I'm using when I'm doing these sort of requirements or no taking things.

  • All right, so we'll start with that, and, uh, then we'll see where we'll get started once we have that requirements done.

  • All right, so these are the requirements that I've come up with, and, uh, I made this a little bit more detail than I usually do just to kind of give you a bit more of an insight into kind of the way that I'm thinking about this so hopefully that'll help a little bit.

  • So basically, this is the main goal of this task is to automatically track time spent on different sites, or APS.

  • And then I divided this into sub goals, and one of the sub goals is to differentiate between different projects.

  • So the thing is that you might be working in the same app for several different projects, and it would be nice to then be able to actually differentiate between the different projects of Ah, we contract time for those projects separately, and then we also want differentiate between different sites, and that's the same principle here.

  • Maybe you're on YouTube or your own stack overflow.

  • You're probably gonna be doing two completely different things on the different sites.

  • And so you'd want to track specifically what you're doing on stack overflow.

  • Er, the time spent on stack overflow in time spent on YouTube And then when I created is a focus category or something here where basically, this is gonna be the focus off today's one day build.

  • So what we want to focus on is track time spent on email.

  • So basically, since I started this YouTube channel, I've been getting a lot more e mails have been spending a lot more time on email.

  • So what I want to be able to do is basically track all the time spent on there and the That's actually the reason that I came up with this idea because usually I tried to actually use like a timer.

  • So I'm like that time myself when I'm on Gmail.

  • But the thing is that I'm usually on there for, like, a minute, maybe 10 minutes at most, and it's not really worth it to start the timer.

  • If you're just gonna be on there for, like 30 seconds and then stop the timer.

  • So basically being able to track just how much time I spent on Gmail truly, then that would be a really good help.

  • And then the second focus of this video is just being able to track how much time you spent in visual studio code.

  • And then down here, we have all the requirements to be able to achieve our focus for today's one they build.

  • The 1st 1 is we need to be able to monitor where the user is, so monitor the activity of the user and what that needs to be able to do is basically needs to be able to see what website is being used and what APP is being used.

  • Then the next thing is gonna be to start a timer whenever we opened up act or site, and then we need to be able to save the daughter to a Jason file.

  • And the good thing about Jason is that you can use it for so many different things.

  • And like I said, I might actually build a flood Iraq for this and where I create a U.

  • Y for the script and kind of display that Jason daughter were the time spent on different things in a nice Iwai with bar charts and different things like that.

  • So that's gonna be something that I will hopefully do fairly soon.

  • And the last thing it needs to be able to actually run in the background so that it's actually ableto constantly track everything that you do.

  • Ideally, it would run as soon as you start up the computer so you don't have toe actually run it yourself.

  • Yeah, so that those are the requirements that we need to get done today.

  • And we're gonna start with just trying to figure out how to monitor the activity of the users of where the user is.

  • And currently I don't really know how to do that.

  • So I'm gonna have to start Googling and see if we can figure it out thing.

  • This is what I just rove to now.

  • Yes, I haven't tried this, but what this basically should do is it should run constantly as soon as I start running it.

  • And what it will do is it will get the name of the active window.

  • And if this name is different than the previous name then it will print the the active window name.

  • So essentially, when we run it now, it should print terminal.

  • And now that should now print whatever this code.

  • Yep.

  • And then if we go here, it might print like chrome or something.

  • Google Chrome.

  • All right, so we're actually able to now monitor which windows were using.

  • Now we need to see website is being used, so ah, that's gonna be the next step is to get the specific website that we're using.

  • All right, So now I think I may have solved the problem of actually seeing What's the current like your l that's being used This and that was like it was a difficult problems, asshole.

  • And the way that I was able to solve it was basically by using Apple script And what you do that miss, you give certain commands, and it will then do certain things.

  • I don't understand it at all like this.

  • It took me a while to figure out, but I got this.

  • Which now gets the current you Earl being used.

  • So, uh, that means that if we run it, it will say terminal.

  • But then if we go here Let's just go to YouTube.

  • The right now printed terminal there Prince Google Chrome and then a printed that we were opening a new tab, which is what we were doing.

  • And now it prints Google Chrome and the Earl.

  • So what actual site were using?

  • So yeah, that's, um, pretty happy with this, because that was it was a lot more difficult than I thought it was gonna be.

  • And that that seems like that's kind of the trend for all of these one day builds, they always end up being way harder than I think they're gonna be okay, so we can see what website is being used.

  • So that's good.

  • And we can see what APP is being used.

  • So that's good.

  • So we're able to now monitor the activity s so that part is done, the next part is going to be to start a timer when a site opens up or a nap opens up.

  • I think I'm going to go to the gym now, actually, because it's 1:15 p.m. And, uh, yeah, I need to just take a break, eat something and come back to it in a minute.

  • All right, that's what happened.

  • I pretty much spend the last three hours is three PM right now, basically doing nothing.

  • Just wasting my time.

  • I didn't eat, I didn't go work out.

  • I just basically sat on my phone, got stuck there, and this happens way too often.

  • All right, So the recently keeping this in the video, it'll is because this is something that happens to me a lot.

  • I just like to take a break from programming to go to the gym.

  • And then as soon as I stopped programming, I realized that I'm, like, dead tired and I don't really feel like I have any energy to go to the gym.

  • And therefore, I end up on the couch just procrastinating on my phone, and I get more and more tired and then 234 hours have gone by and I haven't done anything.

  • And then I feel like I need to get back to work, and so I end up doing pretty much nothing.

  • So I thought this is a good opportunity to do something instead of doing nothing.

  • So instead of not going to the gym and not doing anything, I'm gonna go for a walk that simply and in the question about intelligence, can you build machines that have that intelligent?

  • I think by the time we get a machine that can independently come up with that level of proofs probably quite close to a G I.

  • The second question is the question about consciousness.

  • I'm listening to the artificial intelligence podcast with Max Take Mark, which is a Swedish person, And I can really recommend listening to that episode and all the other pursuits of the artificial Italian just a quick little to anything at all.

  • I can t human emotion where what when it accomplishes its machine goal that the views it to somehow something very positive and right So all right, so now able to actually save it to a Jason file.

  • So we get this, which is, ah, list of activities.

  • Right now I'm just naming it the Web address.

  • So like, if we're on for using chrome or fire for stuff like that, then we're just gonna basically get the euro for the website that were on, and that's gonna be the name of the activity.

  • But what I want to do is I want to actually do some like string splitting basically where we remove this part and also this part so that we just get the domain name basically and that's then going to be the name of the activity.

  • And where this is gonna happen is here.

  • And what we want to do is we want Thio when it is a website that we want to split the string of the girl and basically get the website name.

  • So that's what we're gonna do now.

  • And I'll get back to you when we're done.

  • All right.

  • So, uh well, it works now pretty much the way that we wanted to work.

  • But the only So as soon as I switched us right now on the terminal here, as you can see and if I switch over to code, then I think it will add a new activity called Code, and it will add the time that I've spent on here.

  • I think I've spent probably a minute in 30 seconds, maybe two minutes so but if we want to test this, I'll just go into a visual studio code and wait a couple seconds.

  • And yet so then it added a new time entry to code and that is one minutes and 50 seconds.

  • This basically means that we we're adding.

  • So let me try to figure out how to explain this on understand it myself.

  • So basically it adds the time entry, but it adds the name of the activity that we moved to.

  • So basically, if we spend time in visual studio code and then moved to the terminal, then I'll add the tongue that we spent in visual studio code as a new time entry.

  • But we'll add it to the terminal.

  • So as you can see right now, we only have one entry in the terminal category.

  • And we're right now.

  • We've spent, I don't know, two minutes, maybe in visual studio coat.

  • What we'll do now is will add another entry into terminal, but what it should do with it should add another time entry into visual studio code.

  • So the code category.

  • So if we move back here and we have a look see, it adds another entry into the terminal category and not the code categories.

  • So, basically in here somewhere, we're probably renaming the file, uh, too soon, and then we're adding, Yep, So I'll have to try to figure this out, all right, so I think I'll fix that right now.

  • It adds it in the way that way.

  • Wanted to add basically.

  • Now if I open up Google Chrome here, it should just take the amount of time that I've spent here and add it as a new entry into the terminal and start counting how much time I'm spending on.

  • Go Go.

  • So doing that.

  • So the radio, it added a new time entry for the time that we spent here.

  • And now let's say that we're googling some associates.

  • That's not what I wanted.

  • Let's say that we're Google ings of stuff.

  • We're spending time in different tabs.

  • So I think that it doesn't really add a new prime entry until we moved too.

  • Maybe you too.

  • I'm not sure of this work, but I think it might work.

  • Okay, so now it added YouTube here, but as you So I moved between, like sack overflow and YouTube and different websites.

  • Basically.

  • So what we need to do is we need to also check what website we're on, because right now it just checks what we're on.

  • And we were on Google Chrome that whole time and at times the time that we were on Google Chrome.

  • And then what it does is it when it's time to add the time entry, it checks what the website is on right now.

  • And it adds that to a time entry.

  • So that would be the last thing that we're going to do.

  • We're going to just fix that, actually tracks the sights and changes and adds new of time entries for the different sites that were on Yes, finally.

  • Now that now it works.

  • Now it works exactly the way that it should work.

  • I think I hope so.

  • At least.

  • Oh, my God.

  • I think I think we might be done, to be honest.

  • Um, all right, let's stop this madness.

  • So, uh, basically, if we run this like that, then we'll dio is it will start timing, and right now we're timing the time spent in the terminal.

  • So within the time of me talking right now, it's probably been like 20 seconds, 30 seconds, something like that.

  • And now if you go to a visual studio code, they will change and it will stop the timer here.

  • It will add a new activity called terminal and we spent about 20 seconds in the terminal.

  • But now we get to the really cool part, in my opinion, which is, if we go here, it'll then create a new time entry here for code because we just went from code to the inter or to Chrome.

  • So basically adds code here.

  • But if we switch tabs over to YouTube, then what it will do is it will add a new time entry, cold stack overflow right here.

  • I have it on sleep for 10 seconds.

  • So that's why there's kind of a bit of a delay.

  • But I see See it added to stack overflow dot com right here.

  • We spent one minute there.

  • Now, if we go back to stack overflow again, it will add a new time entry for how long we spent on YouTube.

  • So let's see that say, now it has one minute, 20 seconds spent on YouTube.

  • All right, so there you go.

  • It works.

  • It does exactly what I wanted to D'oh.

  • So right now we're getting the time spent on each task and we're getting it displayed in these sort of time entries is really good because this actually, times it's automatically.

  • I don't need to think about it.

  • I can just browse and do whatever I want, and then it will automatically add the time entries.

  • So there you go.

  • It added another time entry into code.

  • All right, so that's it.

  • That's this one day bill done, and I'm super happy out Fats.

  • That actually went.

  • I think it took me, like, five hours in total or some like that actually build it and complete it.

  • And this is probably one of the most useful things that I've built on this channel on in one of these one day builds because this is something that I do every day.

  • I always start a timer when I start working on something, and I stop it when I start working on that this way, we'll all be actually able to just automate that stuff so that it will automatically start the timer in the timer whenever I go in and out of different tests.

  • And that's also one of the main things that's really difficult when you're using an actual timer.

  • Where you have to press start and stop is it's really difficult to room with the press start is really also quite difficult to remember to press stop.

  • Usually they have some feature where it's like if you don't do anything for, like 30 minutes, 20 minutes, it'll actually stop itself.

  • But the president's start is usually something that is a bit difficult.

  • Toe actually do so.

  • What we'll do now is I'll push this to get tub and then I'll add a link to my get up depository in the description of this video, in case you want to use this yourself.

  • And like I said, I think it is one of the most useful one day bills that I've done so far.

  • So I'm really happy with it.

  • And I'm also excited to get started on building and act and an actual, like, graphical user interface for this to display different charts and graphs and all that stuff for the time spent on different things.

  • So that's gonna be coming up in a video very soon, I hope.

  • Anyway, that's it for this one.

  • I hope you enjoyed it.

  • I truly did.

  • This is one of those things that just perfect for me because I love tracking stuff and being able to automate things so being able to bring these two together and build the script.

  • It's just beautiful, in my opinion.

  • So like I said, I hope you enjoyed it, and I hope I'll see you in the next one.

all right, so it's time for another one they build.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

A2 初級

一天的構建。使用Python自動跟蹤時間 (One Day Builds: Automatic time tracking using Python)

  • 10 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字