Videocache is a Squid URL rewriter plugin written in Python

for bandwidth optimization while browsing famous video
sharing portals/websites like Youtube, Metacafe etc.
It helps you save bandwidth when a particular video is
requested more than once from the same network/machine.

WWW:	http://www.cachevideos.com/

PR:		ports/134116
Submitted by:	Murilo Opsfelder <mopsfelder at gmail.com>
This commit is contained in:
Martin Wilke 2009-05-10 22:25:34 +00:00
parent 32b8b31484
commit ee6b29827d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=233648
7 changed files with 111 additions and 0 deletions

View File

@ -1551,6 +1551,7 @@
SUBDIR += validator
SUBDIR += varnish
SUBDIR += vee
SUBDIR += videocache
SUBDIR += visitors
SUBDIR += vtiger
SUBDIR += vtiger-customerportal

54
www/videocache/Makefile Normal file
View File

@ -0,0 +1,54 @@
# New ports collection makefile for: videocache
# Date created: 2009-04-30
# Whom: Murilo Opsfelder <mopsfelder@gmail.com>
#
# $FreeBSD$
#
PORTNAME= videocache
PORTVERSION= 1.9.1
CATEGORIES= www
MASTER_SITES= http://cachevideos.com/sites/default/files/pub/videocache/
MAINTAINER= mopsfelder@gmail.com
COMMENT= A Squid URL rewriter for bandwidth optimization
RUN_DEPENDS= ${LOCALBASE}/sbin/squid:${PORTSDIR}/www/squid \
${PYTHON_SITELIBDIR}/urlgrabber/grabber.py:${PORTSDIR}/www/py-urlgrabber \
${PYTHON_SITELIBDIR}/iniparse/ini.py:${PORTSDIR}/devel/py-iniparse
NO_BUILD= yes
USE_PYTHON= yes
MAN8= videocache.8.gz
PORTDOCS= CHANGELOG COPYING Readme
PORTEXAMPLES= squid.conf
SUB_FILES= pkg-message
.include <bsd.port.pre.mk>
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/update-vc ${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/videocache.8.gz ${MAN1PREFIX}/man/man8
${INSTALL_DATA} ${WRKSRC}/videocache-sysconfig.conf ${PREFIX}/etc/videocache.conf.default
@[ -f ${PREFIX}/etc/videocache.conf ] || \
${CP} -v ${PREFIX}/etc/videocache.conf.default ${PREFIX}/etc/videocache.conf
${MKDIR} ${DATADIR}
${INSTALL_DATA} ${WRKSRC}/videocache/*.py ${DATADIR}
.if !defined(NOPORTEXAMPLES)
${MKDIR} ${EXAMPLESDIR}
${INSTALL_DATA} ${FILESDIR}/squid.conf.example ${EXAMPLESDIR}/squid.conf
.endif
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
. for doc in ${PORTDOCS}
${INSTALL_DATA} ${WRKSRC}/${doc} ${DOCSDIR}
. endfor
.endif
post-install:
.if !defined(NOPORTEXAMPLES)
${CAT} ${PKGMESSAGE}
.endif
.include <bsd.port.post.mk>

3
www/videocache/distinfo Normal file
View File

@ -0,0 +1,3 @@
MD5 (videocache-1.9.1.tar.gz) = 0dac8dd20d67c252e1da13e1e9ad5cd5
SHA256 (videocache-1.9.1.tar.gz) = b814c6dec236c842dda1258be142556874ca4c33247a83e11609bfa6bb10cf8b
SIZE (videocache-1.9.1.tar.gz) = 52631

View File

@ -0,0 +1,3 @@
See the following sample file to configure your ACL's on squid.conf:
%%EXAMPLESDIR%%/squid.conf

View File

@ -0,0 +1,32 @@
==============================================================================
Add the following sample lines to your squid.conf:
# --BEGIN-- videocache config for squid
url_rewrite_program %%PREFIX%%/bin/python %%DATADIR%%/videocache/videocache.py
url_rewrite_children 7
acl videocache_allow_url url_regex -i \.youtube\.com\/get_video\?
acl videocache_allow_url url_regex -i \.googlevideo\.com\/videoplayback \.googlevideo\.com\/videoplay \.googlevideo\.com\/get_video\?
acl videocache_allow_url url_regex -i \.google\.com\/videoplayback \.google\.com\/videoplay \.google\.com\/get_video\?
acl videocache_allow_url url_regex -i \.google\.[a-z][a-z]\/videoplayback \.google\.[a-z][a-z]\/videoplay \.google\.[a-z][a-z]\/get_video\?
acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplayback\?
acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplay\?
acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/get_video\?
acl videocache_allow_url url_regex -i proxy[a-z0-9\-][a-z0-9][a-z0-9][a-z0-9]?\.dailymotion\.com\/
acl videocache_allow_url url_regex -i vid\.akm\.dailymotion\.com\/
acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv
acl videocache_allow_url url_regex -i bitcast\.vimeo\.com\/vimeo\/videos\/
acl videocache_allow_url url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]?
acl videocache_allow_url url_regex -i \.files\.youporn\.com\/(.*)\/flv\/
acl videocache_allow_url url_regex -i \.msn\.com\.edgesuite\.net\/(.*)\.flv
acl videocache_allow_url url_regex -i media[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ mobile[a-z0-9]?[a-z0-9]?[a-z0-9]?\.ta-z0-9]?[a-z0-9]?\.blip\.tv\/(.*)\.(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram)
acl videocache_allow_url url_regex -i video\.break\.com\/(.*)\.(flv|mp4)
acl videocache_allow_dom dstdomain .mccont.com dl.redtube.com .cdn.dailymotion.com
acl videocache_deny_url url_regex -i http:\/\/[a-z][a-z]\.youtube\.com http:\/\/www\.youtube\.com
url_rewrite_access deny videocache_deny_url
url_rewrite_access allow videocache_allow_url
url_rewrite_access allow videocache_allow_dom
redirector_bypass on
# --END-- videocache config for squid
==============================================================================

7
www/videocache/pkg-descr Normal file
View File

@ -0,0 +1,7 @@
Videocache is a Squid URL rewriter plugin written in Python
for bandwidth optimization while browsing famous video
sharing portals/websites like Youtube, Metacafe etc.
It helps you save bandwidth when a particular video is
requested more than once from the same network/machine.
WWW: http://www.cachevideos.com/

11
www/videocache/pkg-plist Normal file
View File

@ -0,0 +1,11 @@
@comment $FreeBSD$
bin/update-vc
@unexec if cmp -s %D/etc/videocache.conf %D/etc/videocache.conf.default; then rm -f %D/etc/videocache.conf; fi
etc/videocache.conf.default
@exec [ -f %B/videocache.conf ] || cp %B/%f %B/videocache.conf
%%DATADIR%%/Errors.py
%%DATADIR%%/__init__.py
%%DATADIR%%/config.py
%%DATADIR%%/parser.py
%%DATADIR%%/videocache.py
@dirrm %%DATADIR%%