Import recordings in Kodi, watch in WMC
#1
Because of DRM, I can't watch recordings from my HDHomerun Prime in Kodi. But, I would like to integrate them into my library. How can I launch WMC to watch the recordings from Kodi?

Thanks
Reply
#2
Pretty sure the only way to do something like this would be to make changes to the pvr.wmc plugin, and even with that I don't believe it would work very well.
Windows Media Center PVR addon (pvr.wmc) and server backend (ServerWMC)
http://bit.ly/serverwmc
Reply
#3
Well, I found a way to play the recordings in WMC. You need to create a playercorefactory.xml (wiki) file in userdata folder. So, that will launch WMC and play the file. Now, the problem is getting the recordings into the library. WMC records movies and tv shows into the same folder. Kodi doesn't like that. And because of the DRM, I can't move them into separate folders. Pretty sure there's no way to change WMC's behavior. If anyone's solved this problem, let me know. As a first try, I'm going to create nfo files and see if that helps.
Reply
#4
I've never tried to integrate the files like that, for DRM shows I just have Advanced Launcher plugin that runs the full WMC and then I just use the native WMC library to see the files. Would be interesting if you can get this working as an alternative.
Reply
#5
Progress!!

Several hurdles hurdled with one last big one. Here's what I've done, if it helps anyone:

Hurdle 1: Get Kodi to play certain files in WMC.

Create/edit playercorefactory.xml (wiki) in the userdata folder to tell Kodi which video player to use for *.wtv files:

xml:

<?xml version="1.0" encoding="UTF-8"?>
<playercorefactory>
  <players>
    <player name="Windows Media Center" type="ExternalPlayer" audio="false" video="true">
        <filename>C:\Windows\ehome\ehshell.exe</filename>
        <args>"{1}"</args>
        <playcountminimumtime>20</playcountminimumtime>
    </player>
  </players>

  <rules action="prepend">
    <rule filetypes="wtv" player="Windows Media Center" />
  </rules>
</playercorefactory>

After adding WMC's Recorded TV folder under Videos/Files/Add..., Kodi opens WMC to play *.wtv files.

Hurdle 2: Get the files into Kodi's library. The files cannot be moved and Kodi doesn't handle movies and tv shows in the same folder.

Out of the box thought...create a shortcut (.lnk) file! This can be placed anywhere and will play the recording when opened.
Kodi must be told that these files are video files. To do this, create/edit advancedsettings.xml (wiki) in the userdata folder:

xml:

<advancedsettings>
    <videoextensions>
      <add>.lnk</add>
    </videoextensions>
</advancedsettings>

We also need to edit playercorefactory.xml to include *.lnk files to be played by WMC:

xml:

...
  <rules action="prepend">
    <rule filetypes="wtv|lnk" player="Windows Media Center" />
  </rules>
...

Now that Kodi considers that these files are videos, it will scrape them into the library. However, this leads to...

Hurdle 3: WMC launches, but the recording doesn't play.

The path Kodi is passing is something like c:\some\path\recording.wtv.lnk to WMC. Not good. That ".lnk" is messing everything up!
We need a way to just open the file. So, I used a batch file, I called it PlayWMC.bat:

Code:

@echo off
%1
ping localhost -n 10 >NUL

It should work with just %1 in it. But, it opens and closes too fast and WMC never launches. So, that ping line introduces a delay of about 10 seconds.
Since it takes 3-4 seconds to open WMC, a message for my impatient family was added. PlayWMC.bat:

Code:

@echo off
%1
echo "                    _       ____            _____  _____  _   _   _____                       ";
echo "                   | |     / __ \    /\    |  __ \|_   _|| \ | | / ____|                      ";
echo "                   | |    | |  | |  /  \   | |  | | | |  |  \| || |  __                       ";
echo "                   | |    | |  | | / /\ \  | |  | | | |  | . ` || | |_ |                      ";
echo "                   | |____| |__| |/ ____ \ | |__| |_| |_ | |\  || |__| |                      ";
echo "                   |______|\____//_/    \_\|_____/|_____||_| \_| \_____|                      ";
echo "                                                                                              ";
echo "                                                                                              ";
echo "  _____   _       ______             _____  ______  __          __       _____  _______       ";
echo " |  __ \ | |     |  ____|    /\     / ____||  ____| \ \        / //\    |_   _||__   __|      ";
echo " | |__) || |     | |__      /  \   | (___  | |__     \ \  /\  / //  \     | |     | |         ";
echo " |  ___/ | |     |  __|    / /\ \   \___ \ |  __|     \ \/  \/ // /\ \    | |     | |         ";
echo " | |     | |____ | |____  / ____ \  ____) || |____     \  /\  // ____ \  _| |_    | | _  _  _ ";
echo " |_|     |______||______|/_/    \_\|_____/ |______|     \/  \//_/    \_\|_____|   |_|(_)(_)(_)";
echo "                                                                                              ";
echo "                                                                                              ";
ping localhost -n 10 >NUL

Now, we need to edit playercorefactory.xml so that Kodi loads our batch file instead of WMC. We also need it to show the console window so the family knows something is happening:

xml:

<?xml version="1.0" encoding="UTF-8"?>
<playercorefactory>
  <players>
    <player name="Windows Media Center" type="ExternalPlayer" audio="false" video="true">
        <filename>D:\PlayWMC.bat</filename>
        <args>"{1}"</args>
        <hideconsole>false</hideconsole>
        <playcountminimumtime>20</playcountminimumtime>
    </player>
  </players>

  <rules action="prepend">
    <rule filetypes="wtv|lnk" player="Windows Media Center" />
  </rules>
</playercorefactory>

And that leads us to the last really big hurdle: AUTOMATION!
There's not going to be anything out there to do this. So, I'll need to do it myself, probably with a python script.
That'll take me longer to figure out.

One other nice-to-have feature would be returning to Kodi automatically when you stop the video. Maybe an autohotkey script could
intercept the stop or back command and return to Kodi. But that's for after the automation bit.

Hope this makes sense. If anyone has any improvements, please share!
Reply
#6
Crap! I see I left something out.

After hurdle 1 and I got the files to play, I created a Movies folder and put the shortcut files in there (in separate folders). Then, I removed the Recorded TV folder from Kodi and added the Movies folder, setting it's content to Movies. Once I made Kodi consider *.lnk files to be videos (hurdle 2), Kodi could scrape them into the library.

Ugh! Hope I'm explaining this well enough!
Reply
#7
Have you looked into making hard links to the wtv files?  Then you wouldn't have the .lnk problem.  If your not familiar with it, look up the command mklink.
Windows Media Center PVR addon (pvr.wmc) and server backend (ServerWMC)
http://bit.ly/serverwmc
Reply
#8
this  sounds pretty cool.  Please keep us updated on this.  I too use WMC, but only for TV.  It seems to be the only program which allows watching TV while the show is still recording.  All other programs I have tried always seem to glitch.  I also do what jdlive does, and use advanced launcher to simply launch  into recordings, or live TV, or guide.  My biggest issue right now is that the WMC PVR plugin only loads itself about  half the time, so I cant access anything from Kodi anyway.
Reply

Logout Mark Read Team Forum Stats Members Help
Import recordings in Kodi, watch in WMC0