#!/bin/sh
# Copyright (C) 2008 - 2012 vortexbox.org
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

yum clean all
yum -y --enablerepo=atrpms install mplayer faad2 mac faac ffmpeg

mkdir -p /usr/lib/win32
cd /var/tmp
wget http://www1.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
bzip2 -cd essential-20071007.tar.bz2 | tar xvf -
rm essential-20071007.tar.bz2
cp essential-20071007/* /usr/lib/win32
rm -rf essential-20071007

ln -s /usr/lib/win32 /usr/lib/codecs

cd /var/tmp
wget http://yum.vortexbox.org/fix/wmastuff.tar.gz
tar xvfz wmastuff.tar.gz
rm /var/tmp/wmastuff.tar.gz

mv /var/tmp/wmamplayer.sh  /var/lib/squeezeboxserver/cache/InstalledPlugins/Plugins/PlayWMA/Bin/
mv /var/tmp/custom-convert.conf /etc/squeezeboxserver/

chown  squeezeboxserver:squeezeboxserver /etc/squeezeboxserver/custom-convert.conf
chown  squeezeboxserver:squeezeboxserver /var/lib/squeezeboxserver/cache/InstalledPlugins/Plugins/PlayWMA/Bin/wmamplayer.sh
chmod 700 /var/lib/squeezeboxserver/cache/InstalledPlugins/Plugins/PlayWMA/Bin/wmamplayer.sh

service squeezeboxserver restart