diff options
author | Florian Pritz <bluewind@xssn.at> | 2011-01-16 18:39:41 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xssn.at> | 2011-01-16 18:39:41 +0100 |
commit | 1caa1d5eb39e6d1b0bf96af4be1e095b31495305 (patch) | |
tree | e8a316c6168770f95125263fa9a3d196fa6d74c2 | |
parent | b7197bccd0bc74c2082c935937b6d947c3ae756d (diff) | |
download | aur-packages-1caa1d5eb39e6d1b0bf96af4be1e095b31495305.tar.gz aur-packages-1caa1d5eb39e6d1b0bf96af4be1e095b31495305.tar.xz |
mass changes
Signed-off-by: Florian Pritz <bluewind@xssn.at>
34 files changed, 3117 insertions, 126 deletions
@@ -5,3 +5,4 @@ *.bz2 *.xz *.zip +.*un~ diff --git a/acct/PKGBUILD b/acct/PKGBUILD new file mode 100644 index 0000000..b372d1b --- /dev/null +++ b/acct/PKGBUILD @@ -0,0 +1,36 @@ +# Maintainer: SpepS <dreamspepser at yahoo dot it> +# Contributor: damir <damir@archlinux.org> +# Contributor: phrakture + +pkgname=acct +pkgver=6.5.5 +pkgrel=1 +pkgdesc="The GNU Accounting Utilities provide login and process accounting utilities for GNU/Linux and other systems." +arch=('i686' 'x86_64') +url="http://www.gnu.org/software/acct/" +license=('GPL') +depends=('glibc') +install="$pkgname.install" +source=("http://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz") +md5sums=('554a9e9c6aa3482df07e80853eac0350') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + ./configure --prefix=/usr + + make +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + + make DESTDIR="$pkgdir/" install + + rm $pkgdir/usr/share/info/dir + gzip $pkgdir/usr/share/info/* + + # Renaming last + mv "$pkgdir/usr/bin/last" "$pkgdir/usr/bin/last-acct" + mv "$pkgdir/usr/share/man/man1/last.1" "$pkgdir/usr/share/man/man1/last-acct.1" +} diff --git a/acct/acct.install b/acct/acct.install new file mode 100644 index 0000000..7007f0f --- /dev/null +++ b/acct/acct.install @@ -0,0 +1,20 @@ +infodir=/usr/share/info +filelist=(accounting.info.gz) + +post_install() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info $infodir/$file $infodir/dir 2> /dev/null + done +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info --delete $infodir/$file $infodir/dir 2> /dev/null + done +} diff --git a/cdrtools/PKGBUILD b/cdrtools/PKGBUILD index 3c23356..02d2243 100644 --- a/cdrtools/PKGBUILD +++ b/cdrtools/PKGBUILD @@ -1,9 +1,9 @@ # Maintainer: Lukas Jirkovsky <l.jirkovsky@gmail.com> # Contributor: Tuxbubling <tuxbubling@jabber.fr>, alejandronova pkgname=cdrtools -pkgver=2.01.01a79 +pkgver=3.01a02 pkgrel=1 -pkgdesc="Original cdrtools, supporting CD, DVD and BluRay burning" +pkgdesc="Original cdrtools supporting CD, DVD and BluRay burning" arch=('i686' 'x86_64') url="http://cdrecord.berlios.de/private/cdrecord.html" license=('CDDL') @@ -13,16 +13,22 @@ provides=('cdrkit') backup=('etc/default/cdrecord' 'etc/default/rscsi') install=cdrtools.install source=(http://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-$pkgver.tar.gz) -md5sums=('667d286693942b0bf61eaabbf54d09e2') +md5sums=('302de3e8fc508d873719a0c8bab1eff7') build() { cd "$srcdir"/cdrtools-${pkgver%%a*} sed -i 's|/opt/schily|/usr|g' DEFAULTS/Defaults.linux sed -i 's|DEFINSGRP=.*|DEFINSGRP=root|' DEFAULTS/Defaults.linux - make || return 1 + export GMAKE_NOWARN=true + make +} + +package() { + cd "$srcdir"/cdrtools-${pkgver%%a*} + export GMAKE_NOWARN=true + make INS_BASE="$pkgdir"/usr INS_RBASE="$pkgdir" install - mv "$pkgdir"/usr/man "$pkgdir"/usr/share/ rm -rf "$pkgdir"/usr/include rm -rf "$pkgdir"/usr/lib/{*.a,profiled} find "$pkgdir" -type d -perm 775 -exec chmod 755 '{}' ';' diff --git a/codecs/PKGBUILD b/codecs/PKGBUILD deleted file mode 100644 index ee6114d..0000000 --- a/codecs/PKGBUILD +++ /dev/null @@ -1,38 +0,0 @@ -#Maintainer: Babets - -pkgname=codecs -pkgver=20071007 -pkgrel=6 -pkgdesc="Non-linux native codec pack." -arch=('i686' 'x86_64') -url="http://www.mplayerhq.hu/design7/dload.html" -license=('unknown') -conflicts=('codecs-extra') -replaces=('codecs-extra') -# The codec packages are different -# only the 32 bit package needs legacy libstdc++ -[ "$CARCH" = "i686" ] && depends=('libstdc++5') -[ "$CARCH" = "x86_64" ] && depends=('gcc-libs') -options=('!strip') - -if [ "${CARCH}" = "x86_64" ]; then - source=(http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-${pkgver}.tar.bz2) - md5sums=('8e1ceeec51469f5baac65e56fac709e8') -else - source=(http://www.mplayerhq.hu/MPlayer/releases/codecs/all-${pkgver}.tar.bz2) - md5sums=('0407e8ad132e37ccd3f932448ca201c5') -fi - - -build() { - install -d ${pkgdir}/usr/lib/codecs - cd ${pkgdir}/usr/lib - if [ "${CARCH}" = "x86_64" ]; then - install -m644 ${srcdir}/essential-amd64-${pkgver}/* ${pkgdir}/usr/lib/codecs - else - ln -s codecs win32 - install -m644 ${srcdir}/all-${pkgver}/* ${pkgdir}/usr/lib/codecs - fi - rm ${pkgdir}/usr/lib/codecs/README -} - diff --git a/firefox-nightly/PKGBUILD b/firefox-nightly/PKGBUILD index aa557c6..e1ecf2c 100644 --- a/firefox-nightly/PKGBUILD +++ b/firefox-nightly/PKGBUILD @@ -1,41 +1,35 @@ # Maintainer: Cedric MATHIEU <me.xenom @ gmail.com> +# Contributor : Det # Contributor: coderoar <coderoar @ gmail.com> -arch=('i686' 'x86_64') -license=('MPL' 'GPL' 'LGPL') - pkgname=firefox-nightly -pkgdesc='Standalone web browser from mozilla.org, nightly build.' +pkgdesc='Standalone web browser from mozilla.org, nightly build' url='http://www.mozilla.org/projects/firefox' -pkgver=4.0b9pre +pkgver=4.0b10pre pkgrel=$(date +%Y_%m_%d_%T) - -source=( 'firefox-nightly.desktop' 'firefox-nightly-safe.desktop' ) -md5sums=( '940233ba24a2de784ea6c610872f01e4' '488e66c72fb678d2b99a22fe87bc5974' ) +arch=('i686' 'x86_64') +license=('MPL' 'GPL' 'LGPL') +source=('firefox-nightly.desktop' 'firefox-nightly-safe.desktop') sha1sums=('6880230bc487bd65c5da43c19498f4520793e27b' '7faa96301d1c3d7772da859b96b3420cb0f34bb3') +depends=('desktop-file-utils' 'libxt' 'mime-types' 'nss' 'shared-mime-info') -depends=( 'desktop-file-utils' 'libxt' 'mime-types' 'nss' 'shared-mime-info' ) -makedepends=('wget') - -build() { - cd ${srcdir} - - FX_SRC="firefox-${pkgver}.en-US.linux-${CARCH}.tar.bz2" - FX_SRC_URI="http://ftp.mozilla.org/pub/firefox/nightly/latest-trunk/${FX_SRC}" +package() { + FX_SRC="firefox-${pkgver}.en-US.linux-${CARCH}.tar.bz2" + FX_SRC_URI="http://ftp.mozilla.org/pub/firefox/nightly/latest-trunk/${FX_SRC}" - msg "Downloading..." - wget ${FX_SRC_URI} || return 1 - msg "Extracting..." - bsdtar -x -f ${FX_SRC} || return 1 - msg "Packaging..." + msg "Downloading..." + wget -N ${FX_SRC_URI} + msg "Extracting..." + bsdtar -x -f ${FX_SRC} + msg "Packaging..." -# uncomment this line to remove them if you want -# rm -rf firefox/{extensions,plugins,searchplugins} || return 1 +# uncomment this line to remove these +# rm -rf firefox/{extensions,plugins,searchplugins} - mkdir -p ${pkgdir}/{usr/{bin,share/{applications,pixmaps}},opt} || return 1 - cp -R firefox ${pkgdir}/opt/firefox-${pkgver} || return 1 + mkdir -p "${pkgdir}"/{usr/{bin,share/{applications,pixmaps}},opt} + cp -r firefox "${pkgdir}/opt/firefox-${pkgver}" - ln -s /opt/firefox-${pkgver}/firefox ${pkgdir}/usr/bin/firefox-nightly || return 1 - install -m644 ${srcdir}/{firefox-nightly.desktop,firefox-nightly-safe.desktop} ${pkgdir}/usr/share/applications/ || return 1 - install -m644 ${srcdir}/firefox/icons/mozicon128.png ${pkgdir}/usr/share/pixmaps/${pkgname}-icon.png || return 1 + ln -s /opt/firefox-${pkgver}/firefox "${pkgdir}/usr/bin/firefox-nightly" + install -m644 "${srcdir}"/{firefox-nightly.desktop,firefox-nightly-safe.desktop} "${pkgdir}/usr/share/applications/" + install -m644 "${srcdir}/firefox/icons/mozicon128.png" "${pkgdir}/usr/share/pixmaps/${pkgname}-icon.png" } diff --git a/foomatic-db-foo2zjs/PKGBUILD b/foomatic-db-foo2zjs/PKGBUILD new file mode 100644 index 0000000..b1d0b64 --- /dev/null +++ b/foomatic-db-foo2zjs/PKGBUILD @@ -0,0 +1,46 @@ +pkgname=('foomatic-db-foo2zjs') +arch=('i686' 'x86_64') +_snapdate=20101215 +_relver=4.0.6 +_foomatic_db_pkgrel=1 +pkgver=${_relver}_${_snapdate} +pkgrel=1 +makedepends=() +license=('GPL' 'custom') +depends=('perl' 'libxml2') +optdepends=('foo2zjs') +replaces=('foomatic-db-ppd' 'foomatic-db-hpijs' 'foomatic-db') +conflicts=('foomatic-db-ppd' 'foomatic-db-hpijs' 'foomatic-db') +provides=('foomatic-db-hpijs' 'foomatic-db') +source=(http://mirrors.kernel.org/archlinux/extra/os/${CARCH}/foomatic-db-${pkgver}-${_foomatic_db_pkgrel}-${CARCH}.pkg.tar.xz) +url="http://www.linuxprinting.org/foomatic.html" +if [ x$CARCH == x"x86_64" ]; then + md5sums=('fa546821d42f3f5d5cbd50c04a9656aa') +else + md5sums=('f2fae794f98445bdafd2e66e9f334416') +fi +pkgdesc="Foomatic - The collected knowledge about printers, drivers, and driver options in XML files, used by foomatic-db-engine to generate PPD files." + +build() { + cd ${srcdir}/ + cp -Rp $(echo * | sed -e 's|.PKGINFO||' -e "s/foomatic-db-${pkgver}-${_foomatic_db_pkgrel}-${CARCH}.pkg.tar.gz//") ${pkgdir}/ + # foo2zjs gives us something different + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2hiperc.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2hp.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2lava.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2oak-z1.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2oak.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2qpdl.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2slx.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2xqx.xml + rm ${pkgdir}/usr/share/foomatic/db/source/driver/foo2zjs.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/HP-LaserJet_M1005_MFP.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/HP-LaserJet_1022n.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/HP-LaserJet_1022nw.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/KONICA_MINOLTA-magicolor_2530_DL.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/Kyocera-KM-1635.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/Kyocera-KM-2035.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/Xerox-Phaser_6110.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/Xerox-Phaser_6115MFP.xml + rm ${pkgdir}/usr/share/foomatic/db/source/printer/Samsung-CLP-310.xml +} diff --git a/gimp-plugin-texturize/PKGBUILD b/gimp-plugin-texturize/PKGBUILD new file mode 100644 index 0000000..0fa82ee --- /dev/null +++ b/gimp-plugin-texturize/PKGBUILD @@ -0,0 +1,23 @@ +# Maintainer: Lukas Jirkovsky <l.jirkovsky@gmail.com> +pkgname=gimp-plugin-texturize +pkgver=2.1 +pkgrel=2 +pkgdesc="Generates large textures from a small sample" +arch=('i686' 'x86_64') +url="http://gimp-texturize.sourceforge.net/" +license=('GPL') +depends=('gimp') +makedepends=('perlxml') +source=(http://downloads.sourceforge.net/sourceforge/gimp-texturize/texturize-${pkgver}_src.tgz) +md5sums=('7f94b8cefc97eaa296b14fdbdc2c995e') + +build() { + cd "$srcdir"/gimp-texturize + ./configure --prefix=/usr + make +} + +package() { + cd "$srcdir"/gimp-texturize + make DESTDIR="$pkgdir" install +} diff --git a/gtk-engine-nodoka/PKGBUILD b/gtk-engine-nodoka/PKGBUILD new file mode 100644 index 0000000..4ad9fde --- /dev/null +++ b/gtk-engine-nodoka/PKGBUILD @@ -0,0 +1,21 @@ +# Contributor: lp76 <l.peduto@gmail.com> +pkgname=gtk-engine-nodoka +pkgver=0.7.5 +pkgrel=1 +pkgdesc="Default gtk engine provided by Fedora8" +arch=('i686' 'x86_64') +url="https://fedorahosted.org/nodoka/" +license=('GPL') +depends=('gtk2>2.18') +makedepends=('pkgconfig') +source=(https://fedorahosted.org/releases/n/o/nodoka/gtk-nodoka-engine-$pkgver.tar.gz) +md5sums=('22227adf29231ba2b87202ac3522e70f') +options=(!libtool) + +build() { + cd $srcdir/gtk-nodoka-engine-$pkgver + sed -i 's|/usr/bin/install|/bin/install|g' $srcdir/gtk-nodoka-engine-$pkgver/src/Makefile.in + ./configure --prefix=/usr --enable-animation + make || return 1 + make DESTDIR=$pkgdir install || return 1 +} diff --git a/lib32-libusb/PKGBUILD b/lib32-libusb/PKGBUILD new file mode 100644 index 0000000..76396f9 --- /dev/null +++ b/lib32-libusb/PKGBUILD @@ -0,0 +1,34 @@ +# Maintainer: PyroPeter <googlemail.com@abi1789> +# Contributor: Florian Pritz <flo@xssn.at> + +_pkgbasename=libusb +pkgname=lib32-$_pkgbasename +pkgver=1.0.8 +pkgrel=1 +pkgdesc="Library to enable user space application programs to communicate with USB devices (32-bit)" +arch=(x86_64) +depends=('gcc-libs-multilib' $_pkgbasename) +makedepends=(gcc-multilib) +replaces=('lib32-libusb1') +url="http://libusb.sourceforge.net/" +license=('LGPL') +options=('!libtool') +source=("http://downloads.sourceforge.net/$_pkgbasename/$_pkgbasename-$pkgver.tar.bz2") +md5sums=('37d34e6eaa69a4b645a19ff4ca63ceef') + +build() { + export CC="gcc -m32" + export CXX="g++ -m32" + export PKG_CONFIG_PATH="/usr/lib32/pkgconfig" + + cd "$srcdir/$_pkgbasename-$pkgver" + ./configure --prefix=/usr --libdir=/usr/lib32 + make +} + +package() { + cd "$srcdir/$_pkgbasename-$pkgver" + + make DESTDIR="$pkgdir" install + rm -rf "${pkgdir}"/usr/{include,share,bin} +} diff --git a/libpng12/PKGBUILD b/libpng12/PKGBUILD index a3a1e85..17ff1d0 100644 --- a/libpng12/PKGBUILD +++ b/libpng12/PKGBUILD @@ -5,7 +5,7 @@ pkgname=libpng12 _realname=libpng -pkgver=1.2.43 +pkgver=1.2.44 pkgrel=1 pkgdesc="A collection of routines used to create PNG format graphics files" arch=('i686' 'x86_64') @@ -14,17 +14,17 @@ license=('custom') depends=('zlib') options=('!libtool') source=("http://downloads.sourceforge.net/sourceforge/${_realname}/${_realname}-${pkgver}.tar.bz2" - "http://littlesvr.ca/apng/diff/libpng-1.2.43-apng.patch") -md5sums=('976909556e6613804d810405c1f72ce6' - '0152337e035e9c767ca92521e3127502') + "http://littlesvr.ca/apng/diff/libpng-1.2.44-apng.patch") +md5sums=('e3ac7879d62ad166a6f0c7441390d12b' + '8cb91087fd91000d2e35823587a2e7ef') build() { cd "${srcdir}/${_realname}-${pkgver}" # Add animated PNG (apng) support # see http://hp.vector.co.jp/authors/VA013651/freeSoftware/apng.html - patch -Np0 -i "${srcdir}/libpng-1.2.43-apng.patch" || return 1 + patch -Np0 -i "${srcdir}/libpng-1.2.44-apng.patch" || return 1 libtoolize --force --copy || return 1 aclocal || return 1 diff --git a/libpng12/libpng-1.2.44-apng.patch b/libpng12/libpng-1.2.44-apng.patch new file mode 100644 index 0000000..c283439 --- /dev/null +++ b/libpng12/libpng-1.2.44-apng.patch @@ -0,0 +1,1653 @@ +Index: pngread.c
+===================================================================
+--- pngread.c
++++ pngread.c
+@@ -437,6 +437,11 @@
+ #ifdef PNG_READ_zTXt_SUPPORTED
+ PNG_CONST PNG_zTXt;
+ #endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ PNG_CONST PNG_acTL;
++ PNG_CONST PNG_fcTL;
++ PNG_CONST PNG_fdAT;
++#endif
+ #endif /* PNG_USE_LOCAL_ARRAYS */
+ png_uint_32 length = png_read_chunk_header(png_ptr);
+ PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
+@@ -481,6 +486,9 @@
+ !(png_ptr->mode & PNG_HAVE_PLTE))
+ png_error(png_ptr, "Missing PLTE before IDAT");
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_have_info(png_ptr, info_ptr);
++#endif
+ png_ptr->idat_size = length;
+ png_ptr->mode |= PNG_HAVE_IDAT;
+ break;
+@@ -553,12 +561,97 @@
+ else if (!png_memcmp(chunk_name, png_iTXt, 4))
+ png_handle_iTXt(png_ptr, info_ptr, length);
+ #endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ else if (!png_memcmp(chunk_name, png_acTL, 4))
++ png_handle_acTL(png_ptr, info_ptr, length);
++ else if (!png_memcmp(chunk_name, png_fcTL, 4))
++ png_handle_fcTL(png_ptr, info_ptr, length);
++ else if (!png_memcmp(chunk_name, png_fdAT, 4))
++ png_handle_fdAT(png_ptr, info_ptr, length);
++#endif
+ else
+ png_handle_unknown(png_ptr, info_ptr, length);
+ }
+ }
+ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
+
++#ifdef PNG_READ_APNG_SUPPORTED
++void PNGAPI
++png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
++{
++ png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */
++
++ png_debug(0, "Reading frame head");
++
++ if (!(png_ptr->mode & PNG_HAVE_acTL))
++ png_error(png_ptr, "attempt to png_read_frame_head() but "
++ "no acTL present");
++
++ /* do nothing for the main IDAT */
++ if (png_ptr->num_frames_read == 0)
++ return;
++
++ png_crc_finish(png_ptr, 0); /* CRC from last IDAT or fdAT chunk */
++
++ png_read_reset(png_ptr);
++ png_ptr->mode &= ~PNG_HAVE_fcTL;
++
++ have_chunk_after_DAT = 0;
++ for (;;)
++ {
++#ifdef PNG_USE_LOCAL_ARRAYS
++ PNG_IDAT;
++ PNG_fdAT;
++ PNG_fcTL;
++#endif
++ png_byte chunk_length[4];
++ png_uint_32 length;
++
++ png_read_data(png_ptr, chunk_length, 4);
++ length = png_get_uint_31(png_ptr, chunk_length);
++
++ png_reset_crc(png_ptr);
++ png_crc_read(png_ptr, png_ptr->chunk_name, 4);
++
++ if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
++ {
++ /* discard trailing IDATs for the first frame */
++ if (have_chunk_after_DAT || png_ptr->num_frames_read > 1)
++ png_error(png_ptr, "png_read_frame_head(): out of place IDAT");
++ png_crc_finish(png_ptr, length);
++ }
++ else if (!png_memcmp(png_ptr->chunk_name, png_fcTL, 4))
++ {
++ png_handle_fcTL(png_ptr, info_ptr, length);
++ have_chunk_after_DAT = 1;
++ }
++ else if (!png_memcmp(png_ptr->chunk_name, png_fdAT, 4))
++ {
++ png_ensure_sequence_number(png_ptr, length);
++
++ /* discard trailing fdATs for frames other than the first */
++ if (!have_chunk_after_DAT && png_ptr->num_frames_read > 1)
++ png_crc_finish(png_ptr, length - 4);
++ else if(png_ptr->mode & PNG_HAVE_fcTL)
++ {
++ png_ptr->idat_size = length - 4;
++ png_ptr->mode |= PNG_HAVE_IDAT;
++
++ break;
++ }
++ else
++ png_error(png_ptr, "png_read_frame_head(): out of place fdAT");
++ }
++ else
++ {
++ png_warning(png_ptr, "Skipped (ignored) a chunk "
++ "between APNG chunks");
++ png_crc_finish(png_ptr, length);
++ }
++ }
++}
++#endif /* PNG_READ_APNG_SUPPORTED */
++
+ /* Optional call to update the users info_ptr structure */
+ void PNGAPI
+ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
+@@ -599,6 +692,10 @@
+ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
+ {
+ PNG_CONST PNG_IDAT;
++#ifdef PNG_READ_APNG_SUPPORTED
++ PNG_CONST PNG_fdAT;
++ PNG_CONST PNG_IEND;
++#endif
+ PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
+ 0xff};
+ PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
+@@ -734,13 +831,39 @@
+ {
+ if (!(png_ptr->zstream.avail_in))
+ {
+- while (!png_ptr->idat_size)
++ png_uint_32 bytes_to_skip = 0;
++
++ while (!png_ptr->idat_size || bytes_to_skip != 0)
+ {
+- png_crc_finish(png_ptr, 0);
++ png_crc_finish(png_ptr, bytes_to_skip);
++ bytes_to_skip = 0;
+
+ png_ptr->idat_size = png_read_chunk_header(png_ptr);
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->num_frames_read == 0)
++ {
++#endif
+ if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+ png_error(png_ptr, "Not enough image data");
++#ifdef PNG_READ_APNG_SUPPORTED
++ }
++ else
++ {
++ if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
++ png_error(png_ptr, "Not enough image data");
++ if (png_memcmp(png_ptr->chunk_name, png_fdAT, 4))
++ {
++ png_warning(png_ptr, "Skipped (ignored) a chunk "
++ "between APNG chunks");
++ bytes_to_skip = png_ptr->idat_size;
++ continue;
++ }
++
++ png_ensure_sequence_number(png_ptr, png_ptr->idat_size);
++
++ png_ptr->idat_size -= 4;
++ }
++#endif
+ }
+ png_ptr->zstream.avail_in = (uInt)png_ptr->zbuf_size;
+ png_ptr->zstream.next_in = png_ptr->zbuf;
+@@ -758,6 +881,9 @@
+ png_error(png_ptr, "Extra compressed data");
+ png_ptr->mode |= PNG_AFTER_IDAT;
+ png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_ptr->num_frames_read++;
++#endif
+ break;
+ }
+ if (ret != Z_OK)
+@@ -1015,6 +1141,11 @@
+ #ifdef PNG_READ_zTXt_SUPPORTED
+ PNG_CONST PNG_zTXt;
+ #endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ PNG_CONST PNG_acTL;
++ PNG_CONST PNG_fcTL;
++ PNG_CONST PNG_fdAT;
++#endif
+ #endif /* PNG_USE_LOCAL_ARRAYS */
+ png_uint_32 length = png_read_chunk_header(png_ptr);
+ PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
+@@ -1115,6 +1246,14 @@
+ else if (!png_memcmp(chunk_name, png_iTXt, 4))
+ png_handle_iTXt(png_ptr, info_ptr, length);
+ #endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ else if (!png_memcmp(chunk_name, png_acTL, 4))
++ png_handle_acTL(png_ptr, info_ptr, length);
++ else if (!png_memcmp(chunk_name, png_fcTL, 4))
++ png_handle_fcTL(png_ptr, info_ptr, length);
++ else if (!png_memcmp(chunk_name, png_fdAT, 4))
++ png_handle_fdAT(png_ptr, info_ptr, length);
++#endif
+ else
+ png_handle_unknown(png_ptr, info_ptr, length);
+ } while (!(png_ptr->mode & PNG_HAVE_IEND));
+Index: pngget.c
+===================================================================
+--- pngget.c
++++ pngget.c
+@@ -842,6 +842,167 @@
+ }
+ #endif
+
++#ifdef PNG_APNG_SUPPORTED
++png_uint_32 PNGAPI
++png_get_acTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 *num_frames, png_uint_32 *num_plays)
++{
++ png_debug1(1, "in %s retrieval function", "acTL");
++
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_acTL) &&
++ num_frames != NULL && num_plays != NULL)
++ {
++ *num_frames = info_ptr->num_frames;
++ *num_plays = info_ptr->num_plays;
++ return (1);
++ }
++
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_num_frames()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->num_frames);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_num_plays(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_num_plays()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->num_plays);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 *width, png_uint_32 *height,
++ png_uint_32 *x_offset, png_uint_32 *y_offset,
++ png_uint_16 *delay_num, png_uint_16 *delay_den,
++ png_byte *dispose_op, png_byte *blend_op)
++{
++ png_debug1(1, "in %s retrieval function", "fcTL");
++
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_fcTL) &&
++ width != NULL && height != NULL &&
++ x_offset != NULL && x_offset != NULL &&
++ delay_num != NULL && delay_den != NULL &&
++ dispose_op != NULL && blend_op != NULL)
++ {
++ *width = info_ptr->next_frame_width;
++ *height = info_ptr->next_frame_height;
++ *x_offset = info_ptr->next_frame_x_offset;
++ *y_offset = info_ptr->next_frame_y_offset;
++ *delay_num = info_ptr->next_frame_delay_num;
++ *delay_den = info_ptr->next_frame_delay_den;
++ *dispose_op = info_ptr->next_frame_dispose_op;
++ *blend_op = info_ptr->next_frame_blend_op;
++ return (1);
++ }
++
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_width()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_width);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_height()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_height);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_x_offset()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_x_offset);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_y_offset()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_y_offset);
++ return (0);
++}
++
++png_uint_16 PNGAPI
++png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_delay_num()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_delay_num);
++ return (0);
++}
++
++png_uint_16 PNGAPI
++png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_delay_den()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_delay_den);
++ return (0);
++}
++
++png_byte PNGAPI
++png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_dispose_op()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_dispose_op);
++ return (0);
++}
++
++png_byte PNGAPI
++png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_blend_op()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_blend_op);
++ return (0);
++}
++
++png_byte PNGAPI
++png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_first_frame_is_hidden()");
++
++ if (png_ptr != NULL)
++ return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
++
++ return 0;
++}
++#endif /* PNG_APNG_SUPPORTED */
++
+ #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+ png_uint_32 PNGAPI
+ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
+Index: png.c
+===================================================================
+--- png.c
++++ png.c
+@@ -56,6 +56,11 @@
+ PNG_tIME;
+ PNG_tRNS;
+ PNG_zTXt;
++#ifdef PNG_APNG_SUPPORTED
++PNG_acTL;
++PNG_fcTL;
++PNG_fdAT;
++#endif
+
+ #ifdef PNG_READ_SUPPORTED
+ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
+Index: png.h
+===================================================================
+--- png.h
++++ png.h
+@@ -1041,6 +1041,19 @@
+ png_fixed_point int_y_blue PNG_DEPSTRUCT;
+ #endif
+
++#ifdef PNG_APNG_SUPPORTED
++ png_uint_32 num_frames; /* including default image */
++ png_uint_32 num_plays;
++ png_uint_32 next_frame_width;
++ png_uint_32 next_frame_height;
++ png_uint_32 next_frame_x_offset;
++ png_uint_32 next_frame_y_offset;
++ png_uint_16 next_frame_delay_num;
++ png_uint_16 next_frame_delay_den;
++ png_byte next_frame_dispose_op;
++ png_byte next_frame_blend_op;
++#endif
++
+ } png_info;
+
+ typedef png_info FAR * png_infop;
+@@ -1142,6 +1155,10 @@
+ #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
+ #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
+ #define PNG_INFO_IDAT 0x8000L /* ESR, 1.0.6 */
++#ifdef PNG_APNG_SUPPORTED
++#define PNG_INFO_acTL 0x10000L
++#define PNG_INFO_fcTL 0x20000L
++#endif
+
+ /* This is used for the transformation routines, as some of them
+ * change these values for the row. It also should enable using
+@@ -1182,6 +1199,10 @@
+ typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
+ typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
+ png_uint_32, int));
++#ifdef PNG_APNG_SUPPORTED
++typedef void (PNGAPI *png_progressive_frame_ptr) PNGARG((png_structp,
++ png_uint_32));
++#endif
+ #endif
+
+ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+@@ -1527,6 +1548,39 @@
+ png_uint_32 user_height_max PNG_DEPSTRUCT;
+ #endif
+
++#ifdef PNG_APNG_SUPPORTED
++ png_uint_32 apng_flags;
++ png_uint_32 next_seq_num; /* next fcTL/fdAT chunk sequence number */
++ png_uint_32 first_frame_width;
++ png_uint_32 first_frame_height;
++
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_uint_32 num_frames_read; /* incremented after all image data of */
++ /* a frame is read */
++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
++ png_progressive_frame_ptr frame_info_fn; /* frame info read callback */
++ png_progressive_frame_ptr frame_end_fn; /* frame data read callback */
++#endif
++#endif
++
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ png_uint_32 num_frames_to_write;
++ png_uint_32 num_frames_written;
++#endif
++
++/* For png_struct.apng_flags: */
++#define PNG_FIRST_FRAME_HIDDEN 0x0001
++
++/* dispose_op flags from inside fcTL */
++#define PNG_DISPOSE_OP_NONE 0x00
++#define PNG_DISPOSE_OP_BACKGROUND 0x01
++#define PNG_DISPOSE_OP_PREVIOUS 0x02
++
++/* blend_op flags from inside fcTL */
++#define PNG_BLEND_OP_SOURCE 0x00
++#define PNG_BLEND_OP_OVER 0x01
++#endif /* PNG_APNG_SUPPORTED */
++
+ /* New member added in libpng-1.0.25 and 1.2.17 */
+ #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+ /* Storage for unknown chunk that the library doesn't recognize. */
+@@ -1861,6 +1915,18 @@
+ extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
+ png_bytepp image));
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++extern PNG_EXPORT (void,png_write_frame_head) PNGARG((png_structp png_ptr,
++ png_infop png_info, png_bytepp row_pointers,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op));
++
++extern PNG_EXPORT (void,png_write_frame_tail) PNGARG((png_structp png_ptr,
++ png_infop png_info));
++#endif
++
+ /* Writes the end of the PNG file. */
+ extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
+ png_infop info_ptr));
+@@ -2114,6 +2180,11 @@
+ png_voidp progressive_ptr,
+ png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
+ png_progressive_end_ptr end_fn));
++#ifdef PNG_READ_APNG_SUPPORTED
++extern PNG_EXPORT(void,png_set_progressive_frame_fn) PNGARG((png_structp png_ptr,
++ png_progressive_frame_ptr frame_info_fn,
++ png_progressive_frame_ptr frame_end_fn));
++#endif
+
+ /* Returns the user pointer associated with the push read functions */
+ extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
+@@ -2554,6 +2625,59 @@
+ #endif
+ #endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
+
++#ifdef PNG_APNG_SUPPORTED
++extern PNG_EXPORT(png_uint_32,png_get_acTL) PNGARG((png_structp png_ptr,
++ png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
++extern PNG_EXPORT(png_uint_32,png_set_acTL) PNGARG((png_structp png_ptr,
++ png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
++extern PNG_EXPORT(png_uint_32,png_get_num_frames) PNGARG((png_structp png_ptr,
++ png_infop info_ptr));
++extern PNG_EXPORT(png_uint_32,png_get_num_plays)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++
++extern PNG_EXPORT(png_uint_32,png_get_next_frame_fcTL)
++ PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
++ png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
++ png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
++ png_byte *blend_op));
++extern PNG_EXPORT(png_uint_32,png_set_next_frame_fcTL)
++ PNGARG((png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
++ png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op));
++extern PNG_EXPORT(void,png_ensure_fcTL_is_valid)
++ PNGARG((png_structp png_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op));
++extern PNG_EXPORT(png_uint_32,png_get_next_frame_width)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_uint_32,png_get_next_frame_height)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_uint_32,png_get_next_frame_x_offset)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_uint_32,png_get_next_frame_y_offset)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_uint_16,png_get_next_frame_delay_num)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_uint_16,png_get_next_frame_delay_den)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_byte,png_get_next_frame_dispose_op)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_byte,png_get_next_frame_blend_op)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_byte,png_get_first_frame_is_hidden)
++ PNGARG((png_structp png_ptr, png_infop info_ptr));
++extern PNG_EXPORT(png_uint_32,png_set_first_frame_is_hidden)
++ PNGARG((png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
++#endif /* PNG_APNG_SUPPORTED */
++
++#ifdef PNG_READ_APNG_SUPPORTED
++extern PNG_EXPORT(void,png_read_frame_head) PNGARG((png_structp png_ptr,
++ png_infop info_ptr));
++#endif
++
+ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+ /* Provide a list of chunks and how they are to be handled, if the built-in
+ handling or default unknown chunk handling is not desired. Any chunks not
+@@ -2918,6 +3042,10 @@
+ #define PNG_BACKGROUND_IS_GRAY 0x800
+ #define PNG_HAVE_PNG_SIGNATURE 0x1000
+ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
++#ifdef PNG_APNG_SUPPORTED
++#define PNG_HAVE_acTL 0x4000
++#define PNG_HAVE_fcTL 0x8000L
++#endif
+
+ /* Flags for the transformations the PNG library does on the image data */
+ #define PNG_BGR 0x0001
+@@ -3060,6 +3188,11 @@
+ #define PNG_tIME png_byte png_tIME[5] = {116, 73, 77, 69, '\0'}
+ #define PNG_tRNS png_byte png_tRNS[5] = {116, 82, 78, 83, '\0'}
+ #define PNG_zTXt png_byte png_zTXt[5] = {122, 84, 88, 116, '\0'}
++#ifdef PNG_APNG_SUPPORTED
++#define PNG_acTL png_byte png_acTL[5] = { 97, 99, 84, 76, '\0'}
++#define PNG_fcTL png_byte png_fcTL[5] = {102, 99, 84, 76, '\0'}
++#define PNG_fdAT png_byte png_fdAT[5] = {102, 100, 65, 84, '\0'}
++#endif
+
+ #ifdef PNG_USE_GLOBAL_ARRAYS
+ PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5];
+@@ -3083,6 +3216,11 @@
+ PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5];
+ PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5];
+ PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
++#ifdef PNG_APNG_SUPPORTED
++PNG_EXPORT_VAR (png_byte FARDATA) png_acTL[5];
++PNG_EXPORT_VAR (png_byte FARDATA) png_fcTL[5];
++PNG_EXPORT_VAR (png_byte FARDATA) png_fdAT[5];
++#endif
+ #endif /* PNG_USE_GLOBAL_ARRAYS */
+
+ #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+@@ -3365,6 +3503,17 @@
+ #endif
+ #endif
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++PNG_EXTERN void png_write_acTL PNGARG((png_structp png_ptr,
++ png_uint_32 num_frames, png_uint_32 num_plays));
++
++PNG_EXTERN void png_write_fcTL PNGARG((png_structp png_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op));
++#endif
++
+ /* Called when finished processing a row of data */
+ PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+@@ -3417,6 +3566,20 @@
+ PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
+ png_infop info_ptr)) PNG_PRIVATE;
+
++#ifdef PNG_READ_APNG_SUPPORTED
++/* Private, reset some things to become ready for reading next frame */
++PNG_EXTERN void png_read_reset PNGARG((png_structp png_ptr));
++PNG_EXTERN void png_read_reinit PNGARG((png_structp png_ptr,
++ png_infop info_ptr));
++PNG_EXTERN void png_progressive_read_reset PNGARG((png_structp png_ptr));
++#endif
++#ifdef PNG_WRITE_APNG_SUPPORTED
++/* Private, reset some things to become ready for writing next frame */
++PNG_EXTERN void png_write_reset PNGARG((png_structp png_ptr));
++PNG_EXTERN void png_write_reinit PNGARG((png_structp png_ptr,
++ png_infop info_ptr, png_uint_32 width, png_uint_32 height));
++#endif
++
+ /* These are the functions that do the transformations */
+ #ifdef PNG_READ_FILLER_SUPPORTED
+ PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
+@@ -3640,6 +3803,18 @@
+ png_uint_32 length)) PNG_PRIVATE;
+ #endif
+
++#ifdef PNG_READ_APNG_SUPPORTED
++PNG_EXTERN void png_handle_acTL PNGARG((png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length));
++PNG_EXTERN void png_handle_fcTL PNGARG((png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length));
++PNG_EXTERN void png_have_info PNGARG((png_structp png_ptr, png_infop info_ptr));
++PNG_EXTERN void png_handle_fdAT PNGARG((png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length));
++PNG_EXTERN void png_ensure_sequence_number PNGARG((png_structp png_ptr,
++ png_uint_32 length));
++#endif
++
+ PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
+
+Index: pngwrite.c
+===================================================================
+--- pngwrite.c
++++ pngwrite.c
+@@ -57,6 +57,10 @@
+ /* The rest of these check to see if the valid field has the appropriate
+ * flag set, and if it does, writes the chunk.
+ */
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ if (info_ptr->valid & PNG_INFO_acTL)
++ png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
++#endif
+ #ifdef PNG_WRITE_gAMA_SUPPORTED
+ if (info_ptr->valid & PNG_INFO_gAMA)
+ {
+@@ -319,6 +323,10 @@
+ return;
+ if (!(png_ptr->mode & PNG_HAVE_IDAT))
+ png_error(png_ptr, "No IDATs written into file");
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
++ png_error(png_ptr, "Not enough frames written");
++#endif
+
+ /* See if user wants us to write information chunks */
+ if (info_ptr != NULL)
+@@ -1589,4 +1597,39 @@
+ params = params;
+ }
+ #endif
++
++#ifdef PNG_WRITE_APNG_SUPPORTED
++void PNGAPI
++png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
++ png_bytepp row_pointers, png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op)
++{
++ png_debug(1, "in png_write_frame_head");
++
++ /* there is a chance this has been set after png_write_info was called,
++ * so it would be set but not written. is there a way to be sure? */
++ if (!(info_ptr->valid & PNG_INFO_acTL))
++ png_error(png_ptr, "png_write_frame_head(): acTL not set");
++
++ png_write_reset(png_ptr);
++
++ png_write_reinit(png_ptr, info_ptr, width, height);
++
++ if ( !(png_ptr->num_frames_written == 0 &&
++ (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) ) )
++ png_write_fcTL(png_ptr, width, height, x_offset, y_offset,
++ delay_num, delay_den, dispose_op, blend_op);
++}
++
++void PNGAPI
++png_write_frame_tail(png_structp png_ptr, png_infop png_info)
++{
++ png_debug(1, "in png_write_frame_tail");
++
++ png_ptr->num_frames_written++;
++}
++#endif /* PNG_WRITE_APNG_SUPPORTED */
++
+ #endif /* PNG_WRITE_SUPPORTED */
+Index: pngconf.h
+===================================================================
+--- pngconf.h
++++ pngconf.h
+@@ -951,6 +951,10 @@
+ # define PNG_NO_READ_tEXt
+ # define PNG_NO_READ_zTXt
+ #endif
++#ifndef PNG_NO_READ_APNG
++# define PNG_READ_APNG_SUPPORTED
++# define PNG_APNG_SUPPORTED
++#endif
+ #ifndef PNG_NO_READ_bKGD
+ # define PNG_READ_bKGD_SUPPORTED
+ # define PNG_bKGD_SUPPORTED
+@@ -1177,6 +1181,14 @@
+ # define PNG_TEXT_SUPPORTED
+ # endif
+ #endif
++#ifndef PNG_NO_WRITE_APNG
++# ifndef PNG_WRITE_APNG_SUPPORTED
++# define PNG_WRITE_APNG_SUPPORTED
++# endif
++# ifndef PNG_APNG_SUPPORTED
++# define PNG_APNG_SUPPORTED
++# endif
++#endif
+
+ #ifdef PNG_WRITE_tIME_SUPPORTED
+ # ifndef PNG_NO_CONVERT_tIME
+Index: pngpread.c
+===================================================================
+--- pngpread.c
++++ pngpread.c
+@@ -206,6 +206,11 @@
+ #ifdef PNG_READ_zTXt_SUPPORTED
+ PNG_CONST PNG_zTXt;
+ #endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ PNG_CONST PNG_acTL;
++ PNG_CONST PNG_fcTL;
++ PNG_CONST PNG_fdAT;
++#endif
+ #endif /* PNG_USE_LOCAL_ARRAYS */
+
+ /* First we make sure we have enough data for the 4 byte chunk name
+@@ -232,6 +237,103 @@
+ png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
+ }
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->num_frames_read > 0 &&
++ png_ptr->num_frames_read < info_ptr->num_frames)
++ {
++ if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
++ {
++ /* Discard trailing IDATs for the first frame */
++ if (png_ptr->mode & PNG_HAVE_fcTL || png_ptr->num_frames_read > 1)
++ png_error(png_ptr, "out of place IDAT");
++
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++ png_push_crc_skip(png_ptr, png_ptr->push_length);
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++ else if (!png_memcmp(png_ptr->chunk_name, png_fdAT, 4))
++ {
++ if (png_ptr->buffer_size < 4)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++ png_ensure_sequence_number(png_ptr, 4);
++
++ if (!(png_ptr->mode & PNG_HAVE_fcTL))
++ {
++ /* Discard trailing fdATs for frames other than the first */
++ if (png_ptr->num_frames_read < 2)
++ png_error(png_ptr, "out of place fdAT");
++
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++ png_push_crc_skip(png_ptr, png_ptr->push_length);
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++ else
++ {
++ /* frame data follows */
++ png_ptr->idat_size = png_ptr->push_length - 4;
++ png_ptr->mode |= PNG_HAVE_IDAT;
++ png_ptr->process_mode = PNG_READ_IDAT_MODE;
++
++ return;
++ }
++ }
++ else if(!png_memcmp(png_ptr->chunk_name, png_fcTL, 4))
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_read_reset(png_ptr);
++ png_ptr->mode &= ~PNG_HAVE_fcTL;
++
++ png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
++
++ if (!(png_ptr->mode & PNG_HAVE_fcTL))
++ png_error(png_ptr, "missing required fcTL chunk");
++
++ png_read_reinit(png_ptr, info_ptr);
++ png_progressive_read_reset(png_ptr);
++
++ if (png_ptr->frame_info_fn != NULL)
++ (*(png_ptr->frame_info_fn))(png_ptr, png_ptr->num_frames_read);
++
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++
++ return;
++ }
++ else
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++ png_warning(png_ptr, "Skipped (ignored) a chunk "
++ "between APNG chunks");
++ png_push_crc_skip(png_ptr, png_ptr->push_length);
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++
++ return;
++ }
++#endif /* PNG_READ_APNG_SUPPORTED */
++
+ if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
+ if (png_ptr->mode & PNG_AFTER_IDAT)
+ png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
+@@ -327,6 +429,9 @@
+ png_error(png_ptr, "Too many IDAT's found");
+ }
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_have_info(png_ptr, info_ptr);
++#endif
+ png_ptr->idat_size = png_ptr->push_length;
+ png_ptr->mode |= PNG_HAVE_IDAT;
+ png_ptr->process_mode = PNG_READ_IDAT_MODE;
+@@ -559,6 +664,38 @@
+ }
+
+ #endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ else if (!png_memcmp(png_ptr->chunk_name, png_acTL, 4))
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_handle_acTL(png_ptr, info_ptr, png_ptr->push_length);
++ }
++ else if (!png_memcmp(png_ptr->chunk_name, png_fcTL, 4))
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
++ }
++ else if (!png_memcmp(png_ptr->chunk_name, png_fdAT, 4))
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_handle_fdAT(png_ptr, info_ptr, png_ptr->push_length);
++ }
++#endif /* PNG_READ_APNG_SUPPORTED */
+ else
+ {
+ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+@@ -738,13 +875,17 @@
+ png_push_read_IDAT(png_structp png_ptr)
+ {
+ #ifdef PNG_USE_LOCAL_ARRAYS
+- PNG_CONST PNG_IDAT;
++ PNG_IDAT;
++#ifdef PNG_READ_APNG_SUPPORTED
++ PNG_fdAT;
++ PNG_IEND;
++#endif
+ #endif
+ if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
+ {
+ png_byte chunk_length[4];
+
+- if (png_ptr->buffer_size < 8)
++ if (png_ptr->buffer_size < 12)
+ {
+ png_push_save_buffer(png_ptr);
+ return;
+@@ -756,15 +897,62 @@
+ png_crc_read(png_ptr, png_ptr->chunk_name, 4);
+ png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
+
+- if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_fdAT, 4)
++ && png_ptr->num_frames_read > 0)
++ {
++ if (png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)
++ {
++ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
++ if (png_ptr->frame_end_fn != NULL)
++ (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
++ png_ptr->num_frames_read++;
++ return;
++ }
++ else
++ {
++ if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4))
++ png_error(png_ptr, "Not enough image data");
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++ png_warning(png_ptr, "Skipping (ignoring) a chunk between "
++ "APNG chunks");
++ png_crc_finish(png_ptr, png_ptr->push_length);
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++ }
++ else
++#endif
++ if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)
++#ifdef PNG_READ_APNG_SUPPORTED
++ && (png_ptr->num_frames_read == 0)
++#endif
++ )
+ {
+ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+ if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
+ png_error(png_ptr, "Not enough compressed data");
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->frame_end_fn != NULL)
++ (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
++ png_ptr->num_frames_read++;
++#endif
+ return;
+ }
+
+ png_ptr->idat_size = png_ptr->push_length;
++
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->num_frames_read > 0)
++ {
++ png_ensure_sequence_number(png_ptr, 4);
++ png_ptr->idat_size -= 4;
++ }
++#endif
+ }
+ if (png_ptr->idat_size && png_ptr->save_buffer_size)
+ {
+@@ -1763,6 +1951,17 @@
+ png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
+ }
+
++#ifdef PNG_READ_APNG_SUPPORTED
++void PNGAPI
++png_set_progressive_frame_fn(png_structp png_ptr,
++ png_progressive_frame_ptr frame_info_fn,
++ png_progressive_frame_ptr frame_end_fn)
++{
++ png_ptr->frame_info_fn = frame_info_fn;
++ png_ptr->frame_end_fn = frame_end_fn;
++}
++#endif
++
+ png_voidp PNGAPI
+ png_get_progressive_ptr(png_structp png_ptr)
+ {
+Index: pngset.c
+===================================================================
+--- pngset.c
++++ pngset.c
+@@ -266,6 +266,11 @@
+ info_ptr->rowbytes = (png_size_t)0;
+ else
+ info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
++
++#ifdef PNG_APNG_SUPPORTED
++ /* for non-animated png. this may be overritten from an acTL chunk later */
++ info_ptr->num_frames = 1;
++#endif
+ }
+
+ #ifdef PNG_oFFs_SUPPORTED
+@@ -960,6 +965,142 @@
+ }
+ #endif /* PNG_sPLT_SUPPORTED */
+
++#ifdef PNG_APNG_SUPPORTED
++png_uint_32 PNGAPI
++png_set_acTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 num_frames, png_uint_32 num_plays)
++{
++ png_debug1(1, "in %s storage function", "acTL");
++
++ if (png_ptr == NULL || info_ptr == NULL)
++ {
++ png_warning(png_ptr,
++ "Call to png_set_acTL() with NULL png_ptr "
++ "or info_ptr ignored");
++ return (0);
++ }
++ if (num_frames == 0)
++ {
++ png_warning(png_ptr,
++ "Ignoring attempt to set acTL with num_frames zero");
++ return (0);
++ }
++ if (num_frames > PNG_UINT_31_MAX)
++ {
++ png_warning(png_ptr,
++ "Ignoring attempt to set acTL with num_frames > 2^31-1");
++ return (0);
++ }
++ if (num_plays > PNG_UINT_31_MAX)
++ {
++ png_warning(png_ptr,
++ "Ignoring attempt to set acTL with num_plays "
++ "> 2^31-1");
++ return (0);
++ }
++
++ info_ptr->num_frames = num_frames;
++ info_ptr->num_plays = num_plays;
++
++ info_ptr->valid |= PNG_INFO_acTL;
++
++ return (1);
++}
++
++/* delay_num and delay_den can hold any 16-bit values including zero */
++png_uint_32 PNGAPI
++png_set_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op)
++{
++ png_debug1(1, "in %s storage function", "fcTL");
++
++ if (png_ptr == NULL || info_ptr == NULL)
++ {
++ png_warning(png_ptr,
++ "Call to png_set_fcTL() with NULL png_ptr or info_ptr "
++ "ignored");
++ return (0);
++ }
++
++ png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
++ delay_num, delay_den, dispose_op, blend_op);
++
++ if (blend_op == PNG_BLEND_OP_OVER)
++ {
++ if (!(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) &&
++ !(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
++ {
++ png_warning(png_ptr, "PNG_BLEND_OP_OVER is meaningless "
++ "and wasteful for opaque images, ignored");
++ blend_op = PNG_BLEND_OP_SOURCE;
++ }
++ }
++
++ info_ptr->next_frame_width = width;
++ info_ptr->next_frame_height = height;
++ info_ptr->next_frame_x_offset = x_offset;
++ info_ptr->next_frame_y_offset = y_offset;
++ info_ptr->next_frame_delay_num = delay_num;
++ info_ptr->next_frame_delay_den = delay_den;
++ info_ptr->next_frame_dispose_op = dispose_op;
++ info_ptr->next_frame_blend_op = blend_op;
++
++ info_ptr->valid |= PNG_INFO_fcTL;
++
++ return (1);
++}
++
++void PNGAPI
++png_ensure_fcTL_is_valid(png_structp png_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op)
++{
++ if (width + x_offset > png_ptr->first_frame_width ||
++ height + y_offset > png_ptr->first_frame_height)
++ png_error(png_ptr, "dimensions of a frame are greater than"
++ "the ones in IHDR");
++ if (width > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid width in fcTL (> 2^31-1)");
++ if (height > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid height in fcTL (> 2^31-1)");
++ if (x_offset > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid x_offset in fcTL (> 2^31-1)");
++ if (y_offset > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid y_offset in fcTL (> 2^31-1)");
++
++ if (dispose_op != PNG_DISPOSE_OP_NONE &&
++ dispose_op != PNG_DISPOSE_OP_BACKGROUND &&
++ dispose_op != PNG_DISPOSE_OP_PREVIOUS)
++ png_error(png_ptr, "invalid dispose_op in fcTL");
++
++ if (blend_op != PNG_BLEND_OP_SOURCE &&
++ blend_op != PNG_BLEND_OP_OVER)
++ png_error(png_ptr, "invalid blend_op in fcTL");
++}
++
++png_uint_32 PNGAPI
++png_set_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr,
++ png_byte is_hidden)
++{
++ png_debug(1, "in png_first_frame_is_hidden()");
++
++ if (png_ptr == NULL)
++ return 0;
++
++ if(is_hidden)
++ png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
++ else
++ png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN;
++
++ return 1;
++}
++#endif /* PNG_APNG_SUPPORTED */
++
+ #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+ void PNGAPI
+ png_set_unknown_chunks(png_structp png_ptr,
+Index: pngrutil.c
+===================================================================
+--- pngrutil.c
++++ pngrutil.c
+@@ -460,6 +460,11 @@
+ filter_type = buf[11];
+ interlace_type = buf[12];
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_ptr->first_frame_width = width;
++ png_ptr->first_frame_height = height;
++#endif
++
+ /* Set internal variables */
+ png_ptr->width = width;
+ png_ptr->height = height;
+@@ -2348,6 +2353,172 @@
+ }
+ #endif
+
++#ifdef PNG_READ_APNG_SUPPORTED
++void /* PRIVATE */
++png_handle_acTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++{
++ png_byte data[8];
++ png_uint_32 num_frames;
++ png_uint_32 num_plays;
++ png_uint_32 didSet;
++
++ png_debug(1, "in png_handle_acTL");
++
++ if (!(png_ptr->mode & PNG_HAVE_IHDR))
++ {
++ png_error(png_ptr, "Missing IHDR before acTL");
++ }
++ else if (png_ptr->mode & PNG_HAVE_IDAT)
++ {
++ png_warning(png_ptr, "Invalid acTL after IDAT skipped");
++ png_crc_finish(png_ptr, length);
++ return;
++ }
++ else if (png_ptr->mode & PNG_HAVE_acTL)
++ {
++ png_warning(png_ptr, "Duplicate acTL skipped");
++ png_crc_finish(png_ptr, length);
++ return;
++ }
++ else if (length != 8)
++ {
++ png_warning(png_ptr, "acTL with invalid length skipped");
++ png_crc_finish(png_ptr, length);
++ return;
++ }
++
++ png_crc_read(png_ptr, data, 8);
++ png_crc_finish(png_ptr, 0);
++
++ num_frames = png_get_uint_31(png_ptr, data);
++ num_plays = png_get_uint_31(png_ptr, data + 4);
++
++ /* the set function will do error checking on num_frames */
++ didSet = png_set_acTL(png_ptr, info_ptr, num_frames, num_plays);
++ if(didSet)
++ png_ptr->mode |= PNG_HAVE_acTL;
++}
++
++void /* PRIVATE */
++png_handle_fcTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++{
++ png_byte data[22];
++ png_uint_32 width;
++ png_uint_32 height;
++ png_uint_32 x_offset;
++ png_uint_32 y_offset;
++ png_uint_16 delay_num;
++ png_uint_16 delay_den;
++ png_byte dispose_op;
++ png_byte blend_op;
++
++ png_debug(1, "in png_handle_fcTL");
++
++ png_ensure_sequence_number(png_ptr, length);
++
++ if (!(png_ptr->mode & PNG_HAVE_IHDR))
++ {
++ png_error(png_ptr, "Missing IHDR before fcTL");
++ }
++ else if (png_ptr->mode & PNG_HAVE_IDAT)
++ {
++ /* for any frames other then the first this message may be misleading,
++ * but correct. PNG_HAVE_IDAT is unset before the frame head is read
++ * i can't think of a better message */
++ png_warning(png_ptr, "Invalid fcTL after IDAT skipped");
++ png_crc_finish(png_ptr, length-4);
++ return;
++ }
++ else if (png_ptr->mode & PNG_HAVE_fcTL)
++ {
++ png_warning(png_ptr, "Duplicate fcTL within one frame skipped");
++ png_crc_finish(png_ptr, length-4);
++ return;
++ }
++ else if (length != 26)
++ {
++ png_warning(png_ptr, "fcTL with invalid length skipped");
++ png_crc_finish(png_ptr, length-4);
++ return;
++ }
++
++ png_crc_read(png_ptr, data, 22);
++ png_crc_finish(png_ptr, 0);
++
++ width = png_get_uint_31(png_ptr, data);
++ height = png_get_uint_31(png_ptr, data + 4);
++ x_offset = png_get_uint_31(png_ptr, data + 8);
++ y_offset = png_get_uint_31(png_ptr, data + 12);
++ delay_num = png_get_uint_16(data + 16);
++ delay_den = png_get_uint_16(data + 18);
++ dispose_op = data[20];
++ blend_op = data[21];
++
++ if (png_ptr->num_frames_read == 0 && (x_offset != 0 || y_offset != 0))
++ png_error(png_ptr, "fcTL for the first frame must have zero offset");
++
++ if (info_ptr != NULL)
++ {
++ if (png_ptr->num_frames_read == 0 &&
++ (width != info_ptr->width || height != info_ptr->height))
++ png_error(png_ptr, "size in first frame's fcTL must match "
++ "the size in IHDR");
++
++ /* the set function will do more error checking */
++ png_set_next_frame_fcTL(png_ptr, info_ptr, width, height,
++ x_offset, y_offset, delay_num, delay_den,
++ dispose_op, blend_op);
++
++ png_read_reinit(png_ptr, info_ptr);
++ }
++
++ png_ptr->mode |= PNG_HAVE_fcTL;
++}
++
++void /* PRIVATE */
++png_have_info(png_structp png_ptr, png_infop info_ptr)
++{
++ if((info_ptr->valid & PNG_INFO_acTL) && !(info_ptr->valid & PNG_INFO_fcTL))
++ {
++ png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
++ info_ptr->num_frames++;
++ }
++}
++
++void /* PRIVATE */
++png_handle_fdAT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++{
++ png_ensure_sequence_number(png_ptr, length);
++
++ /* This function is only called from png_read_end(), png_read_info(),
++ * and png_push_read_chunk() which means that:
++ * - the user doesn't want to read this frame
++ * - or this is an out-of-place fdAT
++ * in either case it is safe to ignore the chunk with a warning */
++ png_warning(png_ptr, "ignoring fdAT chunk");
++ png_crc_finish(png_ptr, length - 4);
++}
++
++void /* PRIVATE */
++png_ensure_sequence_number(png_structp png_ptr, png_uint_32 length)
++{
++ png_byte data[4];
++ png_uint_32 sequence_number;
++
++ if (length < 4)
++ png_error(png_ptr, "invalid fcTL or fdAT chunk found");
++
++ png_crc_read(png_ptr, data, 4);
++ sequence_number = png_get_uint_31(png_ptr, data);
++
++ if (sequence_number != png_ptr->next_seq_num)
++ png_error(png_ptr, "fcTL or fdAT chunk with out-of-order sequence "
++ "number found");
++
++ png_ptr->next_seq_num++;
++}
++#endif /* PNG_READ_APNG_SUPPORTED */
++
+ /* This function is called when we haven't found a handler for a
+ chunk. If there isn't a problem with the chunk itself (ie bad
+ chunk name, CRC, or a critical chunk), the chunk is silently ignored
+@@ -3379,4 +3550,75 @@
+
+ png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
++
++#ifdef PNG_READ_APNG_SUPPORTED
++/* This function is to be called after the main IDAT set has been read and
++ * before a new IDAT is read. It resets some parts of png_ptr
++ * to make them usable by the read functions again */
++void /* PRIVATE */
++png_read_reset(png_structp png_ptr)
++{
++ png_ptr->mode &= ~PNG_HAVE_IDAT;
++ png_ptr->mode &= ~PNG_AFTER_IDAT;
++ png_ptr->row_number = 0;
++ png_ptr->pass = 0;
++ png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
++}
++
++void /* PRIVATE */
++png_read_reinit(png_structp png_ptr, png_infop info_ptr)
++{
++ png_ptr->width = info_ptr->next_frame_width;
++ png_ptr->height = info_ptr->next_frame_height;
++ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width);
++ if (png_ptr->prev_row)
++ png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
++}
++
++/* same as png_read_reset() but for the progressive reader */
++void /* PRIVATE */
++png_progressive_read_reset(png_structp png_ptr)
++{
++#ifdef PNG_USE_LOCAL_ARRAYS
++ /* start of interlace block */
++ const int FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
++
++ /* offset to next interlace block */
++ const int FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
++
++ /* start of interlace block in the y direction */
++ const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
++
++ /* offset to next interlace block in the y direction */
++ const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
++#endif
++
++ if (png_ptr->interlaced)
++ {
++ if (!(png_ptr->transformations & PNG_INTERLACE))
++ png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
++ png_pass_ystart[0]) / png_pass_yinc[0];
++ else
++ png_ptr->num_rows = png_ptr->height;
++
++ png_ptr->iwidth = (png_ptr->width +
++ png_pass_inc[png_ptr->pass] - 1 -
++ png_pass_start[png_ptr->pass]) /
++ png_pass_inc[png_ptr->pass];
++ }
++ else
++ {
++ png_ptr->num_rows = png_ptr->height;
++ png_ptr->iwidth = png_ptr->width;
++ }
++ png_ptr->flags &= ~PNG_FLAG_ZLIB_FINISHED;
++ if (inflateReset(&(png_ptr->zstream)) != Z_OK)
++ png_error(png_ptr, "inflateReset failed");
++ png_ptr->zstream.avail_in = 0;
++ png_ptr->zstream.next_in = 0;
++ png_ptr->zstream.next_out = png_ptr->row_buf;
++ png_ptr->zstream.avail_out = (uInt)PNG_ROWBYTES(png_ptr->pixel_depth,
++ png_ptr->iwidth) + 1;
++}
++#endif /* PNG_READ_APNG_SUPPORTED */
+ #endif /* PNG_READ_SUPPORTED */
+Index: pngwutil.c
+===================================================================
+--- pngwutil.c
++++ pngwutil.c
+@@ -516,6 +516,11 @@
+ /* Write the chunk */
+ png_write_chunk(png_ptr, (png_bytep)png_IHDR, buf, (png_size_t)13);
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ png_ptr->first_frame_width = width;
++ png_ptr->first_frame_height = height;
++#endif
++
+ /* Initialize zlib with PNG info */
+ png_ptr->zstream.zalloc = png_zalloc;
+ png_ptr->zstream.zfree = png_zfree;
+@@ -641,6 +646,9 @@
+ {
+ #ifdef PNG_USE_LOCAL_ARRAYS
+ PNG_IDAT;
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ PNG_fdAT;
++#endif
+ #endif
+
+ png_debug(1, "in png_write_IDAT");
+@@ -686,7 +694,28 @@
+ "Invalid zlib compression method or flags in IDAT");
+ }
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ if(png_ptr->num_frames_written == 0)
++#endif
+ png_write_chunk(png_ptr, (png_bytep)png_IDAT, data, length);
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ else
++ {
++ png_byte buf[4];
++
++ png_write_chunk_start(png_ptr, (png_bytep)png_fdAT, 4 + length);
++
++ png_save_uint_32(buf, png_ptr->next_seq_num);
++ png_write_chunk_data(png_ptr, buf, 4);
++
++ png_write_chunk_data(png_ptr, data, length);
++
++ png_write_chunk_end(png_ptr);
++
++ png_ptr->next_seq_num++;
++ }
++#endif
++
+ png_ptr->mode |= PNG_HAVE_IDAT;
+ }
+
+@@ -1754,6 +1783,70 @@
+ }
+ #endif
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++void /* PRIVATE */
++png_write_acTL(png_structp png_ptr,
++ png_uint_32 num_frames, png_uint_32 num_plays)
++{
++#ifdef PNG_USE_LOCAL_ARRAYS
++ PNG_acTL;
++#endif
++ png_byte data[16];
++
++ png_debug(1, "in png_write_acTL");
++
++ png_ptr->num_frames_to_write = num_frames;
++
++ if (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN)
++ num_frames--;
++
++ png_save_uint_32(data, num_frames);
++ png_save_uint_32(data + 4, num_plays);
++
++ png_write_chunk(png_ptr, (png_bytep)png_acTL, data, (png_size_t)8);
++}
++
++void /* PRIVATE */
++png_write_fcTL(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op)
++{
++#ifdef PNG_USE_LOCAL_ARRAYS
++ PNG_fcTL;
++#endif
++ png_byte data[26];
++
++ png_debug(1, "in png_write_fcTL");
++
++ if (png_ptr->num_frames_written == 0 && (x_offset != 0 || y_offset != 0))
++ png_error(png_ptr, "x and/or y offset for the first frame aren't 0");
++ if (png_ptr->num_frames_written == 0 &&
++ (width != png_ptr->first_frame_width ||
++ height != png_ptr->first_frame_height))
++ png_error(png_ptr, "width and/or height in the first frame's fcTL "
++ "don't match the ones in IHDR");
++
++ /* more error checking */
++ png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
++ delay_num, delay_den, dispose_op, blend_op);
++
++ png_save_uint_32(data, png_ptr->next_seq_num);
++ png_save_uint_32(data + 4, width);
++ png_save_uint_32(data + 8, height);
++ png_save_uint_32(data + 12, x_offset);
++ png_save_uint_32(data + 16, y_offset);
++ png_save_uint_16(data + 20, delay_num);
++ png_save_uint_16(data + 22, delay_den);
++ data[24] = dispose_op;
++ data[25] = blend_op;
++
++ png_write_chunk(png_ptr, (png_bytep)png_fcTL, data, (png_size_t)26);
++
++ png_ptr->next_seq_num++;
++}
++#endif /* PNG_WRITE_APNG_SUPPORTED */
++
+ /* Initializes the row writing capability of libpng */
+ void /* PRIVATE */
+ png_write_start_row(png_structp png_ptr)
+@@ -2159,8 +2252,8 @@
+ #ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+ if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS)
+ {
+- /* These will never be selected so we need not test them. */
+- filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH);
++ /* These use previous row */
++ filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_AVG | PNG_FILTER_PAETH);
+ }
+ #endif
+
+@@ -2829,4 +2922,39 @@
+ }
+ #endif
+ }
++
++#ifdef PNG_WRITE_APNG_SUPPORTED
++void /* PRIVATE */
++png_write_reset(png_structp png_ptr)
++{
++ png_ptr->row_number = 0;
++ png_ptr->pass = 0;
++ png_ptr->mode &= ~PNG_HAVE_IDAT;
++}
++
++void /* PRIVATE */
++png_write_reinit(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 width, png_uint_32 height)
++{
++ if (png_ptr->num_frames_written == 0 &&
++ (width != png_ptr->first_frame_width ||
++ height != png_ptr->first_frame_height))
++ png_error(png_ptr, "width and/or height in the first frame's fcTL "
++ "don't match the ones in IHDR");
++ if (width > png_ptr->first_frame_width ||
++ height > png_ptr->first_frame_height)
++ png_error(png_ptr, "width and/or height for a frame greater than"
++ "the ones in IHDR");
++
++ png_set_IHDR(png_ptr, info_ptr, width, height,
++ info_ptr->bit_depth, info_ptr->color_type,
++ info_ptr->interlace_type, info_ptr->compression_type,
++ info_ptr->filter_type);
++
++ png_ptr->width = width;
++ png_ptr->height = height;
++ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
++ png_ptr->usr_width = png_ptr->width;
++}
++#endif
+ #endif /* PNG_WRITE_SUPPORTED */
+Index: pngrtran.c
+===================================================================
+--- pngrtran.c
++++ pngrtran.c
+@@ -1352,7 +1352,7 @@
+ * pixels. This check added to libpng-1.2.19
+ */
+ #if (PNG_WARN_UNINITIALIZED_ROW==1)
+- png_error(png_ptr, "Uninitialized row");
++ png_warning(png_ptr, "Uninitialized row");
+ #else
+ png_warning(png_ptr, "Uninitialized row");
+ #endif
diff --git a/perl-proc-daemon/PKGBUILD b/perl-proc-daemon/PKGBUILD new file mode 100644 index 0000000..790ded2 --- /dev/null +++ b/perl-proc-daemon/PKGBUILD @@ -0,0 +1,33 @@ +# Contributor: Justin Davis <jrcd83@gmail.com> +# Generator : CPANPLUS::Dist::Arch 1.10 +pkgname='perl-proc-daemon' +pkgver='0.05' +pkgrel='1' +pkgdesc="Run Perl program(s) as a daemon process" +arch=('any') +license=('PerlArtistic' 'GPL') +options=('!emptydirs') +depends=('perl') +makedepends=() +url='http://search.cpan.org/dist/Proc-Daemon' +source=('http://search.cpan.org/CPAN/authors/id/D/DE/DETI/Proc/Proc-Daemon-0.05.tar.gz') +md5sums=('882c741da92d370c87b3ae496905654f') + +build() { + PERL=/usr/bin/perl + DIST_DIR="${srcdir}/Proc-Daemon-0.05" + export PERL_MM_USE_DEFAULT=1 PERL5LIB="" \ + PERL_AUTOINSTALL=--skipdeps \ + PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \ + PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \ + MODULEBUILDRC=/dev/null + + { cd "$DIST_DIR" && + $PERL Makefile.PL && + make && + make test && + make install; + } || return 1; + + find "$pkgdir" -name .packlist -o -name perllocal.pod -delete +} diff --git a/perl-text-upsidedown/PKGBUILD b/perl-text-upsidedown/PKGBUILD new file mode 100644 index 0000000..e38f26c --- /dev/null +++ b/perl-text-upsidedown/PKGBUILD @@ -0,0 +1,22 @@ +# This PKGBUILD was generated by cpan4pacman via CPANPLUS::Dist::Pacman +# Contributor: Daenyth <Daenyth+arch AT gmail DOT com> + +pkgname=perl-text-upsidedown +pkgver=1.100820 +pkgrel=1 +pkgdesc="flip text upside-down using Unicode " +arch=('i686' 'x86_64') +url="http://search.cpan.org/~MARCEL/Text-UpsideDown" +license=('GPL' 'PerlArtistic') +depends=('perl>=5.10.0') +makedepends=('perl-universal-require') +options=('!emptydirs' 'purge') +source=(http://www.cpan.org/authors/id/M/MA/MARCEL/Text-UpsideDown-$pkgver.tar.gz) +md5sums=('230b0cfe6d27f560e33f1d4ca716579c') + +build() { + cd $startdir/src/Text-UpsideDown-$pkgver + PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor || return 1 + make || return 1 + make install DESTDIR=$startdir/pkg || return 1 +} diff --git a/tcpxtract/PKGBUILD b/tcpxtract/PKGBUILD new file mode 100644 index 0000000..fc57fc7 --- /dev/null +++ b/tcpxtract/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: Michael P <ptchinster@archlinux.us> +# Contributor: Christoph Siegenthaler <csi@gmx.ch> +# Contributor: Wael Nasreddine <gandalf@siemens-mobiles.org> + +pkgname=tcpxtract +pkgver=1.0.1 +pkgrel=3 +pkgdesc="A tool for extracting files from network traffic" +url="http://tcpxtract.sourceforge.net" +arch=('i686' 'x86_64') +license=('GPL') +depends=('libpcap') +source=(http://prdownloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz \ +conf_default_path.patch) +md5sums=('1d8fe172d4590c33a157798e08dc0ccd' 'c7964f1e9c1315ae2d2b94c2bd06b4b7') + +build() +{ + cd $startdir/src/$pkgname-$pkgver + # Applying conf_default_path patch + patch -Np0 -i $startdir/src/conf_default_path.patch || return 1 + + ./configure --prefix=/usr --sysconfdir=/etc || return 1 + make || return 1 + make DESTDIR=$startdir/pkg install || return 1 +} + diff --git a/tcpxtract/conf_default_path.patch b/tcpxtract/conf_default_path.patch new file mode 100644 index 0000000..a5c5e66 --- /dev/null +++ b/tcpxtract/conf_default_path.patch @@ -0,0 +1,12 @@ +--- tcpxtract.c.old 2006-03-10 02:10:06.000000000 +0100 ++++ tcpxtract.c 2006-03-10 02:10:23.000000000 +0100 +@@ -48,7 +48,7 @@ + #include "search.h" + + #ifndef DEFAULT_CONFIG_FILE +-#define DEFAULT_CONFIG_FILE "/usr/local/etc/tcpxtract.conf" ++#define DEFAULT_CONFIG_FILE "/etc/tcpxtract.conf" + #endif + + extern FILE *yyin; /* the lex/yacc input file */ + diff --git a/ttf-ms-fonts/LICENSE b/ttf-ms-fonts/LICENSE new file mode 100644 index 0000000..50f111c --- /dev/null +++ b/ttf-ms-fonts/LICENSE @@ -0,0 +1,44 @@ +END-USER LICENSE AGREEMENT FOR +MICROSOFT SOFTWARE + +IMPORTANT-READ CAREFULLY: This Microsoft End-User License Agreement ("EULA") is a legal agreement between you (either an individual or a single entity) and Microsoft Corporation for the Microsoft software accompanying this EULA, which includes computer software and may include associated media, printed materials, and "on-line" or electronic documentation ("SOFTWARE PRODUCT" or "SOFTWARE"). By exercising your rights to make and use copies of the SOFTWARE PRODUCT, you agree to be bound by the terms of this EULA. If you do not agree to the terms of this EULA, you may not use the SOFTWARE PRODUCT. + + +SOFTWARE PRODUCT LICENSE +The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold. + + +1. GRANT OF LICENSE. This EULA grants you the following rights: + + * Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT. + * Reproduction and Distribution. You may reproduce and distribute an unlimited number of copies of the SOFTWARE PRODUCT; provided that each copy shall be a true and complete copy, including all copyright and trademark notices, and shall be accompanied by a copy of this EULA. Copies of the SOFTWARE PRODUCT may not be distributed for profit either on a standalone basis or included as part of your own product. + + +2. DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS. + + * Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation. + * Restrictions on Alteration. You may not rename, edit or create any derivative works from the SOFTWARE PRODUCT, other than subsetting when embedding them in documents. + * Software Transfer. You may permanently transfer all of your rights under this EULA, provided the recipient agrees to the terms of this EULA. + * Termination. Without prejudice to any other rights, Microsoft may terminate this EULA if you fail to comply with the terms and conditions of this EULA. In such event, you must destroy all copies of the SOFTWARE PRODUCT and all of its component parts. + + +3. COPYRIGHT. All title and copyrights in and to the SOFTWARE PRODUCT (including but not limited to any images, text, and "applets" incorporated into the SOFTWARE PRODUCT), the accompanying printed materials, and any copies of the SOFTWARE PRODUCT are owned by Microsoft or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material. + + +4. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is Microsoft Corporation/One Microsoft Way/Redmond, WA 98052-6399. + + +LIMITED WARRANTY + +NO WARRANTIES. Microsoft expressly disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related documentation is provided "as is" without warranty of any kind, either express or implied, including, without limitation, the implied warranties or merchantability, fitness for a particular purpose, or noninfringement. The entire risk arising out of use or performance of the SOFTWARE PRODUCT remains with you. + +NO LIABILITY FOR CONSEQUENTIAL DAMAGES. In no event shall Microsoft or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss) arising out of the use of or inability to use this Microsoft product, even if Microsoft has been advised of the possibility of such damages. Because some states/jurisdictions do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to you. + + +MISCELLANEOUS + +If you acquired this product in the United States, this EULA is governed by the laws of the State of Washington. + +If this product was acquired outside the United States, then local laws may apply. + +Should you have any questions concerning this EULA, or if you desire to contact Microsoft for any reason, please contact the Microsoft subsidiary serving your country, or write: Microsoft Sales Information Center/One Microsoft Way/Redmond, WA 98052-6399. diff --git a/ttf-ms-fonts/PKGBUILD b/ttf-ms-fonts/PKGBUILD new file mode 100644 index 0000000..74a213b --- /dev/null +++ b/ttf-ms-fonts/PKGBUILD @@ -0,0 +1,42 @@ +# Maintainer: birdflesh <antkoul at gmail dot com> +# Contributor: Army <uli.armbruster@gmail.com> +# Contributor: Thayer Williams <thayer@archlinux.org> +# Contributor: dale <dale@archlinux.org> + +pkgname=ttf-ms-fonts +pkgver=2.0 +pkgrel=7 +pkgdesc="Core TTF Fonts from Microsoft" +arch=('any') +url="http://corefonts.sourceforge.net/" +license=('custom:microsoft') +depends=('fontconfig' 'xorg-fonts-encodings') +makedepends=('cabextract') +install=$pkgname.install +_sfpath="http://downloads.sourceforge.net/corefonts" +source=(${_sfpath}/andale32.exe ${_sfpath}/arial32.exe ${_sfpath}/arialb32.exe + ${_sfpath}/comic32.exe ${_sfpath}/courie32.exe ${_sfpath}/georgi32.exe + ${_sfpath}/impact32.exe ${_sfpath}/times32.exe ${_sfpath}/trebuc32.exe + ${_sfpath}/verdan32.exe ${_sfpath}/webdin32.exe + LICENSE) +md5sums=('cbdc2fdd7d2ed0832795e86a8b9ee19a' + '9637df0e91703179f0723ec095a36cb5' + 'c9089ae0c3b3d0d8c4b0a95979bb9ff0' + '2b30de40bb5e803a0452c7715fc835d1' + '4e412c772294403ab62fb2d247d85c60' + '4d90016026e2da447593b41a8d8fa8bd' + '7907c7dd6684e9bade91cff82683d9d7' + 'ed39c8ef91b9fb80f76f702568291bd5' + '0d7ea16cac6261f8513a061fbfcdb2b5' + '12d2a75f8156e10607be1eaa8e8ef120' + '230a1d13a365b22815f502eb24d9149b' + '7a760fc266e256421078597e47f1af68') + +package() { + install -dm755 ${pkgdir}/usr/share/fonts/TTF + for font in ${srcdir}/*.exe + do + cabextract --lowercase --directory=${pkgdir}/usr/share/fonts/TTF/ ${font} -F '*.ttf' + done + install -Dm644 ${srcdir}/LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE +} diff --git a/ttf-ms-fonts/andale32.exe b/ttf-ms-fonts/andale32.exe Binary files differnew file mode 100644 index 0000000..05354ff --- /dev/null +++ b/ttf-ms-fonts/andale32.exe diff --git a/ttf-ms-fonts/arial32.exe b/ttf-ms-fonts/arial32.exe Binary files differnew file mode 100644 index 0000000..caaa6b6 --- /dev/null +++ b/ttf-ms-fonts/arial32.exe diff --git a/ttf-ms-fonts/arialb32.exe b/ttf-ms-fonts/arialb32.exe Binary files differnew file mode 100644 index 0000000..3e78074 --- /dev/null +++ b/ttf-ms-fonts/arialb32.exe diff --git a/ttf-ms-fonts/comic32.exe b/ttf-ms-fonts/comic32.exe Binary files differnew file mode 100644 index 0000000..9e69a37 --- /dev/null +++ b/ttf-ms-fonts/comic32.exe diff --git a/ttf-ms-fonts/courie32.exe b/ttf-ms-fonts/courie32.exe Binary files differnew file mode 100644 index 0000000..57a1364 --- /dev/null +++ b/ttf-ms-fonts/courie32.exe diff --git a/ttf-ms-fonts/georgi32.exe b/ttf-ms-fonts/georgi32.exe Binary files differnew file mode 100644 index 0000000..5022b38 --- /dev/null +++ b/ttf-ms-fonts/georgi32.exe diff --git a/ttf-ms-fonts/impact32.exe b/ttf-ms-fonts/impact32.exe Binary files differnew file mode 100644 index 0000000..193eb52 --- /dev/null +++ b/ttf-ms-fonts/impact32.exe diff --git a/ttf-ms-fonts/times32.exe b/ttf-ms-fonts/times32.exe Binary files differnew file mode 100644 index 0000000..fd7257f --- /dev/null +++ b/ttf-ms-fonts/times32.exe diff --git a/ttf-ms-fonts/trebuc32.exe b/ttf-ms-fonts/trebuc32.exe Binary files differnew file mode 100644 index 0000000..c92660c --- /dev/null +++ b/ttf-ms-fonts/trebuc32.exe diff --git a/ttf-ms-fonts/ttf-ms-fonts.install b/ttf-ms-fonts/ttf-ms-fonts.install new file mode 100644 index 0000000..7d26d0c --- /dev/null +++ b/ttf-ms-fonts/ttf-ms-fonts.install @@ -0,0 +1,16 @@ +post_install() { + echo -n "Updating font cache... " + fc-cache -f > /dev/null + mkfontscale /usr/share/fonts/TTF + mkfontdir /usr/share/fonts/TTF + echo "done." +} + +post_upgrade() { + post_install $1 +} + +post_remove() { + post_install $1 +} + diff --git a/ttf-ms-fonts/verdan32.exe b/ttf-ms-fonts/verdan32.exe Binary files differnew file mode 100644 index 0000000..b3c451e --- /dev/null +++ b/ttf-ms-fonts/verdan32.exe diff --git a/ttf-ms-fonts/webdin32.exe b/ttf-ms-fonts/webdin32.exe Binary files differnew file mode 100644 index 0000000..c8cd27d --- /dev/null +++ b/ttf-ms-fonts/webdin32.exe diff --git a/vim-gnupg/PKGBUILD b/vim-gnupg/PKGBUILD index 29ca365..e185fa3 100644 --- a/vim-gnupg/PKGBUILD +++ b/vim-gnupg/PKGBUILD @@ -1,8 +1,10 @@ -# Maintainer: Laszlo Papp <djszapi @ archlinux us> +# Maintainer: nblock <nblock [/at\] archlinux DOT us> +# Contributor: Laszlo Papp <djszapi @ archlinux us> + pkgname=vim-gnupg -pkgver=2782 -_scriptid=10833 -pkgrel=3 +pkgver=3026 +_scriptid=12200 +pkgrel=1 pkgdesc="Plugin for transparent editing of gpg encrypted files" arch=('i686' 'x86_64') url="http://www.vim.org/scripts/script.php?script_id=661" @@ -10,9 +12,10 @@ license=('GPL') groups=('vim-plugins') depends=('vim') source=(${pkgname}::http://www.vim.org/scripts/download_script.php?src_id=${_scriptid}) -md5sums=('0ad10ba6924bb49f3d80eb4d560de0a5') +md5sums=('e1d3007b845744f0513cbac8cfe69912') build() { - install -Dm644 ${srcdir}/${pkgname} ${pkgdir}/usr/share/vim/vimfiles/plugin/gnupg.vim || return 1 + install -Dm644 ${srcdir}/${pkgname} ${pkgdir}/usr/share/vim/vimfiles/plugin/gnupg.vim } +# vim:set ts=2 sw=2 et: diff --git a/vim-gnupg/vim-gnupg b/vim-gnupg/vim-gnupg index fdcac93..09116d6 100644 --- a/vim-gnupg/vim-gnupg +++ b/vim-gnupg/vim-gnupg @@ -1,12 +1,14 @@ -" Name: gnupg.vim -" Version: $Id: gnupg.vim 2782 2009-06-08 12:32:13Z mbr $ -" Author: Markus Braun <markus.braun@krawel.de> -" Summary: Vim plugin for transparent editing of gpg encrypted files. -" Licence: This program is free software; you can redistribute it and/or -" modify it under the terms of the GNU General Public License. -" See http://www.gnu.org/copyleft/gpl.txt +" Name: gnupg.vim +" Version: $Id: gnupg.vim 3026 2010-01-27 08:18:04Z mbr $ +" Author: Markus Braun <markus.braun@krawel.de> +" Summary: Vim plugin for transparent editing of gpg encrypted files. +" Licence: This program is free software; you can redistribute it and/or +" modify it under the terms of the GNU General Public License. +" See http://www.gnu.org/copyleft/gpl.txt +" " Section: Documentation {{{1 -" Description: +" +" Description: {{{2 " " This script implements transparent editing of gpg encrypted files. The " filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such @@ -15,7 +17,7 @@ " encrypted to all recipients before it is written. The script turns off " viminfo and swapfile to increase security. " -" Installation: +" Installation: {{{2 " " Copy the gnupg.vim file to the $HOME/.vim/plugin directory. " Refer to ':help add-plugin', ':help add-global-plugin' and ':help @@ -34,7 +36,10 @@ " put of the tty command. For W32 systems this option is not required. " ... " -" Commands: +" Most distributions provide software to ease handling of gpg and gpg-agent. +" Examples are keychain or seahorse. +" +" Commands: {{{2 " " :GPGEditRecipients " Opens a scratch buffer to change the list of recipients. Recipients that @@ -53,7 +58,7 @@ " :GPGViewOptions " Prints the list of options. " -" Variables: +" Variables: {{{2 " " g:GPGExecutable " If set used as gpg executable, otherwise the system chooses what is run @@ -75,7 +80,7 @@ " If set, these recipients are used as defaults when no other recipient is " defined. This variable is a Vim list. Default is unset. " -" Known Issues: +" Known Issues: {{{2 " " In some cases gvim can't decryt files @@ -97,7 +102,7 @@ " you will get a popup window the first time you open a file that " needs to be decrypted. " -" Credits: +" Credits: {{{2 " " - Mathieu Clabaut for inspirations through his vimspell.vim script. " - Richard Bronosky for patch to enable ".pgp" suffix. @@ -113,18 +118,21 @@ " - Tim Swast for patch to generate signed files " " Section: Plugin header {{{1 -if (v:version < 700) - echohl ErrorMsg | echo 'plugin gnupg.vim requires Vim version >= 7.0' | echohl None - finish -endif +" guard against multiple loads {{{2 if (exists("g:loaded_gnupg") || &cp || exists("#BufReadPre#*.\(gpg\|asc\|pgp\)")) finish endif +let g:loaded_gnupg = "$Revision: 3026 $" -let g:loaded_gnupg = "$Revision: 2782 $" +" check for correct vim version {{{2 +if (v:version < 700) + echohl ErrorMsg | echo 'plugin gnupg.vim requires Vim version >= 7.0' | echohl None + finish +endif " Section: Autocmd setup {{{1 + augroup GnuPG autocmd! @@ -147,19 +155,24 @@ augroup GnuPG augroup END " Section: Constants {{{1 + let s:GPGMagicString = "\t \t" " Section: Highlight setup {{{1 + highlight default link GPGWarning WarningMsg highlight default link GPGError ErrorMsg highlight default link GPGHighlightUnknownRecipient ErrorMsg " Section: Functions {{{1 + " Function: s:GPGInit() {{{2 " " initialize the plugin " function s:GPGInit() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGInit()") + " first make sure nothing is written to ~/.viminfo while editing " an encrypted file. set viminfo= @@ -192,16 +205,11 @@ function s:GPGInit() let g:GPGPreferSign = 0 endif - " check if debugging is turned on + " start with empty default recipients if none is defined so far if (!exists("g:GPGDefaultRecipients")) let g:GPGDefaultRecipients = [] endif - " check if debugging is turned on - if (!exists("g:GPGDebugLevel")) - let g:GPGDebugLevel = 0 - endif - " print version call s:GPGDebug(1, "gnupg.vim ". g:loaded_gnupg) @@ -234,8 +242,8 @@ function s:GPGInit() let s:shellsave = &shell if (has("unix")) " unix specific settings - let s:shellredir = &shellredir - let s:shell = 'sh' + let s:shellredir = ">%s 2>&1" + let s:shell = '/bin/sh' let s:stderrredirnull = '2>/dev/null' let s:GPGCommand = "LANG=C LC_ALL=C " . s:GPGCommand else @@ -245,17 +253,37 @@ function s:GPGInit() let s:stderrredirnull = '2>nul' endif + call s:GPGDebug(3, "shellredirsave: " . s:shellredirsave) + call s:GPGDebug(3, "shellsave: " . s:shellsave) + + call s:GPGDebug(3, "shell: " . s:shell) + call s:GPGDebug(3, "shellcmdflag: " . &shellcmdflag) + call s:GPGDebug(3, "shellxquote: " . &shellxquote) + call s:GPGDebug(3, "shellredir: " . s:shellredir) + call s:GPGDebug(3, "stderrredirnull: " . s:stderrredirnull) + + call s:GPGDebug(3, "shell implementation: " . resolve(s:shell)) + " find the supported algorithms + let commandline = s:GPGCommand . " --version" + call s:GPGDebug(2, "command: ". commandline) let &shellredir = s:shellredir let &shell = s:shell - let output = system(s:GPGCommand . " --version") + let output = system(commandline) let &shellredir = s:shellredirsave let &shell = s:shellsave + call s:GPGDebug(2, "output: ". output) let s:GPGPubkey = substitute(output, ".*Pubkey: \\(.\\{-}\\)\n.*", "\\1", "") let s:GPGCipher = substitute(output, ".*Cipher: \\(.\\{-}\\)\n.*", "\\1", "") let s:GPGHash = substitute(output, ".*Hash: \\(.\\{-}\\)\n.*", "\\1", "") - let s:GPGCompress = substitute(output, ".*Compress: \\(.\\{-}\\)\n.*", "\\1", "") + let s:GPGCompress = substitute(output, ".*Compress.\\{-}: \\(.\\{-}\\)\n.*", "\\1", "") + + call s:GPGDebug(2, "public key algorithms: " . s:GPGPubkey) + call s:GPGDebug(2, "cipher algorithms: " . s:GPGCipher) + call s:GPGDebug(2, "hashing algorithms: " . s:GPGHash) + call s:GPGDebug(2, "compression algorithms: " . s:GPGCompress) + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGInit()") endfunction " Function: s:GPGCleanup() {{{2 @@ -263,9 +291,13 @@ endfunction " cleanup on leaving vim " function s:GPGCleanup() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCleanup()") + " wipe out screen new +only redraw! + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCleanup()") endfunction " Function: s:GPGDecrypt() {{{2 @@ -273,6 +305,8 @@ endfunction " decrypt the buffer and find all recipients of the encrypted file " function s:GPGDecrypt() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGDecrypt()") + " switch to binary mode to read the encrypted file set bin @@ -285,13 +319,14 @@ function s:GPGDecrypt() let b:GPGOptions = [] " find the recipients of the file + let commandline = s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\"" + call s:GPGDebug(3, "command: " . commandline) let &shellredir = s:shellredir let &shell = s:shell - let output = system(s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\"") + let output = system(commandline) let &shellredir = s:shellredirsave let &shell = s:shellsave - call s:GPGDebug(1, "output of command '" . s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\"' is:") - call s:GPGDebug(1, ">>>>> " . output . " <<<<<") + call s:GPGDebug(3, "output: ". output) " check if the file is symmetric/asymmetric encrypted if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0) @@ -345,6 +380,7 @@ function s:GPGDecrypt() echom "File is not encrypted, all GPG functions disabled!" echohl None set nobin + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") return endif @@ -357,9 +393,12 @@ function s:GPGDecrypt() " finally decrypt the buffer content " since even with the --quiet option passphrase typos will be reported, " we must redirect stderr (using shell temporarily) + call s:GPGDebug(1, "decrypting file") + let commandline = "'[,']!" . s:GPGCommand . " --quiet --decrypt " . s:stderrredirnull + call s:GPGDebug(1, "command: " . commandline) let &shellredir = s:shellredir let &shell = s:shell - exec "'[,']!" . s:GPGCommand . " --quiet --decrypt " . s:stderrredirnull + execute commandline let &shellredir = s:shellredirsave let &shell = s:shellsave if (v:shell_error) " message could not be decrypted @@ -369,6 +408,7 @@ function s:GPGDecrypt() echohl None bwipeout set nobin + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") return endif @@ -381,6 +421,8 @@ function s:GPGDecrypt() " refresh screen redraw! + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") endfunction " Function: s:GPGEncrypt() {{{2 @@ -388,6 +430,8 @@ endfunction " encrypts the buffer to all previous recipients " function s:GPGEncrypt() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEncrypt()") + " save window view let s:GPGWindowView = winsaveview() call s:GPGDebug(2, "saved window view " . string(s:GPGWindowView)) @@ -406,10 +450,11 @@ function s:GPGEncrypt() set bin " guard for unencrypted files - if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) - echohl GPGWarning - echom "File is not encrypted, all GPG functions disabled!" + if (!exists("b:GPGEncrypted") || b:GPGEncrypted == 0) + echohl GPGError + let blackhole = input("Message could not be encrypted! File might be empty! (Press ENTER)") echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()") return endif @@ -467,12 +512,13 @@ function s:GPGEncrypt() endif " encrypt the buffer + let commandline = "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . " " . s:stderrredirnull + call s:GPGDebug(1, "command: " . commandline) let &shellredir = s:shellredir let &shell = s:shell - silent exec "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . " " . s:stderrredirnull + silent execute commandline let &shellredir = s:shellredirsave let &shell = s:shellsave - call s:GPGDebug(1, "called gpg command is: " . "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . " " . s:stderrredirnull) if (v:shell_error) " message could not be encrypted " delete content of the buffer to be sure no data is written unencrypted " content will be recovered in GPGEncryptPost() @@ -481,9 +527,11 @@ function s:GPGEncrypt() echohl GPGError let blackhole = input("Message could not be encrypted! File might be empty! (Press ENTER)") echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()") return endif + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncrypt()") endfunction " Function: s:GPGEncryptPost() {{{2 @@ -491,8 +539,11 @@ endfunction " undo changes don by encrypt, after writing " function s:GPGEncryptPost() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEncryptPost()") + " guard for unencrypted files if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncryptPost()") return endif @@ -514,6 +565,8 @@ function s:GPGEncryptPost() " refresh screen redraw! + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEncryptPost()") endfunction " Function: s:GPGViewRecipients() {{{2 @@ -521,11 +574,14 @@ endfunction " echo the recipients " function s:GPGViewRecipients() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewRecipients()") + " guard for unencrypted files if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) echohl GPGWarning echom "File is not encrypted, all GPG functions disabled!" echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()") return endif @@ -552,6 +608,8 @@ function s:GPGViewRecipients() echom 'There are no known recipients!' echohl None endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewRecipients()") endfunction " Function: s:GPGEditRecipients() {{{2 @@ -559,11 +617,14 @@ endfunction " create a scratch buffer with all recipients to add/remove recipients " function s:GPGEditRecipients() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditRecipients()") + " guard for unencrypted files if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) echohl GPGWarning echom "File is not encrypted, all GPG functions disabled!" echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()") return endif @@ -648,12 +709,12 @@ function s:GPGEditRecipients() " define highlight if (has("syntax") && exists("g:syntax_on")) - exec('syntax match GPGUnknownRecipient "' . syntaxPattern . '"') + execute 'syntax match GPGUnknownRecipient "' . syntaxPattern . '"' highlight clear GPGUnknownRecipient highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient syntax match GPGComment "^GPG:.*$" - exec 'syntax match GPGComment "' . s:GPGMagicString . '.*$"' + execute 'syntax match GPGComment "' . s:GPGMagicString . '.*$"' highlight clear GPGComment highlight link GPGComment Comment endif @@ -665,17 +726,23 @@ function s:GPGEditRecipients() silent normal! G endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditRecipients()") endfunction " Function: s:GPGFinishRecipientsBuffer() {{{2 " " create a new recipient list from RecipientsBuffer +" function s:GPGFinishRecipientsBuffer() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishRecipientsBuffer()") + " guard for unencrypted files if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) echohl GPGWarning echom "File is not encrypted, all GPG functions disabled!" echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()") return endif @@ -736,6 +803,8 @@ function s:GPGFinishRecipientsBuffer() " reset modified flag set nomodified + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishRecipientsBuffer()") endfunction " Function: s:GPGViewOptions() {{{2 @@ -743,11 +812,14 @@ endfunction " echo the recipients " function s:GPGViewOptions() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGViewOptions()") + " guard for unencrypted files if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) echohl GPGWarning echom "File is not encrypted, all GPG functions disabled!" echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()") return endif @@ -758,6 +830,8 @@ function s:GPGViewOptions() echo option endfor endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGViewOptions()") endfunction " Function: s:GPGEditOptions() {{{2 @@ -765,11 +839,14 @@ endfunction " create a scratch buffer with all recipients to add/remove recipients " function s:GPGEditOptions() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGEditOptions()") + " guard for unencrypted files if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) echohl GPGWarning echom "File is not encrypted, all GPG functions disabled!" echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()") return endif @@ -844,17 +921,23 @@ function s:GPGEditOptions() highlight link GPGComment Comment endif endif + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGEditOptions()") endfunction " Function: s:GPGFinishOptionsBuffer() {{{2 " " create a new option list from OptionsBuffer +" function s:GPGFinishOptionsBuffer() + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGFinishOptionsBuffer()") + " guard for unencrypted files if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0) echohl GPGWarning echom "File is not encrypted, all GPG functions disabled!" echohl None + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()") return endif @@ -893,13 +976,18 @@ function s:GPGFinishOptionsBuffer() " reset modified flag set nomodified + + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGFinishOptionsBuffer()") endfunction " Function: s:GPGCheckRecipients(tocheck) {{{2 " " check if recipients are known " Returns: two lists recipients and unknownrecipients +" function s:GPGCheckRecipients(tocheck) + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGCheckRecipients()") + let recipients = [] let unknownrecipients = [] @@ -924,6 +1012,7 @@ function s:GPGCheckRecipients(tocheck) call s:GPGDebug(2, "recipients are: " . string(recipients)) call s:GPGDebug(2, "unknown recipients are: " . string(unknownrecipients)) + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGCheckRecipients()") return [ recipients, unknownrecipients ] endfunction @@ -931,13 +1020,19 @@ endfunction " " find GPG key ID corresponding to a name " Returns: ID for the given name +" function s:GPGNameToID(name) + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGNameToID()") + " ask gpg for the id for a name + let commandline = s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys \"" . a:name . "\"" + call s:GPGDebug(2, "command: ". commandline) let &shellredir = s:shellredir let &shell = s:shell - let output = system(s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys \"" . a:name . "\"") + let output = system(commandline) let &shellredir = s:shellredirsave let &shell = s:shellsave + call s:GPGDebug(2, "output: ". output) " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8, " so convert it, if necessary @@ -989,6 +1084,7 @@ function s:GPGNameToID(name) endwhile endif + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()") return get(gpgids, answer, "") endfunction @@ -996,15 +1092,21 @@ endfunction " " find name corresponding to a GPG key ID " Returns: Name for the given ID +" function s:GPGIDToName(identity) + call s:GPGDebug(3, ">>>>>>>> Entering s:GPGIDToName()") + " TODO is the encryption subkey really unique? " ask gpg for the id for a name + let commandline = s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys " . a:identity + call s:GPGDebug(2, "command: ". commandline) let &shellredir = s:shellredir let &shell = s:shell - let output = system(s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys " . a:identity ) + let output = system(commandline) let &shellredir = s:shellredirsave let &shell = s:shellsave + call s:GPGDebug(2, "output: ". output) " when called with "--with-colons" gpg encodes its output _ALWAYS_ as UTF-8, " so convert it, if necessary @@ -1035,24 +1137,36 @@ function s:GPGIDToName(identity) endif endfor + call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGIDToName()") return uid endfunction " Function: s:GPGDebug(level, text) {{{2 " " output debug message, if this message has high enough importance +" only define function if GPGDebugLevel set at all +" function s:GPGDebug(level, text) - if (g:GPGDebugLevel >= a:level) - echom a:text + if exists("g:GPGDebugLevel") && g:GPGDebugLevel >= a:level + if exists("g:GPGDebugLog") + execute "redir >> " . g:GPGDebugLog + echom "GnuPG: " . a:text + redir END + else + echom "GnuPG: " . a:text + endif endif endfunction -" Section: Command definitions {{{1 +" Section: Commands {{{1 + command! GPGViewRecipients call s:GPGViewRecipients() command! GPGEditRecipients call s:GPGEditRecipients() command! GPGViewOptions call s:GPGViewOptions() command! GPGEditOptions call s:GPGEditOptions() + " Section: Menu {{{1 + if (has("menu")) amenu <silent> Plugin.GnuPG.View\ Recipients :GPGViewRecipients<CR> amenu <silent> Plugin.GnuPG.Edit\ Recipients :GPGEditRecipients<CR> diff --git a/youtube-viewer/PKGBUILD b/youtube-viewer/PKGBUILD new file mode 100644 index 0000000..26c8366 --- /dev/null +++ b/youtube-viewer/PKGBUILD @@ -0,0 +1,16 @@ +# Maintainer: Trizen <trizenx at gmail dot com> + +pkgname=youtube-viewer +pkgver=2.4.4 +pkgrel=2 +pkgdesc="Search and play YouTube videos streaming in MPlayer with HD support." +arch=('any') +url="http://trizen.go.ro/" +license=('GPL') +depends=('mplayer' 'perl-libwww') +source=(http://trizen.go.ro/files/$pkgname) +md5sums=('ed52be72c17679dea55d7df816e65ed1') + +build() { + install -Dm 755 $srcdir/$pkgname $pkgdir/usr/bin/$pkgname +} diff --git a/youtube-viewer/youtube-viewer b/youtube-viewer/youtube-viewer new file mode 100644 index 0000000..09c93fd --- /dev/null +++ b/youtube-viewer/youtube-viewer @@ -0,0 +1,866 @@ +#!/usr/bin/perl + +# Last edit on January 12 2011, 10:25 PM + +$appname = 'youtube-viewer'; +$version = 'v2.4.4'; + +=start +------------------------------------------------------- + (C) 2010-2011 by Trizen + WebSite: http://trizen.go.ro + Email: echo dHJpemVueEBnbWFpbC5jb20K | base64 -d +------------------------------------------------------- + +[?] What is this script for? + - This script is useful if do you hate the Flash Player and love YouTube. + - Using this script you can search and play YouTube Videos with MPlayer... + - Have fun! + +[!] Most important changes are written in the changelog! + + [CHANGELOG] + - First version with Windows support. Require SMPlayer to play videos. See MPlayer Line - NEW (v2.4.*) + - Code has been changed in a proportion of ~60% and optimized for speed // --480 became -4 - NEW (v2.4.*) + - Added mega-powers of omnibox to the STDIN :) - NEW (v2.3.*) + - Re-added the option to list and play youtube videos from a user profile. Usage: -u [user] - NEW (v2.3.*) + - Added a new option to play all video clips from a category. Usage: '-c 9' and insert 'all' - NEW (v2.3.*) + - Category area is more friendly... New options: -c [n] where 'n' is the number of category - NEW (v2.3.*) + - Added a new option to play only the audio track of a videoclip. Usage: [words] -n - NEW (v2.3.*) + - Added option for fullscreen (-f, --fullscreen). Usage: youtube-viewer [words] -f - NEW (v2.3.*) + - Added one new option '-c'. It shows available categories and will let you to choose one. - NEW (v2.3.*) + - Added one new option '-m'. It shows 3 pages of youtube video results. Usage: [words] -m - NEW (v2.3.*) + - For "-p" option has been added 3 pages of youtube video results (60 clips) - NEW (v2.3.*) + - Added "-prefer-ipv4" to the mplayer line (videoclips starts in no time now). - NEW (v2.3.*) + - Search and play videos at 480p, 720p. Ex: [words] --480, [words] -p --480 - NEW (v2.3.*) + - Search has been corrected due to some YouTube changes... - (v2.2.*) + - Added support to play a video at 480p even if it's resolution is higher. Ex: [url] --480 - (v2.2.*) + - Added a nice feature which prints some informations about the video which you watching at - (v2.2.*) + - Added support to play videos by your order. Example: after search results, insert: 3 5 2 1 - (v2.1.*) + - Added support for next pages of video results (press ENTER when ask you to insert number) - (v2.1.*) + - Bug fixed: "Numbers go crazy after more than 20 video results". - (v2.1.*) + - Added support to continue playing searched videos, usage: "youtube-viewer [words] -p" - (v2.1.*) + - Added support to print counted videos and support to insert the number of video to play it - (v2.1.*) + - Added support to search YouTube Videos in script (ex: youtube-viewer avatar trailer 2009) - (v2.0.*) + - Added support for script to choose automat quality if it is lower than 1080p - (v2.0.*) + - Added support to choose the quality only between 720p and 1080p (if it is available) - (v2.0.*) + - Added support for an YouTube video code (ex: youtube-viewer WVTWCPoUt8w) - (v1.0.*) + - Added support for 720p and 1080p YouTube Videos... - (v1.0.*) + + Special thanks to: + - Army (for bugs reports and for his great ideas) + - dhn (for adding youtube-viewer in freshports.org) + + And also many thanks to: + - everybody who use this script... +=cut + +require LWP::UserAgent; + +$os = $^O; +if ($os =~ /MSWin/) { + $MPlayerLine = '"C:\\Program Files\\SMPlayer\\mplayer\\mplayer.exe" -prefer-ipv4 -cache 10000 -cache-min 1'; +} +else { + $MPlayerLine = 'mplayer -prefer-ipv4 -cache 100000 -cache-min 1'; +} +$lwp = 'LWP::UserAgent'->new; +$lwp->agent('Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.634.0 Safari/534.16'); +unless ($os =~ /MSWin/) { + $bred = "\e[1;31m"; + $bgreen = "\e[1;32m"; + $reset = "\e[0m"; +} +$a = $ARGV[0]; +$b = $ARGV[1]; +unless ($b) { + $b = ''; +} +unless ($a) { + $a = ''; +} +if ($a =~ /^(-v|--version)$/) { + $appname =~ s/-/ /; + $appname =~ s/(.)(.+) (.)/\U$1\E\L$2 \E\U$3\E/g; + print "$appname $version\n"; + exit; +} +my($Picks, $pickcat, $Search); +$PickBackup = ''; +$SearchBackup = ''; +$MoreResults = ''; +$FirstPage = 1; +$NextPage = 1; +$username = 0; +$pick = ''; +if ($a =~ /^(-a|--author)$/) { + @_ = ('4', '2', ')', ':', '%', '.'); + foreach $_ (@_) { + $@ = '@'; + $_ = $@ | $_; + &_; + sub _ { + $@ = $] * ($] * 3 + 1); + print '=' x $@ . "\n"; + } + print "\t" x $] . "\U$_\n\E"; + &_; + } + exit; +} +$Working = "\n[...] Working... Please wait...$reset\n"; +$app = $0; +$app =~ s[(.*)/([^/]+)$][$2]; +for ($n = 0; $n <= $#ARGV; ++$n) { + push @args, $ARGV[$n]; +} +if ($args[0]) { + foreach $arg (@args) { + next if $arg eq ''; + $arg =~ s/--novideo/-n/; + $arg =~ s/--categories/-c/; + $arg =~ s/^-([-]?)f(.*)/-f/; + if ($arg eq '-n') { + $MPlayerLine =~ s/mplayer /mplayer -novideo /; + $MPlayerLine =~ s/mplayer.exe"/mplayer.exe" -novideo/; + $SearchBackup = ' --480'; + } + if ($arg =~ /^-([-]?)([\d]+)/) { + $SearchBackup .= " $arg"; + } + if ($arg eq '-c') { + $categories = 'TRUE'; + } + if ($arg eq '-m' or $arg eq '-p') { + $MoreResults = 1; + } + else { + $MoreResults = 0; + } + if ($arg eq '-f') { + $SearchBackup .= " $arg"; + $MPlayerLine =~ s/mplayer /mplayer -fs /; + $MPlayerLine =~ s/mplayer.exe"/mplayer.exe" -fs/; + } + } +} +if ($a eq '' or $a =~ /^([-]?)-([471]+)|^-f|^-m|^-n/ and $b eq '') { + &InsertURL; +} +if ($a) { + $a =~ s[http://.*embed/][]i; + if ($a =~ m[^http://] and not $a =~ /youtube\.com/) { + $connect = $lwp->get($a); + if ($connect->content =~ m[youtube.com/v/([\w\-]{11})]) { + $youtube = "v=$1"; + &GetYouTube; + } + } +} +if ($a =~ /^-g([^\=]*)=([\w]+)/) { + $NextPage = 0; + $a = "http://www.youtube.com/music/$2"; + $Search .= ' '; +} +elsif ($a =~ /^-g$/ and $b =~ /([\w]*)/) { + $NextPage = 0; + $a = "http://www.youtube.com/music/$b"; + $Search .= ' '; +} +sub InsertURL { + print "\n$bred=>>$reset$bgreen Insert an YouTube URL or search something...\n$reset> "; + chomp($youtube = <STDIN>); + if ($youtube =~ m[^http://] and not $youtube =~ /youtube\.com/) { + $connect = $lwp->get($youtube); + if ($connect->content =~ m[youtube.com/v/([\w\-]{11})]) { + $youtube = "v=$1"; + &GetYouTube; + } + } + elsif (not $youtube =~ m[youtube.com(.+)v([\=/]+)([\w\-]{11})] and $youtube) { + $SearchBackup .= ' ' . $youtube; + $Search = $youtube; + $number = 0; + &Trizen; + } + elsif (not $youtube =~ /youtube.com(.+)([\w\-]{11})/) { + print $bred; + print "\n(x_x) Invalid URL...\n\n"; + print $reset; + exit; + } + else { + print $bgreen . ''; + &GetYouTube; + } +} +if ($categories) { + foreach $arg (@args) { + if ($arg =~ /^([\d]+)$/) { + $catnr = $1; + } + } + unless ($catnr) { + $catnr = ''; + } +} +if ($a =~ /youtube.com/ and not $a =~ m[v([=/]+)([\w\-]+)]) { + $c = 'TRUE'; + $CatURL = $a; + &CatSearch; +} +else { + $c = ''; +} +if ($a =~ /^-u/ and not $b =~ /(.+)/) { + die "\nUsage: $0 -u [username]\n\t$0 [username] -u\n\n"; +} +if ($a =~ /^-([-]*)u/ and $b =~ /(.+)/ or $b =~ /^-([-]*)u/) { + if ($b =~ /^-([-]*)u/) { + $b = $a; + } + $username = 1; + $NextPage = 0; + $ytp = "http://gdata.youtube.com/feeds/api/users/$b/uploads"; + $connect = $lwp->get($ytp); + $cc = $connect->content; + if ($cc eq 'User not found') { + die "\n(x_x) $cc...\n\n"; + } + $cc =~ s/\n//g; + $cc =~ s/<title type='text'>/\nTITLE=/g; + @content = split(?\n?, $cc, 0); + foreach $_ (@content) { + if ($_ =~ /TITLE\=/) { + $_ =~ s[TITLE\=([^\<]+)</title>(.+)v\=([\w\-]{11})(.+)duration([^\']*)'([\d\:]+)'(.+)][v=$3+title="$1">+video-time">$6]; + push @Videos, $_; + } + } + print "\n"; + &PrintResults; +} +if ($a =~ /^([-]?)-c/) { + if ($catnr =~ /(.+)/) { + print $bgreen . "$Working"; + } + if ($b =~ /([-]?)-([\d]+)/) { + $PickBackup = $b; + } + $NextPage = 0; + $connect = $lwp->get('http://www.youtube.com/videos'); + @cates = split(/\n/, $connect->content, 0); + foreach $_ (@cates) { + if ($_ =~ m[<a href=\"(.+)\">(.+)</a>([\ ]*)]) { + push @cats, "$1 -*- $2"; + } + } + $nbr = 0; + foreach $cat (@cats) { + unless ($cat =~ /\?v=|http|title=\"|style=\"|onclick=\"/) { + foreach $_ ($number = 0) { + $number = $nbr + 1; + $nbr = $number; + while ($cat =~ /\"/) { + $cat =~ s/(.+)"(.+)-\*-/$1 -*-/; + } + push @categories, "$number - $cat\n" unless $cat =~ m[/t/|class=]g; + } + } + } + print "\n"; + foreach $_ (@categories) { + next if $_ =~ m[/music|press_room]g; + if ($_ =~ /opt_out/) { + $caturl = 'http://www.youtube.com/videos'; + $catname = 'Main videos'; + $pick = '1'; + } + if ($_ =~ /([\d]+) - (.+) -\*- (.+)/ and not $_ =~ /opt_out/) { + $caturl = $2; + $catname = $3; + $pick = $1; + } + if ($catnr eq '' and $pick < 10) { + print "$bred $pick$reset - $catname\n$bred"; + } + else { + if ($catnr eq '' and not $caturl =~ /ads/) { + print "$bred$pick$reset - $catname\n$bred"; + } + } + } + if (not $catnr =~ /(.+)/) { + print $bgreen; + print "\n=>> Insert the number of a category\n> "; + print $reset; + chomp($pickcat = <STDIN>); + } + else { + $pickcat = $catnr; + } + foreach $cat (@categories) { + if ($cat =~ /^$pickcat - (.+) -\*- (.+)/) { + $catname = $1; + $youtube = "http://www.youtube.com$1"; + $catname =~ s/^(.+)\?(.+)/$2/; + $connect = $lwp->get($youtube); + @content = split(/\n/, $connect->content, 0); + } + } + &CatSearch; + sub CatSearch { + if ($c =~ /(.+)/) { + $connect = $lwp->get($CatURL); + @content = split(/\n/, $connect->content, 0); + } + foreach $_ (@content) { + $_ =~ s[\&\;feature\=([\w\-]+)|\"\ data\-thumb(.+)\.jpg|src="http://(.+)gif\"|click="" onmousedown="][]g; + if ($pickcat) { + unless ($pickcat =~ /16/) { + $_ =~ s/\="http([^\"]+)"|yt.analytics([^\;]+)\;|"src//g; + $_ =~ s/" alt\="([^\"]+)"([\ ]*)//g; + } + } + else { + $_ =~ s/" src="(.+)\.jpg//g; + } + $_ =~ s/" onload="tn_load\(\)" data-thumb alt="([^\"]+)\" |" onload="tn_load\(\)src|src=//g; + push @Videos, $_ if $_ =~ /^</; + } + print "\n"; + &PrintResults; + } + ; +} +if ($a =~ m[youtube.com(.+)v([\=/]+)([\w\-]{11})]) { + $youtube = "http://www.youtube.com/watch?v=$3"; + print $bgreen . "$Working"; + &GetYouTube; +} +if ($a =~ /^([\w\-]{11})$/) { + $youtube = 'http://www.youtube.com/watch?v=' . $a; + if ($a =~ /([\d]+)/ or $a =~ /([A-Z]+)/) { + &GetYouTube; + } +} +if ($a =~ /^-h$/ or $a =~ /^--help$/) { + $appname =~ s/(.+)/\U$1\E/g; + $app =~ s/(.*)\\([^\\]+)$/$2/; + die "\n\t" . '=' x 17 . " $appname " . '=' x 17 . qq[ +\t\t\t\t by Trizen (trizen.go.ro) + + Usage: $app || [url] || [words] || [code] + +Base Options: $app [...] + [url] : play an YouTube video by URL + [code] : play an YouTube video by code + [words] : search and play YouTube videos + +Other options: + -c, --categories : shows available YouTube categories + -n, --novideo : plays only audio track of the video + [words] -f : plays all videos in fullscreen mode + [words] -p : plays all video results in order + [words] -m : shows 3 pages of video results (60 videos) + [words] -n : plays only the audio track of video results + [words] -4, -7 : plays video results at 480p resolution (or 720p) + [ytURL] -4, -7 : plays an YouTube video by URL at 480p (or 720p) + [username] -u : lists videos from a YouTube user profile + -h, --help : outputs this message... + +Tips and tricks: + 1. Search something and press enter for the next page. + 2. Search and play all video results by adding "-p" after keywords. + 3. After search results, you can insert: 3 5 8 1 to play videos in your order + 4. Play all audio tracks of video results by adding "-p -n" after keywords. + 5. To listen music from YouTube use: "-c -n 10" and insert "all" + 6. Play videos one after one in fullscreen mode: "[words] -p -f" + 7. Play all video results at 480p: "[words] -p -4" (or 720p => "-7") + 8. Play all videos from a user at 480p: "[username] -u -4" and insert "all" + 9. Play a genre of music from YT: "-g [genre]". Example: "-g reggae -n" + +]; +} +elsif ($a =~ /^-p/) { + die "Usage: $app [words] $a\n"; +} +elsif (not $a =~ /^-([-]?)4|^-([-]?)7|^-g|^-p|^-n|^-([-]?)1|^-f|^-m/ and $a =~ /^-/) { + die "Unknown option '${a}'\n"; +} +$Search = join(' ', @args) . ' '; +&Trizen; +sub Trizen { + $PageNumber = 1; + $FirstPage = 1; + $SearchBackup .= ' ' . $Search; + $Search =~ s/\ ([-]?)-([\d]+)|\ -p|\ -m|\ ([-]?)-f([^\ ]*)|\ -n//g; + $ys = "http://www.youtube.com/results?search_query=$Search&aq=f"; + if ($MoreResults eq 1) { + $ys = "http://www.youtube.com/results?search_query=$Search&aq=f"; + $connect = $lwp->get($ys); + push @source, $connect->content . "\n"; + for ($number = 2; $number <= 3; ++$number) { + $ys = "http://www.youtube.com/results?search_query=$Search". + "&suggested_categories=10%2C24&page=$number"; + $connect = $lwp->get($ys); + push @source, $connect->content . "\n"; + } + $source = join('', @source); + @content = split(?\n?, $source, 0); + print "\n"; + } + else { + $connect = $lwp->get($ys); + @content = split(/\n/, $connect->content, 0); + if ($connect->content =~ m[class="largeText">(.+)<a href="/results\?search_query=(.+)&search=Search(.+)"(.+)</a></span></div>]) { + $spell = $4; + $research = "http://www.youtube.com/results?search_query=$2&search=Search"; + $spell =~ s[<i>|</i>|<b>|</b>|>|<][]g; + print "\n$bgreen=>> Did you mean: "; + print "$bred$spell$reset (Y/n)\n> "; + chomp($yn = <STDIN>); + if ($yn eq '' or $yn =~ /y/i) { + $connect = $lwp->get($research); + splice @content; + @content = split(/\n/, $connect->content, 0); + } + } + elsif ($connect->content =~ m[Results for: <a href="/results\?search_query=(.+)">(.+)</a>]) { + $research = "http://www.youtube.com/results?search_query=$1&search=Search"; + print "$bgreen\n=>> Did you mean: $bred$2$reset (Y/n)\n> "; + chomp($yn = <STDIN>); + if ($yn eq '' or $yn =~ /y/i) { + $connect = $lwp->get($research); + splice @content; + @content = split(/\n/, $connect->content, 0); + } + } + print "\n"; + } + &Search; +} +sub Search { + splice @Videos; + splice @codes; + foreach $_ (@content) { + if ($_ =~ m[^<a href="/watch\?v=]) { + $_ =~ s/\" data-thumb(.+)\.jpg//g; + push @Videos, $_; + } + } + &PrintResults; +} +sub PrintResults { + $number = 0; + foreach $_ (@Videos) { + chomp($line = $_); + if ($line =~ /v\=([\w\-]{11})(.*)title="([^\"]+)(.*)time\">([\d\:]*)/) { + ++$number; + $code = $1; + $title = $3; + $time = $5; + unless ($time =~ /\:/) { + $sec = $time; + $time = $sec / 3600 % 24 . ':' . $sec / 60 % 60 . ':' . $sec % 60; + $time =~ s/^0\://; + unless ($time =~ /\:/) { + $time = "0:$time"; + } + if ($time =~ /(.):(.):(.+)/) { + $time = "$1:0$2:$3"; + } + if ($time =~ /^(.+):(.)$/) { + $time = "$1:0$2"; + } + } + push @codes, "$number - $code $time"; + $title =~ s/\&\#39;/'/g; + $title =~ s/\&/&/g; + $title =~ s/\"/"/g; + $title =~ s/\&\#([\d]+);|amp;|quot;//g; + $title =~ s/src class=$|class=$//g; + print "$bred"; + if ($number < 10) { + print ' '; + } + print "$number$reset - $title ($time)\n$bred"; + } + } + if ($SearchBackup) { + if ($SearchBackup =~ /\ -p/) { + for ($i = 1; $i <= $number; ++$i) { + push @picks2, "$i "; + } + $youtube = join('', @picks2); + @picks = split(' ', $youtube, 0); + &PicksArea; + } + } + print "\n$bred=>>$reset$bgreen Insert a number or search something else\n$reset> "; + chomp($youtube = <STDIN>); + $PickBackup = $youtube; + if ($youtube =~ /^(q|quit|exit)$/) { + print "\n[*] Exiting...\n\n"; + exit; + } + if ($PickBackup =~ m[^http://] and not $PickBackup =~ /youtube\.com/) { + $connect = $lwp->get($PickBackup); + if ($connect->content =~ m[youtube.com/v/([\w\-]{11})]) { + $youtube = "v=$1"; + &GetYouTube; + } + } + if ($PickBackup =~ /([\d]+) ([-]?)-([\d]+)/) { + $youtube = $1; + } + print $bgreen . "$Working"; + if ($youtube =~ /^([\d]+)$/) { + if ($youtube > $number or $youtube eq 0) { + print "\n"; + &PrintResults; + } + } + if ($youtube =~ /^([\d]+)$/) { + $PICK = $1; + &ForeachCode; + } + if ($youtube eq '' and $NextPage eq 1) { + $PageNumber = $FirstPage; + ++$PageNumber; + print "\n[!]$bgreen Page:$reset $PageNumber\n"; + $SearchURL = "http://www.youtube.com/results?search_query=$Search". + "&suggested_categories=10%2C24&page=$PageNumber"; + $connect = $lwp->get($SearchURL); + splice @content; + @content = split(/\n/, $connect->content, 0); + print "\n"; + $FirstPage = $PageNumber; + &Search; + } + elsif ($NextPage eq 0 and $youtube eq '') { + print "\n"; + &PrintResults; + } + if ($youtube eq 'all') { + $SearchBackup .= ' --1080'; + splice @picks; + for ($i = 1; $i <= $number; ++$i) { + push @picks, "$i"; + } + &PicksArea; + } + if ($youtube =~ m[v([=/]+)([\w\-]{11})]) { + $youtube = "http://youtube.com/watch?v=$2"; + &GetYouTube; + } + if ($youtube =~ /([\d]+) ([\d]+)/) { + @picks = split(' ', $youtube, 0); + &PicksArea; + sub PicksArea { + $NrOfPicks = @picks; + $no = 0; + $lastpick = ''; + $number = 0; + &ForeachPick; + } + + sub ForeachPick { + for ($number = $no; $number <= $NrOfPicks; ++$number) { + $no = $number; + $pick = $picks[$number]; + next if $lastpick eq $pick; + &PrintResults if $number eq $NrOfPicks; + $Picks = 'TRUE'; + $lastpick = $pick; + &PlayBack; + } + } + ; + } + if ($youtube ne 'all' and $youtube =~ /(.+)/ and not $youtube =~ /^(q|quit|exit)$/) { + $Search = $youtube; + &Trizen; + } +} +sub PlayBack { + foreach $Code (@codes) { + if ($Picks eq 'TRUE' and not $Code =~ /^$pick - /) { + next; + } + elsif ($Code =~ /^$pick - ([\w\-]{11})(.*)/ and $Picks eq 'TRUE') { + $VideoCode = $1; + $duration = $2; + $youtube = "http://www.youtube.com/watch?v=$1"; + } + elsif ($Code =~ /(.+)([\w\-]{11})(.*)/ and $Picks ne 'TRUE') { + $VideoCode = $2; + $duration = $2; + $youtube = "http://www.youtube.com/watch?v=$2"; + } + &GetYouTube; + } +} +sub VideoCheck { + if (not $connect->content =~ /itag=34/ and $connect->content =~ /itag=([\d]+)([\W]+)/) { + $itag = $1; + $streaming =~ s/(.*)http(.+)itag=$itag([^\%]*)(.+)/http$2itag=$itag$3/; + unless ($SearchBackup =~ / ([-]?)-f/) { + $MPlayerLine =~ s/-fs //; + } + &Description; + &MPlayer; + } + if ($b =~ /^([-]?)-4/ or $PickBackup =~ / ([-]?)-4/ or $SearchBackup =~ / ([-]?)-4/) { + $streaming =~ s/(.*)http(.+)itag=34([^\%]*)(.+)/http$2itag=34$3/; + unless ($SearchBackup =~ / ([-]?)-f/) { + $MPlayerLine =~ s/-fs //; + } + &Description; + &MPlayer; + } + if ($b =~ /^([-]?)-7/ or $PickBackup =~ / ([-]?)-7/ or $SearchBackup =~ / ([-]?)-7/) { + if ($connect->content =~ /itag=22/) { + $streaming =~ s/(.*)http(.+)itag=22([^\%]*)(.+)/http$2itag=22$3/; + $MPlayerLine =~ s/mplayer -p/mplayer -fs -p/; + $MPlayerLine =~ s/mplayer.exe" -p/mplayer.exe" -fs -p/; + &Description; + &MPlayer; + } + else { + unless ($SearchBackup =~ / ([-]?)-f/) { + $MPlayerLine =~ s/-fs //; + } + $streaming =~ s/(.*)http(.+)itag=34([^\%]*)(.+)/http$2itag=34$3/; + &Description; + &MPlayer; + } + } + if ($b =~ /^([-]?)-1/ or $PickBackup =~ / ([-]?)-1/ or $SearchBackup =~ / ([-]?)-1/) { + if ($connect->content =~ /fmt_list=37/) { + $streaming =~ s/(.*)http(.+)itag=37([^\%]*)(.+)/http$2itag=37$3/; + $MPlayerLine =~ s/mplayer -p/mplayer -fs -p/; + $MPlayerLine =~ s/mplayer.exe" -p/mplayer.exe" -fs -p/; + &Description; + &MPlayer; + } + elsif ($connect->content =~ /itag=22/) { + $streaming =~ s/(.*)http(.+)itag=22([^\%]*)(.+)/http$2itag=22$3/; + $MPlayerLine =~ s/mplayer -p/mplayer -fs -p/; + $MPlayerLine =~ s/mplayer.exe" -p/mplayer.exe" -fs -p/; + &Description; + &MPlayer; + } + else { + unless ($SearchBackup =~ / ([-]?)-f/) { + $MPlayerLine =~ s/-fs //; + } + $streaming =~ s/(.*)http(.+)itag=34([^\%]*)(.+)/http$2itag=34$3/; + &Description; + &MPlayer; + } + } + &Description; + &ResolutionSearch; +} +sub Description { + if ($connect->content =~ /likes\">([\d\.\,]+)(.+)dislikes\">([^\<]+)/) { + $like = $1; + $dislike = $3; + } + if ($connect->content =~ m[video-date" >([\ ]*)\n([\t\ ]*)(.+)\n([\ ]*)</span>]) { + $date = $3; + $date =~ s[<span>(.+)</span>][]; + } + if ($connect->content =~ /<meta name="title" content="(.+)">/) { + $title = $1; + $title =~ s/\&quot;/"/g; + $title =~ s/\&amp;/&/g; + $title =~ s/\&\#39;/'/g; + $title =~ s/\&\#([\d]+);//g; + } + print "\n$bred=>> $reset"; + print $bgreen; + print "$title\n"; + print $reset; + print '-' x 80; + if ($connect->content =~ m[description" >(.*)</p>]) { + $desc = $1; + $desc =~ s[<em>|</em>][]g; + $desc =~ s[<br\ />|<br/>][\n]g; + $desc =~ s[<a\ href\=\"\#\"\ onclick\=\"yt\.www\.watch\.player\.seekTo\((.+)\);return\ false;\">|<a\ href\=\"(.+)\"\ target\=\"\_blank\"\ title\=\"|\"\ rel\=\"nofollow\"\ dir="ltr\"\ class\=\"(.*)\">(.+)</a>|<wbr />|</a>|<wbr>\­|<wbr>][]g; + $desc =~ s/\"/"/g; + $desc =~ s/&/&/g; + $desc =~ s/\&\#39;/'/g; + $desc =~ s/\&\#([\d]+);//g; + print "\n$desc\n"; + } + print '-' x 80 . "\n"; + print "$bred=>> $reset"; + print $bgreen; + print "View & Download\n"; + print $reset; + print '-' x 80; + $get = $streaming; + $get =~ s/http:([^\%]+)(.*)/http:$1/; + $get =~ s/(.*)http/http/; + $get =~ s/\\//g; + print "\n* URL $url\n"; + print "* GET $get\n"; + print '-' x 80 . "\n"; + $count = $title =~ s/(.)/$1/gs; + if ($count <= 40) { + print "$bred\t\t=>> "; + } + elsif ($count >= 40 and $count <= 55) { + print "$bred\t=>> "; + } + elsif ($count >= 56) { + print "$bred =>> "; + } + print $bgreen; + print "$title"; + print $reset; + print "$bred <<=\n"; + print $reset; + if ($connect->content =~ m[href="/user/([\w\-]+)"><strong>]) { + print "\n* Uploaded by $1\n"; + } + if ($duration) { + print "* Duration:$duration\n"; + } + if ($connect->content =~ m[<strong>([\d\,]+)</strong>]) { + print "* Views: $1\n"; + } + if ($date =~ /(.+)/) { + print "* Date: $date\n"; + } + if ($like =~ /(.+)/) { + print "* Likes: $like+; Dislikes: $dislike-\n"; + } + print '-' x 80 . "\n\n"; +} +sub MPlayer { + $streaming =~ s/%(.+)$//; + `$MPlayerLine "$streaming"`; + print "\n"; + if ($Picks) { + if ($Picks eq 'TRUE') { + &ForeachPick; + } + } + if ($Search or $a =~ /^([-]?)-c/ or $username eq 1) { + &PrintResults; + } + exit; +} +sub ForeachCode { + foreach $code (@codes) { + if ($code =~ /^$PICK - ([\w\-]{11})(.*)/) { + $code = $1; + $duration = $2; + $youtube = 'http://www.youtube.com/watch?v=' . $code; + $url = $youtube; + } + } + &GetYouTube; +} +sub GetYouTube { + if ($youtube =~ m[v([=/]+)([\w\-]{11})]) { + $VideoCode = $2; + $youtube = 'http://www.youtube.com/watch?v=' . $2; + } + $Count = $VideoCode =~ s/(.)/$1/gs; + if ($Count ne 11) { + print "\n$bred(x_x) Invalid URL...$reset\n\n"; + exit; + } + unless ($youtube =~ /^http:/) { + $youtube = 'http://' . $youtube; + } + $connect = $lwp->get($youtube); + $url = $youtube; + if ($connect->content =~ /fmt_url_map=([^\&]+)\&/) { + $streaming = $1; + $streaming =~ s/%3A/:/gi; + $streaming =~ s[%2F][/]gi; + $streaming =~ s/%26/&/g; + $streaming =~ s/%3D/=/gi; + $streaming =~ s/%3F/?/gi; + $streaming =~ s/%252C/,/gi; + &VideoCheck; + } + else { + $unable = "$bred(x_x) Unable to play: $reset$url\n"; + print $bred; + print "\n(x_x) Something went wrong...\n\n"; + print $reset; + if (not $SearchBackup =~ / -p/ or $NrOfPicks eq '') { + print "$unable\n"; + } + if ($Search =~ /(.+)/) { + unless ($SearchBackup =~ / -p/) { + sleep 1; + &PrintResults; + } + } + else { + exit; + } + } + if ($streaming =~ /(.+)/) { + &Description; + } + else { + print $unable; + } + &ResolutionSearch; +} +sub ResolutionSearch { + if ($connect->content =~ /fmt_list=37/ and not $SearchBackup =~ / -p/) { + &pick; + } + elsif ($SearchBackup =~ /-p/) { + if ($connect->content =~ /fmt_list=37/) { + $streaming =~ s/(.*)http(.+)itag=37([^\%]*)(.+)/http$2itag=37$3/; + $MPlayerLine =~ s/mplayer -p/mplayer -fs -p/; + $MPlayerLine =~ s/mplayer.exe" -p/mplayer.exe" -fs -p/; + &Description; + &MPlayer; + } + } + if ($connect->content =~ /itag=22/) { + $streaming =~ s/(.*)http(.+)itag=22([^\%]*)(.+)/http$2itag=22$3/; + $MPlayerLine =~ s/mplayer -p/mplayer -fs -p/; + $MPlayerLine =~ s/mplayer.exe" -p/mplayer.exe" -fs -p/; + &MPlayer; + } + else { + $streaming =~ s/(.*)http(.+)itag=34([^\%]*)(.+)/http$2itag=34$3/; + unless ($SearchBackup =~ / ([-]?)-f/) { + $MPlayerLine =~ s/-fs //; + } + &MPlayer; + } +} +sub pick { + print "$bred=>>$reset $bgreen Please choose quality of video (default: 1)$reset\n\n"; + print " $bred 1$reset - 1280x720 (720p)\n $bred 2$reset - 1920x1080 (1080p)\n "; + print '=' x 23 . "\n"; + print $bgreen; + print "\n=>> Pick format: "; + print $reset; + chomp($pick = <STDIN>); + print '-' x 80 . "\n\n"; + if ($pick ne 2) { + $streaming =~ s/(.*)http(.+)itag=22([^\%]*)(.+)/http$2itag=22$3/; + $MPlayerLine =~ s/mplayer -p/mplayer -fs -p/; + $MPlayerLine =~ s/mplayer.exe" -p/mplayer.exe" -fs -p/; + &MPlayer; + } + if ($pick eq 2) { + $streaming =~ s/(.*)http(.+)itag=37([^\%]*)(.+)/http$2itag=37$3/; + $MPlayerLine =~ s/mplayer -p/mplayer -fs -p/; + $MPlayerLine =~ s/mplayer.exe" -p/mplayer.exe" -fs -p/; + &MPlayer; + } +} |