 Okay, at this video, again, I'm kind of doing a series on how I watch videos, and so far we've looked at me watching YouTube videos, different methods on my desktop computer. But what about my TV? My TV does have a Raspberry Pi hooked up to it, running Kodi, and how do I send videos? Lots of times my kids will be in the other room, and they want to watch a video, and they want me to start a video for them, and I don't want to get up and walk to the other room. I'm lazy. Well, with Kodi, and also I'm running this on a Raspberry Pi, but in the past I've run it on other types of media boxes, it really isn't specific to the Raspberry Pi, that's just currently how I'm doing it, really anything running Kodi, this should work with, but in the Kodi settings you can go and enable a Web Interface, and there's different Web Interfaces, and for example, this is one of them that I currently have activated on it, and I click this little remote control here, and I have controls down here, I can control the volume, I can skip ahead in the videos, I can go to videos, and I can go through files that I have on there, I also have add-ons here, I have a YouTube player, and that's fine what I'm seeing at my desktop, but it's really horrific on a phone, and in the next video I'm going to talk about my replacement for this interface that I made myself, but it doesn't matter, because I have this enabled just so I can send it, because it's a Web Interface, which is how I like to do anything, it works with HTTP requests, so now that I have this enabled, I can use my shell in either curl, or wget, or wherever you like to do HTTP requests in your scripts to control your TV, which is awesome. So for example, I said I wanted to play a YouTube video, I'm coming here, I do have a YouTube plug-in installed, and it does show up here, and I can come in here and click, and I can paste a YouTube video in here, and click play, and it'll play it over there, but I don't want to do that. I want to grab a YouTube video URL, hit a couple keys on my keyboard, and have it send it to the video, I don't have to open up an interface at all when I'm sitting here, also if it's not YouTube, if it's a Vimeo, or Daily Motion, or even a direct link to a video, I want to be able to do that, I want to grab that URL, hit a few keys on my keyboard, and have it play over there for my kids, so let's go ahead and look at a little script that I wrote, which is right here. It's not very long, as you can see. I have my Kodi IP address, because that's the server, and again this script is only going to work if I'm on the local network, so it's like, doesn't matter if you have, basically you would take this code, change it to the IP address of your Kodi box, make sure that you have web remote control installed, set up on your Kodi, which is under settings, and I do have port 80, is the port on there, so make sure you have the right port here, and again I've talked about in past XClip-O, XClip is a great program to put in and take out things from your system clipboard, dash O means get what's inside the clipboards, right here I'm saying link, I'm saying a variable called link to whatever's in my clipboard, and that's how I get it, and I have this set up to a shortcut, keyboard shortcut, which will vary depending on your desktop interface, but basically if I hit control K, it's going to take whatever my clipboard, pipe it to this program, when I pipe to this program, it's going to run this program, it's going to look at what's in my clipboard, and pass that to my Kodi box, and again since it's basic HTTP requests, you can look up on YouTube how to, or on Google, how or where web search engine you use to what commands to send, but they're just HTTP requests, but since I already have this web interface, I can just use the developer tab in my browser to see what's being sent, but basically it's going to come in here, and what it's going to do is it's going to set those variables and then run the main function, and what it's going to do is it's going to output, so the output is basically I wanted to be able to run this in the shell, or without the shell open, but I wanted some sort of feedback on what's going on, so what I did here is I just have this output function, which is just messages, it will echo it to the shell if you have a shell running, but it will also try to send a notification to my desktops, that way when I use the keyboard shortcuts, I get that little notification that things are running properly, so it's going to output checking links, so it's going to say checking, and it's going to give the whatever is in my clipboard, that way if I don't have the right link thing in the clipboard, I know what's going on. Next it's going to use YouTube DL to grab a URL, so what's doing here is again, it's going to try to grab the URL, so YouTube DL dash G, instead of downloading a video, what's going to do is it's going to get the direct URL, so for example, let me go ahead here, clear this screen, and let me go ahead and go to YouTube, and I'll do Luke Smith again because I don't mind promoting his site, and so I can go in here, and I can grab a URL to here, let's make this full screen, if I do YouTube DL and give it that URL, it's going to start downloading the video at the best quality, but if I do dash G, what's going to do is it's going to give me the direct link to a video file, and here it's creating a video and audio file to the YouTube server because I'm not using the YouTube plugin on Kodi, I'm giving it a direct link to a video, so that's what I'm doing here, and since it's doing that, what I want to do next is give it a format that has the YouTube, the video and audio file in one file, so I'm going to do 22, which is a 720p video, and there I have a direct link to a video, and I can pipe that directly to Kodi, so what my script is doing here is it's going to check for that resolution, if not, then it's going to go 18, which is an even lower resolution because my kids don't need 4K video, and the lower the resolution, the less likely I'm going to have lag, and you know when kids complain when there's lag, because maybe I'm uploading 100 videos to YouTube because I tend to do that, and it might make their system a little slow, so lower resolution is fine for them, so it's going to try for the 720p, and then if that doesn't work, if it fails, it's going to go to this, and then if that fails, it's going to echo out the link, and then it's going to, again, output that it's playing a video, and what's going to happen at this point, after it grabs that, it's going to now try to pipe all that, so the URL is going to go into a vid, so the reason I do the echo at the end here is if it's not a YouTube video, it might be a direct link to a video, so it's going to try, is this a YouTube video at 720p? If that doesn't work, it's going to try the, I don't know, 640, I don't remember what resolution 18 is, but a lower resolution, if that fails, it's just going to put the direct link to the video into this variable, and then it's going to pass that video right here to my server at port 80. Hope that all makes sense. Let's go ahead and quit out of this, which I don't need to quit out of that, because again, I set it up as a keyboard shortcut, so here I can grab that URL. Now, I use my keyboard shortcut, which in my case, on my system, I have set up as the super key, the Windows key, and Alt and K for Kodi, and it says it's checking this URL, and then it says, okay, I'm playing this, and now that is playing on my TV in the other room, the TV is currently off, but it's playing it, and I can actually go to this interface here, and I should see, yep, it's playing an hour long video, 51 minutes, it's telling me where it is, blah, blah, blah, again, I don't even use this interface anymore, and the next video I'm going to show you the interface I created, but this was just to make it easy. I grab a URL, few keys on my keyboard, and it sends a video to the TV for my kids to watch, again, because I'm super lazy and don't want to get up and walk over there. This code should be up, and I should definitely check before I do these videos. Let me go to filmsbychrist.com, I'll go to software, I'll go to scripts, oh, I'm sorry, no, it should be under my notes, just notes, and type in Kodi, yep, there it is, so it's, again, if you go to filmsbychrist, go to scripts, go to notes, search Kodi, right now it's the only one I have, Kodi control XMBC is just, because that's what Kodi used to be, you click on that, and you can get a copy of this, all you have to do, once you have Kodi set up with the web interface, give it the proper IP address and port number, and then just link this script to a shortcut on your system, and now anytime you highlight a video URL, a YouTube URL, or a direct link, you just hit whatever keyboard shortcut you set up, and it will send it to that TV, or to that Kodi box. Anyway, I hope that's clear as mud, check out the script, I thank you for watching, as always, be sure to go to my website, filmsbychrist.com, now only can you find my scripts there, you can find my videos for both my channels there, you can search through them here, so again, Kodi, I guess this video will show up now, once it's up, XMBC, no, I don't have anything on that either, MPV, I know I have videos on that, MPV, which is a great player if you haven't tried using it, I love it, I use it for everything. Again, software, you can search through my notes, my scripts that are up on my website, and my GitLab page, support, if you wanna support me, PayPal or through Patreon, there's also a link in the description of this video to my Patreon page, you can go here, get this for your RSS reader, if you wanna keep up to date on my videos that way, and again, Shell will, if you ever try to WGet or curl my website, it will actually come to this interface where you can use the Shell to interact with my website. Anyway, I thank you for watching, and as always, I hope that you have a great day.