TV Channels on Plex

I just wanted to know if it is possible to add a plugin that streams TV from a website. The TV stream uses HTTP or RTMP. I tried to use it with Airplay from the app on iPod touch but it doesn’t send the video signal through AirVideoEnabler properly. Actually it just stops.



It would be great to use it with Plex.



The stream is only available in Switzerland.

yes.

Good news. Now the more difficult part is how to do it?



I have to login in order to use the streams. These streams are played in a flash, but I can choose html or rtmp.



My plans are to have an entry for every channel including logos. It probably is needed to have a login like in the gametrailers plugin.

so are you wanting to write a plugin for this, or are you asking someone to write a plugin for it?

Well I have no experience in making a video-plugin so if someone can do it I would appreciate it.

I don’t have the time to write one, but I can help you write one.Otherwise, put a request with relevant info (website, country) in the Plugins section

Yes, I can give it a try. Might be easier than I think.



Maybe it would help to have an example of how to login on a website and get streamurls (if they aren’t fix).



However I don’t know how to get the streaming URLS.

download pandora. It should show you how to do logins. Also, install any other video plugin.



Once the plugin is installed in plex, go to ~Library/Application Support/Plex Media Server/Plugin-ins/name of plugin. Right Click on the plugin and select “Show Package Contents”. Inside of the new finder window, nacvigate to Content/Code/init.py. Open this with a text editor. Plex uses python as it’s plugin programming language. Mess around with this code, try to figure out what it’s doing, and post any questions you have here.

I have a lot of questions. :slight_smile:



I think configuring is not needed for TV. I just want a number of channels on the first page. There’s nothing to configure. I don’t know if a login with Safari would be enough, since I can’t test it inside Plex. Otherwise I have no idea how the login in Plex works.



How can I define an icon (local or not, just the easier way) with a fixed title which opens the (variable?) stream?



How can I find out the stream that should open. This is all inside flash and I don’t know how to extract it.



If I had one stream working I could proceed but for now it is too complex without additional knowledge.

You went in full tilt, and that’s good. Let’s back up a couple of steps though. What video plugin are you using? I’ll use the same one as examples.

I think gamtrailers would be a good example as they have a login for it. However it is no live-stream, but I guess it should work.



Other plugins I use:

Apple Movie Trailers

Schweizer Fernsehen (sf.tv) suffering from flash issue

Good deal. It’s a complicated one, but we’ll work through it. Also, what site are you trying to get videos from?



To start with, it’s a Framework version 1 plugin, so there are some extra includes at the top that aren’t needed in Framework V2 and ideally new plugins will work with V2, but let’s get something working first before we start worrying about framework versions.


  1. In you ~/Library/Application Support/Plex Media Server/Plug-ins folder, copy the Gametrailers bundle and rename it to the site you want.
  2. Open up the Info.plist file in the Contents folder of your new plugin. It will look like this:



<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
	<key>CFBundleDevelopmentRegion</key><br />
	<string>English</string><br />
	<key>CFBundleExecutable</key><br />
	<string>Hello</string><br />
	<key>CFBundleIdentifier</key><br />
	<string>com.plexapp.plugins.gametrailers</string><br />
	<key>CFBundleInfoDictionaryVersion</key><br />
	<string>6.0</string><br />
	<key>CFBundlePackageType</key><br />
	<string>AAPL</string><br />
	<key>CFBundleSignature</key><br />
	<string>hook</string><br />
	<key>CFBundleVersion</key><br />
	<string>1.0</string><br />
	<key>PlexClientPlatforms</key><br />
	<string>MacOSX</string><br />
	<key>PlexFrameworkVersion</key><br />
	<string>1</string><br />
	<key>PlexPluginDebug</key><br />
	<string>1</string><br />
	<key>PlexPluginMode</key><br />
	<string>AlwaysOn</string><br />
	<key>PlexPluginPrefixes</key><br />
	<array><br />
		<string>/video/gametrailers</string><br />
	</array><br />
</dict><br />
</plist>




3. Change this key and info pair


<key>CFBundleIdentifier</key><br />
	<string>com.plexapp.plugins.gametrailers</string>



by changing .gametrailers to the name of your new plugin.

4. Change this key and info pair


	<key>PlexPluginPrefixes</key><br />
	<array><br />
		<string>/video/gametrailers</string><br />
	</array>



by changing /gametrailers to the name of your new plugin.

5. Next open up the _init_.py file inside the Code folder with a text editor. The first part looks like this:


import re<br />
from PMS import *<br />
from PMS.Objects import *<br />
from PMS.Shortcuts import *<br />
<br />
from ScrewAttack import *<br />
from InvisibleWalls import *<br />
from Countdown import *<br />
from Retrospectives import *<br />
from Anthology import *<br />
from GTTV import *<br />
from BonusRound import *<br />
<br />
from Support import *<br />
<br />
####################################################################################################<br />
<br />
GT_PREFIX           		= '/video/gametrailers'<br />
GT_PLAY_PREFIX          	= '/video/gametrailers-play'<br />
<br />
GT_URL                  	= 'http://www.gametrailers.com'<br />
GT_RSS_BASE         		= 'http://www.gametrailers.com/rssgenerate.php?s1='<br />
GT_SEARCH_URL       		= 'http://www.gametrailers.com/search.php?page=0&s=%s&str_type=movies&ac=1'<br />
GT_SEARCH_BASE          	= 'http://www.gametrailers.com/search.php'<br />
GT_HIGHLIGHTS_URL   		= 'http://www.gametrailers.com/index_ajaxfuncs.php?do=get_movie_page&type=%s&page=%d&loading=0'<br />
GT_TOP20_URL            	= 'http://www.gametrailers.com/top20.php?toplist=media&topsublist=%s&plattyfilt=all&page=%d'<br />
<br />
GT_CATEGORIES       		= [ 'allcategories', 'review', 'preview', 'interview', 'gameplay', 'trailer', 'feature' ]<br />
# Available platforms. Note: There is a 'classic' platform RSS feed but there is no content in it<br />
GT_PLATFORMS            	= [ 'allplatforms', 'wii', 'xb360', 'ps3', 'pc', 'xbox', 'gc', 'ps2', 'gba', 'ds', 'psp', 'mob' ]<br />
<br />
# Downloadable files are available in these formats<br />
GT_MEDIATYPES       		= [ 'mov', 'wmv', 'mp4' ]<br />
<br />
MAX_ITEM_COUNT      	= 20 # Maximum number of items to display per page<br />
<br />
DEBUG_XML_RESPONSE	     	= True<br />
CACHE_INTERVAL               		= 1800 # Since we are not pre-fetching content this cache time seems reasonable <br />
CACHE_RSS_INTERVAL           		= 1800<br />
CACHE_HIGHLIGHTS_INTERVAL          	= 1800<br />
CACHE_SEARCH_INTERVAL	     	= 600<br />
<br />
RSS_NAMESPACE                  	= {'exInfo':'http://www.gametrailers.com/rssexplained.php'}<br />
<br />
LOGIN_PREF_KEY = "login"<br />
PASSWD_PREF_KEY = "passwd"<br />
LOGGED_IN = "loggedIn"<br />
<br />
####################################################################################################<br />




Let's simplify it to look like this:


 import re<br />
from PMS import *<br />
from PMS.Objects import *<br />
from PMS.Shortcuts import *<br />




That takes out the site specific includes. You won't need those.

6. The next section needs to include your specific info.


####################################################################################################<br />
<br />
GT_PREFIX           		= '/video/gametrailers'<br />
GT_PLAY_PREFIX          	= '/video/gametrailers-play'<br />
<br />
GT_URL                  	= 'http://www.gametrailers.com'<br />
GT_RSS_BASE         		=  'http://www.gametrailers.com/rssgenerate.php?s1='<br />
GT_SEARCH_URL       		=  'http://www.gametrailers.com/search.php?page=0&s=%s&str_type=movies&ac=1'<br />
GT_SEARCH_BASE          	= 'http://www.gametrailers.com/search.php'<br />
GT_HIGHLIGHTS_URL   		=  'http://www.gametrailers.com/index_ajaxfuncs.php?do=get_movie_page&type=%s&page=%d&loading=0'<br />
GT_TOP20_URL            	=  'http://www.gametrailers.com/top20.php?toplist=media&topsublist=%s&plattyfilt=all&page=%d'<br />




change the prefix to what you put in the info.plist, and delete the play prefix. Put in the base url of your site into GT_URL, and change the variable name "GT_URL" to something specific for your site.



Next we'll get into defining the main menu of your plugin, the menu that pops up when you first select it. I actually have to jet for most of the afternoon, but I'll chime in when I get home. The steps we're going to take are this:

1. Setup your plugin.
2. Look at the source code of the site you're interested in.
3. Pull that information into your plugin using python and xpath
4. Tell Plex where the video streams are located either with a straight file location if we're lucky, or the url that has the video in it.
5. Play videos in Plex if we can get everything else.

Thank you a lot for your help.



chhitz just made a plugin for my site so we don’t have to continue. I will have a look in his plugin to learn more about it. Who knows maybe I’ll try another one some day.



Again thank you!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.