Integrating Kodi with WMC for Amazon, Netflix, etc.
Posted: Sun Jan 28, 2018 9:59 pm
As you may have noticed, Kodi has a few great add-ons that allow you to log in with your account credentials to use internet streaming services like Amazon, Netflix, sports, etc. It's a great way to access these services with a media center PC and remote.
But because I still use WMC for TV, I went ahead and integrated access to these Kodi add-ons into the WMC menu. Here is how I did it. (This assumes you have Kodi and its addons set up as desired, let me know if you need any help with that.)
https://forum.kodi.tv/showthread.php?tid=136798
Let me know if you have any questions with this, or with general Kodi setup issues.
But because I still use WMC for TV, I went ahead and integrated access to these Kodi add-ons into the WMC menu. Here is how I did it. (This assumes you have Kodi and its addons set up as desired, let me know if you need any help with that.)
- 1. Tell Kodi to automatically launch the desired addon when it starts. For this, we use a file called "autoexec.py" in the Kodi userdata directory ("%appdata%/Kodi/userdata"). I set up a file for each of my desired services, like the following as "autoexec-amazon.py", and just copy it to "autoexec.py" as part of my launch script later (step 5):
Code: Select all
import xbmc xbmc.executebuiltin( "ActivateWindow(Videos,plugin://plugin.video.amazon-test)" )
- 2. Now we want to decide how to exit Kodi from our addon. By default, you would have to go back to the Kodi main menu and select the "quit" option, but that's kind of a pain. So I made my own "service addon" that detects the presence of an autoexec.py file, and then automatically quits Kodi as soon as you go back to the home screen (so basically, just by pushing the back button on your remote from the first addon screen). I've attached it as a ZIP file to this post ("service.autoexechomecloser.zip") which you can install as an addon inside Kodi.
- 3. Now we're going to streamline the appearance. Instead of seeing the default Kodi splash screen on launch, let's replace that with a service-specific splash screen. Similar to step 1, I put a splash screen for each service, like "splash-amazon.png", in the folder "%appdata%/Kodi/media", and then as part of my launch script (step 5) we will copy it to "splash.png" before launching. I've attached my Amazon splash screen which you can use.
- 4. Unfortunately, even with a custom splash screen, Kodi still displays its own home screen briefly during the launch process. I wanted to hide that too, which requires customizing the skin. It's pretty simple, though, to just edit an existing skin. I used the Kodi 18 default skin "Estuary" so I simply downloaded it as a ZIP file here:
https://github.com/phil65/skin.estuary
Then I installed that ZIP as an addon within Kodi, and it asked me if I wanted to make the new skin active, and I chose yes. Now we have access to the skin's home file, located at "%appdata%/Kodi/addons/skin.estuary/xml/Home.xml". Like steps 1 and 4, I just made a new XML file for each of my services, like "Home-amazon.xml", with the following code, and then I copy it over Home.xml in my launch script (step 5). Be sure to make a copy of the original Home.xml, to something like "Home-original.xml", which we can copy back in place when we are done, in case we want to launch Kodi with its regular home screen sometime.
You will also notice that by default Kodi puts parent directory items ("..") at the top your addon screens. You don't really need this if you are using a remote with a back button, and it can make it more difficult to get back to the home screen and activate my auto-exit addon above. But, you can easily disable this in the Kodi settings as follows: Settings -> Media -> General, deselect "Show parent folder items"Code: Select all
<?xml version="1.0" encoding="UTF-8"?> <window> <controls> <control type="image"> <aspectratio>keep</aspectratio> <texture>special://home/media/splash-amazon.png</texture> </control> </controls> </window>
- 5. Now it's time to make the launch script, to move the files in place from the previous steps, launch Kodi, and then remove our custom files after we quit. I make a custom script for each of my services -- here's my file "kodi-amazon.bat":
Code: Select all
set app=amazon copy C:\Users\yourusername\AppData\Roaming\Kodi\media\splash-%app%.png C:\Users\yourusername\AppData\Roaming\Kodi\media\splash.png copy C:\Users\yourusername\AppData\Roaming\Kodi\userdata\autoexec-%app%.py C:\Users\yourusername\AppData\Roaming\Kodi\userdata\autoexec.py copy C:\Users\yourusername\AppData\Roaming\Kodi\addons\skin.estuary\xml\Home-%app%.xml C:\Users\yourusername\AppData\Roaming\Kodi\addons\skin.estuary\xml\Home.xml "C:\Program Files\Kodi\kodi.exe" del C:\Users\yourusername\AppData\Roaming\Kodi\media\splash.png del C:\Users\yourusername\AppData\Roaming\Kodi\userdata\autoexec.py copy C:\Users\yourusername\AppData\Roaming\Kodi\addons\skin.estuary\xml\Home-original.xml C:\Users\yourusername\AppData\Roaming\Kodi\addons\skin.estuary\xml\Home.xml
- 6. Lastly, you just need to launch this batch script from within WMC. A really easy way to do this is using Media Center Themer, which can add a custom menu strip to WMC. Here's what my file "%appdata%/Media Center Themer/MCTDefault.xml" looks like, with Amazon, Netflix, and even YouTube services. I've also attached the icon I used for Amazon.
Code: Select all
<MediaCenterThemer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MCTSchema.xsd"> <!-- Sample file to modify the start menu of Media Center --> <StartMenu> <!-- Addition of a new menu strip --> <Custom Title="Streaming Services"> <MenuItem Name="Netflix" HideToolbar="true"> <Image>Theme\icon-netflix.png</Image> <Program>Scripts\kodi-netflix.bat</Program> <PlayingDirective>stop</PlayingDirective> </MenuItem> <MenuItem Name="Amazon Video" HideToolbar="true"> <Image>Theme\icon-amazon.png</Image> <Program>Scripts\kodi-amazon.bat</Program> <PlayingDirective>stop</PlayingDirective> </MenuItem> <MenuItem Name="YouTube" HideToolbar="true"> <Image>Theme\icon-youtube.png</Image> <Program>Scripts\kodi-youtube.bat</Program> <PlayingDirective>stop</PlayingDirective> </MenuItem> </Custom> </StartMenu> </MediaCenterThemer>
https://forum.kodi.tv/showthread.php?tid=136798
Let me know if you have any questions with this, or with general Kodi setup issues.