#<VirtualHost *:80>
<VirtualHost 192.168.69.1:80>
	ServerAdmin webmaster@video.ruralcon.net
        ServerName video
#        ServerAlias video video.ruralcon.net

        SetEnv FA_LIB /usr/local/vod4vlc/lib
        SetEnv VOD4VLC_CONFIG /usr/local/vod4vlc/etc/vod4vlc.yaml

        # some odd new brokeness
        EnableSendfile off

	ErrorLog /var/log/apache2/video/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel info

	CustomLog /var/log/apache2/video/access.log combined

	DocumentRoot /usr/local/vod4vlc/www

#        RewriteLog /var/log/apache2/video/rewrite.log
#        RewriteLogLevel 9

# works
# RewriteMap media txt:/home/jjk/src/vod4vlc/rewrite_map.txt
# RewriteRule ^/media/7c5ba64dd4539dbffaf414029a3537d2 /media/OCTOBER_SKY.mkv [L,PT]

        # magic rewrite md5 to pathname
        RewriteEngine On
        RewriteMap media prg:/usr/local/vod4vlc/lib/bin/media_map.pl

# FIXME - MOVE THIS CONTENT TYPE TO media_map.pl
        RewriteRule ^/media/(id/.*)$ ${media:$1} [L,PT,T=application/x-videolan-vlc]

        Alias /ayuh "/Media"
	<Directory /Media>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

        Alias /thumbnails "/usr/local/vod4vlc/var/thumbnails"
	<Directory /usr/local/vod4vlc/var/thumbnails>

                RewriteEngine On

                # if the thumbnail does not exist redirect to
                # no_thumbnail.png        
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule (.*) /images/no_thumbnail.png [L,QSA]

		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

        Alias /previews "/usr/local/vod4vlc/var/previews"
	<Directory /usr/local/vod4vlc/var/previews>

#FIXME ?? fix what?  The path to my homedir?
                RewriteEngine On

                # if the thumbnail does not exist redirect to
                # no_thumbnail.png        
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteRule (.*) /images/no_thumbnail.png [L,QSA]

		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

        Alias /js "/usr/local/vod4vlc/lib/js"
	<Directory /usr/local/vod4vlc/lib/js>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
        </Directory>

	ScriptAlias /cgi-bin/ /usr/local/vod4vlc/lib/cgi-bin/
	<Directory "/usr/local/vod4vlc/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

        <Directory /usr/local/vod4vlc/www/>

                RewriteEngine On
                RewriteBase /cgi-bin/dispatch.pl/
                RewriteRule ^$ /cgi-bin/dispatch.pl/ [L,QSA]
        
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
        
                RewriteRule ^(.*)$ /cgi-bin/dispatch.pl/$1 [L,QSA]

		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
        </Directory>

</VirtualHost>
