First you need an extra tab on the site, this can be done either in the local_conf.py in the following section:
____________________________________________________________________________________________________________________________________________________________
Integrate personal web pages into the web server
PERSONAL_WWW_PAGE = [
('LiveTV', 'Warch live TV', 'test.rpy')
]
____________________________________________________________________________________________________________________________________________________________
or edit the file web_types.py, look for:
____________________________________________________________________________________________________________________________________________________________
(_('Search'),_('Advanced Search Page'),'%ssearch.rpy' % str(strprefix)),
(_('Help'),_('View Online Help and Documentation'),'%shelp/' % str(strprefix))]
# maybe also a personal web pages
____________________________________________________________________________________________________________________________________________________________
and add (_('LiveTV'),_('Watch live TV'),'%stest.rpy' % str(strprefix))] so:
____________________________________________________________________________________________________________________________________________________________
(_('Search'),_('Advanced Search Page'),'%ssearch.rpy' % str(strprefix)),
(_('Help'),_('View Online Help and Documentation'),'%shelp/' % str(strprefix)),
(_('LiveTV'),_('Watch live TV'),'%stest.rpy' % str(strprefix))]
# maybe also a personal web pages
____________________________________________________________________________________________________________________________________________________________
ok now there should be an extra tab called 'LiveTV'
now we need the test.rpy, mine looks like this:
____________________________________________________________________________________________________________________________________________________________
#!/usr/bin/python
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
import sys
import os
from www.web_types import HTMLResource, FreevoResource
class TestResource(FreevoResource):
def _render(self, request):
fv = HTMLResource()
fv.printHeader(_('LiveTV'), 'styles/main.css',selected=_('Test'))
form = request.args
fv.res += "<html>To start the stream server click <a href=\"http://your_ip:port/startstream.rpy\" target=\"_blank\">here.</a> To stop the stream-server click<a href=\"http://your_ip:port/stopstream.rpy\">here.</a> To switch to the channel you can simply click on the channel you want to watch. A new window will pop up and close itself automatically, then the channel should be changed.</html>"
fv.res += "<html><a href=\"MTV.rpy\" target=\"_blank\">MTV</a> <a href=\"TMF.rpy\" target=\"_blank\">TMF</a> <a href=\"national.rpy\" target=\"_blank\">National Geographic</a> <a href=\"discovery.rpy\" target=\"_blank\">Discovery Channel</a> <a href=\"CNN.rpy\" target=\"_blank\">CNN</a> <a href=\"BBC1.rpy\" target=\"_blank\">BBC1</a> <a href=\"BBC2.rpy\" target=\"_blank\">BBC2</a> <a href=\"net5.rpy\" target=\"_blank\">Net5</a> <a href=\"sbs6.rpy\" target=\"_blank\">sbs6</a> <a href=\"veronica.rpy\" target=\"_blank\">Veronica</a> <a href=\"talpa.rpy\" target=\"_blank\">talpa</a> <a href=\"rtl4.rpy\" target=\"_blank\">rtl4</a> <a href=\"rtl5.rpy\" target=\"_blank\">rtl5</a> <a href=\"rtl7.rpy\" target=\"_blank\">rtl7</a> <a href=\"een.rpy\" target=\"_blank\">een</a> <a href=\"euronews.rpy\" target=\"_blank\">Euronews</a> <a href=\"ard.rpy\" target=\"_blank\">ARD</a> <a href=\"zdf.rpy\" target=\"_blank\">ZDF</a> <a href=\"wdr.rpy\" target=\"_blank\">WDR</a> <a href=\"gelderland.rpy\" target=\"_blank\">TV Gelderland</a> <a href=\"ned1.rpy\" target=\"_blank\">Nederland 1</a> <a href=\"ned2.rpy\" target=\"_blank\">Nederland 2</a> <a href=\"ned3.rpy\" target=\"_blank\">Nederland 3</a> <a href=\"ketnet.rpy\" target=\"_blank\">Ketnet/Canvas</a> <a href=\"lokal.rpy\" target=\"_blank\">Lokaal Plus</a> <a href=\"upcinfo.rpy\" target=\"_blank\">UpcInfo</a> <a href=\"trtint.rpy\" target=\"_blank\">TRTint</a> <a href=\"rai1.rpy\" target=\"_blank\">Rai Uno</a> <a href=\"eurosport.rpy\" target=\"_blank\">Eurosport</a> <a href=\"nick.rpy\" target=\"_blank\">Nick/Comedy Central</a> <a href=\"tellsell.rpy\" target=\"_blank\">TellSell</a> <a href=\"tv5.rpy\" target=\"_blank\">TV5</a> <a href=\"cam.rpy\" target=\"_blank\">cam</a></html>"
fv.res += "<center><OBJECT ID=\"MediaPlayer\" WIDTH=320 HEIGHT=300 CLASSID=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" STANDBY=\"Loading Windows Media Player components...\" TYPE=\"application/x-oleobject\" /><param name=\"autoStart\" value=\"true\" /><PARAM NAME=\"error\" VALUE=\"item\" /><PARAM NAME=\"stretchToFit\" VALUE=\"false\" /><PARAM NAME=\"ShowStatusBar\" VALUE=\"true\" /><PARAM NAME=\"FileName\" VALUE=\"mms://your_ip:port\" /> <EMBED TYPE=\"application/x-mplayer2\" SRC=\"mms://your_ip:port\"NAME=\"MediaPlayer\" WIDTH=320 HEIGHT=300 ShowStatusBar=\"1\" /></EMBED></OBJECT></center>"
return String( fv.res )
resource = TestResource()
____________________________________________________________________________________________________________________________________________________________
the test.rpy first gives you a link to start and stop a vlc stream, which are actually two streams at ones, one is a http stream the other a mms stream next to it there are links to e.g. MTV.rpy which enables you to switch the channel from the current one to (in this example) MTV withouth interupting the stream, when clicked on the link MTV.rpy another window pops up, execute the channel switching command and closes afterwards
below the links there is an embedded mediaplayer for internet explorer and should also work in firefox in which you should be able to view the stream, alternatively the stream can also be opened in vlc via the http stream, using e.g. http://your_ip:port the port settings depend on what you set when the vlc stream command is executed, this happens in the file 'startstream.rpy' which is shown below:
____________________________________________________________________________________________________________________________________________________________
#!/usr/bin/python
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
import sys
import os
from www.web_types import HTMLResource, FreevoResource
class TestResource(FreevoResource):
def _render(self, request):
fv = HTMLResource()
fv.printHeader(_('LiveTV'), 'styles/main.css',selected=_('Test'))
form = request.args
command = "vlc v4l:/dev/video0:norm=pal:frequency=767250:size=320x240:channel=0:adev=/dev/dsp:audio=0 --sout \'#transcode{vcodec=DIV3,vb=3000,scale=1,acodec=mp3,ab=256,channels=2}:duplicate{dst=std{access=http,mux=ts,url=your_ip:port},dst=std{access=mmsh,mux=asfh,dst=:port}}\' -I dummy&"
os.system(command)
fv.res += "<html><script language=\"JavaScript\"> close();</script></html>"
return String( fv.res )
resource = TestResource()
____________________________________________________________________________________________________________________________________________________________
the script above starts the vlc stream, when clicked on the link a window will pop up and close itself afterwards, here you should set your ip and port 'url=your_ip:port' and 'dst=:port'
now for the channel/station links *.rpy i will continue with the MTV.rpy example:
____________________________________________________________________________________________________________________________________________________________
#!/usr/bin/python
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
import sys
import os
from www.web_types import HTMLResource, FreevoResource
class TestResource(FreevoResource):
def _render(self, request):
fv = HTMLResource()
fv.printHeader(_('LiveTV'), 'styles/main.css',selected=_('Test'))
form = request.args
command = "v4lctl setstation MTV"
os.system(command)
fv.res += "<html><script language=\"JavaScript\"> close();</script></html>"
return String( fv.res )
resource = TestResource()
____________________________________________________________________________________________________________________________________________________________
when clicked on the link a window pops up and executes the command 'v4lctl setstation MTV' switching the current channel to MTV and closes the window again
in order for 'v4lctl setstation TMF' to work you need to have a working .xawtv config file, because the channel names have to be identical with what has been specified in that file in order for 'v4lctl' to work, usually the file is located at:
/home/user/.xawtv
mine looks like this:
____________________________________________________________________________________________________________________________________________________________
[global]
ratio = 4:3
freqtab = europe-west
pixsize = 128 x 96
pixcols = 1
jpeg-quality = 75
keypad-ntsc = no
keypad-partial = yes
osd = yes
osd-position = 30 , 20
use-wm-fullscreen = yes
# [Station name]
# capture = overlay | grabdisplay | on | off
# input = Television | Composite1 | S-Video | ...
# norm = PAL | NTSC | SECAM | ...
# channel = #
# fine = # (-128..+127)
# key = keysym | modifier+keysym
# color = #
# bright = #
# hue = #
# contrast = #
[defaults]
group = main
norm = PAL
input = Television
capture = over
color = 74%
[MTV]
channel = 58
capture = on
[TellSell]
channel = 29
capture = on
fine = +9
[Discovery Channel]
channel = 62
capture = on
[TMF]
channel = 33
capture = on
[CNN]
channel = 56
[TV5]
channel = SE19
capture = on
____________________________________________________________________________________________________________________________________________________________
and so on the important thing here are the station names in the '[blabla]' brackets these we need for the 'v4lctl' command to work properly
you need to create for each channel, which you want to be able to switch and appear as a link, a rpy file like the MTV one so MTV.rpy, TMF.rpy, CNN.rpy and so on, with the same content just the 'v4lctl setstation MTV' has to be adjusted to the channel name according to the .xawtv file
next is the vlc stop stream command, this one pops up a new window kills all vlc process on your server and closes the window again, this is called stopstream.rpy:
____________________________________________________________________________________________________________________________________________________________
#!/usr/bin/python
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
import sys
import os
from www.web_types import HTMLResource, FreevoResource
class TestResource(FreevoResource):
def _render(self, request):
fv = HTMLResource()
fv.printHeader(_('LiveTV'), 'styles/main.css',selected=_('Test'))
form = request.args
command = "killall vlc"
os.system(command)
fv.res += "<html>Streamserver is shutdown.</html>"
return String( fv.res )
resource = TestResource()
____________________________________________________________________________________________________________________________________________________________
i have a button to start and stop the vlc stream server cuz my pc is slow and takes up too much cpu when not used...
and also it is important that the user who starts the webserver has permissions to use your /dev/video or /dev/video0 and /dev/dsp so sound and video
the *.rpy files should all be put where also the other (index.rpy, guide.rpy...) *.rpy's are should be in a directory like 'share/freevo/htdocs'
then you have to restart everything and it should work, it does here :)