Friday, October 13, 2006
Network Video Server for WinTV USB2 TV Tuner
I just set up a streaming server for my Hauppauge WinTV USB2 TV tuner and it seems to work OK. I am using the Video Lan Client (VLC) to stream the video. It seems to work pretty well with the WinTV tuner. The open source and freeware VLC software is found here:
To make things work, I created a playlist containing all the channels I want to view -- which isn't much with basic cable -- and then I created a startup script to start things locally with the HTTP/web interface running. The playlist file,
And the startup file,
I start the bat file and the VLC GUI starts up showing the first channel in the playlist. Once it starts, I can open a browser to
Once this is running I can watch the TV from another computer by accessing the computer running the server by opening a copy of VLC on the client computer and going to the "File", "Open Network Stream..." menu option. I use the HTTP option and enter the IP address for the server machine with the port number of 1234 following it. Something like this:
I am having a bit of a problem with the video and audio being choppy, but I think that is mostly because my system isn't the fastest, and Windows XP isn't so great when you need low latencies. The systme is about as not as bad as the Hauppage WinTV system gets when I try to have it save video to files in anything but the raw format. If I don't do anything else on the machine it seems to work OK.
I'll update this page if I figure out any ways to get things running any smoother.
http://www.videolan.org/To make things work, I created a playlist containing all the channels I want to view -- which isn't much with basic cable -- and then I created a startup script to start things locally with the HTTP/web interface running. The playlist file,
vlc playlist.m3u", looks a bit like this (I have only shown the first 2 channels, so remove the "..." to use):
#EXTM3U
#EXTINF:0,Cable 3 ABC
#EXTVLCOPT:dshow-vdev=WinTV USB2 Video
#EXTVLCOPT:dshow-adev=WinTV USB2 Audio Device
#EXTVLCOPT:dshow-size=320x240
#EXTVLCOPT:dshow-tuner-channel=3
#EXTVLCOPT:sout=#transcode{vcodec=mp4v,vb=512,scale=1,acodec=mpga,ab=96,channels=2}:duplicate{dst=display,dst=std{access=http,mux=ts,dst=:1234}}
dshow://
#EXTINF:0,Cable 4 FOX5
#EXTVLCOPT:dshow-vdev=WinTV USB2 Video
#EXTVLCOPT:dshow-adev=WinTV USB2 Audio Device
#EXTVLCOPT:dshow-size=320x240
#EXTVLCOPT:dshow-tuner-channel=4
#EXTVLCOPT:sout=#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=display,dst=std{access=http,mux=ts,dst=:1234}}
dshow://
...
And the startup file,
vlc.bat is this:
"C:\Program Files\VideoLAN\VLC\vlc.exe" --extraintf=http "vlc playlist.m3u"
I start the bat file and the VLC GUI starts up showing the first channel in the playlist. Once it starts, I can open a browser to
http://localhost:8080/ to control things. It shows of the list of channels from the playlist file, and I can change channels by clicking on the ones in the list. Obviously I needed to open up my firewall to be able to access the web control interface from another computer. The default port for VLC control is 8080 (It can be changed somehow...).Once this is running I can watch the TV from another computer by accessing the computer running the server by opening a copy of VLC on the client computer and going to the "File", "Open Network Stream..." menu option. I use the HTTP option and enter the IP address for the server machine with the port number of 1234 following it. Something like this:
http://192.168.1.3:1234I am having a bit of a problem with the video and audio being choppy, but I think that is mostly because my system isn't the fastest, and Windows XP isn't so great when you need low latencies. The systme is about as not as bad as the Hauppage WinTV system gets when I try to have it save video to files in anything but the raw format. If I don't do anything else on the machine it seems to work OK.
I'll update this page if I figure out any ways to get things running any smoother.
Friday, October 06, 2006
Importing Users in Plone 2.5
To get a new site going from an old Plone 1.0.5 site, I decided to recreate everything from scratch rather than upgrading (not sure that would even be possible). Most of the content I will just manually convert since there isn't much of that to do.
But I wanted to move at least the old 'acl_users' list over programatically. I found this page which was pretty helful in that respect:
http://www.parit.ca/documentation/plonestuff/plone-training-part-7-scripting-users
So I have written the Python code shown below to do what I want. I put this code in the file 'acl_users_import.py' in the 'Extensions' directory of my Plone/Zope instance.
Then I went into the ZMI and created an "External Method" with the following entries:
Here is the code I put in the 'PLONEHOME/Extentions' dirctory as 'acl_users_import.py':
Then I created a tab separated file with the info I wanted to import and put it in the 'PLONEHOME/Extensions' directory as well. The file path in the code above needs to be changed to reflect the full path to that file. Here is an example of the 'acl_users_import_list.txt' file:
But I wanted to move at least the old 'acl_users' list over programatically. I found this page which was pretty helful in that respect:
http://www.parit.ca/documentation/plonestuff/plone-training-part-7-scripting-users
So I have written the Python code shown below to do what I want. I put this code in the file 'acl_users_import.py' in the 'Extensions' directory of my Plone/Zope instance.
Then I went into the ZMI and created an "External Method" with the following entries:
Id: acl_users_import
Title: acl_users_import
Module Name: acl_users_import
Function Name: acl_users_import
Here is the code I put in the 'PLONEHOME/Extentions' dirctory as 'acl_users_import.py':
def acl_users_import(self):
""""""
#self.doAddUser(name='foo', password='foo', roles=['Member'],
# domains=[], groups=['Reviewers'])
ret = 'Running acl_users_import.py.\n'
pr = self.portal_registration
filename = '/home/zope6/Extensions/acl_users_import_list.txt'
ret += 'Reading tab separated file \"%s\".\n' % filename
try:
fp = open(filename, 'r')
except IOError, msg:
ret += 'Error: %s\n' % msg
return ret
ret += 'Skipping first line.\n'
# Skip first line.
fp.readline()
for line in fp.readlines():
line = line.strip()
elements = line.split('\t')
id = elements[0]
pw = elements[1]
email = elements[2]
fullname = elements[3]
roles=('Member',)
ret += 'Adding %s (%s)\n' % (id, fullname)
try:
member = pr.addMember(id, pw, roles,
properties={ 'username': id,
'email' : email,
'fullname': fullname,
})
except ValueError, msg:
ret += ' Error: %s\n' % msg
fp.close()
return ret
Then I created a tab separated file with the info I wanted to import and put it in the 'PLONEHOME/Extensions' directory as well. The file path in the code above needs to be changed to reflect the full path to that file. Here is an example of the 'acl_users_import_list.txt' file:
ID pw email Name
foo foobar sim@noisygecko.com Foo
foo2 foobar sim@noisygecko.com Foo2
foo3 foobar sim@noisygecko.com Foo3
Fedora Core 5 Install Notes
These are just some notes I am making to help with a Fedora Core 5 install I just made. Mostly I am happy with the fact that there aren't a huge number of things I need to do to get Fedora running about the way I want it these days. I just wanted to jot down what I found I needed to to for future reference.
I did the whole install thing without a problem. Mostly chose defaults, but I tend to install just about everything. I don't think that is as much of an issue as it used to be before 'yum' was used to handle the RPM repository. Now if you miss a package, it is usually just a single command to install it and everything it depends on.
Set myself up in sudo by adding this line to the /etc/sudoers file:
sim ALL=(ALL) ALL
Another thing I do eventually is to rebuild RPM's from source. Fedora provides a framework for doing this, so it is good to install it before you try installing a SOURCE RPM and get error messages like this:
Here is how to install the required package:
I did the whole install thing without a problem. Mostly chose defaults, but I tend to install just about everything. I don't think that is as much of an issue as it used to be before 'yum' was used to handle the RPM repository. Now if you miss a package, it is usually just a single command to install it and everything it depends on.
After Basic Install
I need to have xemacs:
yum install xemacs
Set myself up in sudo by adding this line to the /etc/sudoers file:
sim ALL=(ALL) ALL
Another thing I do eventually is to rebuild RPM's from source. Fedora provides a framework for doing this, so it is good to install it before you try installing a SOURCE RPM and get error messages like this:
warning: group mockbuild does not exist - using root
Here is how to install the required package:
yum install fedora-rpmdevtools
Installing webmin:
- First install the
perlNet::SSLeaymodule:yum install perl-Net-SSLeay
- Download the latest version of 'webmin-..tar.gz':
tar xvzf webmin-*.*.tar.gz
cd webmin-*.*
./setup.sh - Add line to "/etc/sysconfig/iptables" to open
up port 10000 to allow connection to webmin
(if you used defaults above):-A RH-Firewall-l-INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT
- Now I can connect to webmin and change that
terrible default theme:https://localhost:10000/webmin/edit_themes.cgi
There is actually a decent theme included with
the latest versions called "Simple Blue Theme".
VNC Server Setup
- Edit the
/etc/sysconfig/vncserversfile to
list the servers to start. Something like this
should work:VNCSERVERS="1:sim"
VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"
Note: The '-localhost' option makes it so that
no direct connections are allowed across the
unsecured network. This is probably the
best way to do things and then use SSH to
tunnel the port, in this case port 5901. - Now log in as the user, in this case
sim,
and runvncpasswd. This password will be used
when making the connection.You will probably want to edit the
~/.vnc/xstartupfile since the default is
to use the oldxwmwindow manager.
(I don't really remember the name of it...). - Now start the service as root:
service vncserver start