 welcome today we're gonna be looking at a script that I'm currently I've been working on I have had multiple variations of this in the past that and this is a complete rewrite I did a couple of weeks ago and I'm just realizing there's a horrible spelling error in my script but let's go ahead and have a look at this real quick if you go to my my website filmsitechris.com that's Chris the K you go to the software section click on git lab will bring you to get my git lab page and there you can search through and I have it's under it YouTube subs so it's at the actual direct link to this project is gitlab.com forward slash mail X1000 forward slash capital YouTube dash capital subs and there is only a couple files a license a read me the old versions program but then really all you need is this script right here and so let's go ahead and have a look at what this does let's let's go ahead and run it and then we'll look quickly I'm not gonna go line-to-line to the code but I'm gonna explain how it works so I'm just going you from a shell or from any type of run I'm gonna run it up here in my D menu I'll have to type in YT subs and hit enter and it brings up this window here let me make that full screen and these are recent videos that I have not watched yet from people that I have a subscription list to save them my home directory and we'll talk about that moment so what I'm using here is a program let's go ahead here there is a program called SXIV and I found out about this program through Luke Smith if you don't subscribe to his YouTube channel I definitely check it out it is an image viewer and you can pass it a bunch of images and it will you know I can go through here just an image viewer right so I go through here I can enter and then I can hit enter to go out of that and I can look at each one of these and what I'm doing here is I'm looking at the thumbnails from the YouTube videos but something he pointed out that's very interesting is I can hit M to mark these and what happens is once I mark them if I hit Q to quit it will output a list of the ones that were marked well now I'm so I'm using this as a viewer to view the thumbnails but then when I exit out it's gonna pipe the ones I've marked into a playlist and then play them with the MPV so if I hit Q at this point to exit out of that it's going to start playing those here in a second hopefully there we go and so I'm watching this and I can hit enter to well I should be able to hit enter go the next one but it seems like one of the videos did not play again error on one of the videos so normally I hit enter to go the next one to play this I can hit Q to get out of that and now if I hit YouTube subs again let's try again YouTube subs there we go I don't know why I didn't work on the other one yeah it seemed like for some reason the Pumplamoose video didn't play let me go ahead and mark this one again this is still a in works project I'll mark these two here these two scam school or scam nation ones or at least one of them to scan each one that's that's one drop back this I don't have the title of the video here although I can see it once I get into MPV so I've marked those two I'll hit Q it'll take a second and it should start playing there we go yeah this one's not this one's just a magic channel that I subscribe to and I should be able to hit enter and it will go to the next you know these are basic MPV commands it's playing through these and then if I hit Q and I if I was to run YouTube subs again you can see those videos are now removed so now let's talk about a little more in-depth on how this is working and I will go here and let's go ahead and make this full screen go to the top so I set some temp files here I set for me again mention a previous video I set my videos to YouTube quality of 22 which is I think 720p which most probably would want to change if you you know didn't put that in there it would just play the highest quality the max number of thumbnails is gonna show is a hundred so if we go up here to oldest I have it looking back and it's checking today's date and going back a week so it shouldn't show any videos that are older than a week and then also I have here my home directory a sub list let's go ahead and look at that real quick so I'll quit out of this and I will cat what's inside that file you can see I just have a list of channels so one of the things I didn't want to have I didn't want to have a script that I had to give my credentials to log into YouTube so instead of actually checking who I'm subscribed to in my actual YouTube account I have this text file that leads to the video home page for people so if I was to go to YouTube let's again let's do YouTube and I'll do Luke Smith Linux Luke Smith is again someone I subscribe to I'll click on his page here and I'll go to videos and this is the URL I want to put in there now I have it built into my script that once you download the script if this script if this file does not exist it's going to generate and put in my channel as default but at any point I can type in YouTube subs and type in edit and it's going to open up that list for me it actually I think it's going to also sort well when you play it sort unique so in case you accidentally put one in there twice but also I can I can put Luke's channel in there which is this is the link to Luke's channel which is already in here but it doesn't really matter I can go ahead and save it in there and it will automatically sort through this all these rules cannot remove this could be a little bit cleaner but once you have put a video into a playlist and you start watching it anytime you start the script it's going to remove those thumbnails so it's trying to remove watched ones that don't exist again I could do this better and I might improve the script in the path in the future this is just something I've thrown together and I'm still constantly working on so if you again it's on up on GitLab so if you want to make any contributions any improvements to it but it also tells me right here there's currently five videos available because if there were zero it's going to pop up a message saying no videos to watch so how does this work so I have put this in a cron job if I do YouTube subs and I do update first of all upgrade we'll try to download the newest version of the script from my GitHub page or GitLab page and so that's how I would update the script if I may changes and upload to GitLab I can update all my machines by running this that's upgrade update what this is going to do is it's going to take that list of subscriptions that I have and go to their video page look at their most recent videos and quickly check the date on all of them and see if they're less than a week old if they are it's going to download the thumbnails to a 10th folder on my machine and that's how I get those thumbnails when I start the thing so what I have is I have this in a cron job this YouTube subs update and every hour it will go through there it takes a minute or two to go through all the pages and it adds the thumbnails to a folder and if we quickly look at list temp YouTube thumbs you'll see that I have a couple of thumbnails and what this is they're named by the the date that they were posted a little time stamp and then their ID and so when I look at the thumbnails they should be somewhat in order they're going by the day so if two videos are posted on the same day it doesn't necessarily mean that they're going to be chronologically through that day because it's a date stamp not a timestamp that I have going here if that makes sense but basically what I'm doing here is I pipe that into SXIV and so it will pipe those in there and that's why every time I run the script it's going to look at our watched file which is also in my home directory so if I cat out YouTube subs watched these are all the YouTube IDs of videos that I have watched already so quickly try to remove any thumbnail that has one of these IDs in it again this video is might be kind of boring I'm just kind of explaining how this works and I'm realizing how boring it is as I'm talking about it but I'm going to keep on going let's go ahead and go back to our script okay I didn't have it open already so here I have it so we have functionality that it's going to again I have a cron job that every hour it checks for new videos puts the thumbnails in that directory so when I start it it will actually look at the thumbnails I can choose the thumbnails using SXIV and then I can hit enter it dumps those into a playlist and then it will start playing them and then remove when I play any thumbnails that are in the watch list so basically there are different functionalities you can look in here they're pretty straightforward we have a function that checks the date of a video the published date I have a cleanup function that tries to clean up the playlist and temp files again upgrade is going to try to download the most recent version of that script and if you have it in a directly like I keep mine in usr local bin so you have to run it as a suit or a route to update that but if you have it in a directory that's writable you don't have to do that just depends on where you put the file I have a help section here that needs to be updated because I've added a few more options in here I believe and that's that's about it I mean again you I did not go into detail on how this code is written again I need to fix this little typo here that's it so again I have a cron job that runs you can run it as much as you want I run it every hour the grabs from my list on my machine and again I wanted something that I can just run from the shell that gets all the videos I like watching that doesn't need credentials to log into my subscriptions and basically I went and just pulled all my subscription channels and threw them into that file and it sort of uniques them so it doesn't matter if you put them in there more than once check it out again still working out still trying to clean it up it's a very sloppy code right now if you look at it and you have any suggestions or commits you want to make go ahead and check it out sorry if this video was a little boring I didn't want to go into too much detail and anyway I feel weird about this video now but I I'm going to post it anyway thanks for watching and have a great day