CC-2452: Incorrect Length(time) reported...
- Patches are now included in the patches folder under install_minimal - airtime_install script will apply patches after installing python libraries.
This commit is contained in:
parent
5cd2a3a06c
commit
0678063791
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
echo -e "\n******************************** Install Begin *********************************"
|
echo -e "\n******************************** Install Begin *********************************"
|
||||||
|
|
||||||
|
# Absolute path to this script
|
||||||
|
SCRIPT=`readlink -f $0`
|
||||||
|
# Absolute directory this script is in
|
||||||
|
SCRIPTPATH=`dirname $SCRIPT`
|
||||||
|
|
||||||
VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv"
|
VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv"
|
||||||
if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
|
if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
|
||||||
echo -e "\n*** Creating Vitualenv for Airtime ***"
|
echo -e "\n*** Creating Vitualenv for Airtime ***"
|
||||||
|
@ -13,6 +18,17 @@ fi
|
||||||
echo -e "\n*** Installing Python Libraries ***"
|
echo -e "\n*** Installing Python Libraries ***"
|
||||||
sudo /usr/lib/airtime/airtime_virtualenv/bin/pip install airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv
|
sudo /usr/lib/airtime/airtime_virtualenv/bin/pip install airtime_virtual_env.pybundle -E /usr/lib/airtime/airtime_virtualenv
|
||||||
|
|
||||||
|
echo -e "\n*** Patching Python Libraries ***"
|
||||||
|
PACHES=${SCRIPTPATH}/patches/*
|
||||||
|
for file in $(find $PACHES -print); do
|
||||||
|
if [ -d $file ]; then
|
||||||
|
DIRNAME=$(basename $file)
|
||||||
|
echo -e "\n ---Applying Patches for $DIRNAME---"
|
||||||
|
else
|
||||||
|
sudo patch -N -p0 -i $file
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd
|
||||||
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
. ${virtualenv_bin}activate
|
. ${virtualenv_bin}activate
|
||||||
|
|
||||||
|
@ -20,11 +36,6 @@ virtualenv_bin="/usr/lib/airtime/airtime_virtualenv/bin/"
|
||||||
#return with a non-zero return value.
|
#return with a non-zero return value.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Absolute path to this script
|
|
||||||
SCRIPT=`readlink -f $0`
|
|
||||||
# Absolute directory this script is in
|
|
||||||
SCRIPTPATH=`dirname $SCRIPT`
|
|
||||||
|
|
||||||
echo -e "\n*** Creating Pypo User ***"
|
echo -e "\n*** Creating Pypo User ***"
|
||||||
python ${SCRIPTPATH}/../python_apps/create-pypo-user.py
|
python ${SCRIPTPATH}/../python_apps/create-pypo-user.py
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
Index: /usr/lib/airtime/airtime_virtualenv/lib/python2.6/site-packages/mutagen/mp3.py
|
||||||
|
===================================================================
|
||||||
|
--- /usr/lib/airtime/airtime_virtualenv/lib/python2.6/site-packages/mutagen/mp3.py (revision 108)
|
||||||
|
+++ /usr/lib/airtime/airtime_virtualenv/lib/python2.6/site-packages/mutagen/mp3.py (working copy)
|
||||||
|
@@ -151,15 +151,16 @@
|
||||||
|
self.sample_rate = self.__RATES[self.version][sample_rate]
|
||||||
|
|
||||||
|
if self.layer == 1:
|
||||||
|
- frame_length = (12 * self.bitrate / self.sample_rate + padding) * 4
|
||||||
|
+ padding *= 4
|
||||||
|
frame_size = 384
|
||||||
|
elif self.version >= 2 and self.layer == 3:
|
||||||
|
- frame_length = 72 * self.bitrate / self.sample_rate + padding
|
||||||
|
frame_size = 576
|
||||||
|
else:
|
||||||
|
- frame_length = 144 * self.bitrate / self.sample_rate + padding
|
||||||
|
frame_size = 1152
|
||||||
|
|
||||||
|
+ frame_length = frame_size / 8 * \
|
||||||
|
+ self.bitrate / self.sample_rate + padding
|
||||||
|
+
|
||||||
|
if check_second:
|
||||||
|
possible = frame_1 + frame_length
|
||||||
|
if possible > len(data) + 4:
|
||||||
|
@@ -172,9 +173,7 @@
|
||||||
|
if frame_data & 0xFFE0 != 0xFFE0:
|
||||||
|
raise HeaderNotFoundError("can't sync to second MPEG frame")
|
||||||
|
|
||||||
|
- frame_count = real_size / float(frame_length)
|
||||||
|
- samples = frame_size * frame_count
|
||||||
|
- self.length = samples / self.sample_rate
|
||||||
|
+ self.length = 8 * real_size / float(self.bitrate)
|
||||||
|
|
||||||
|
# Try to find/parse the Xing header, which trumps the above length
|
||||||
|
# and bitrate calculation.
|
|
@ -0,0 +1,20 @@
|
||||||
|
Index: /usr/lib/airtime/airtime_virtualenv/lib/python2.6/site-packages/mutagen/mp3.py
|
||||||
|
===================================================================
|
||||||
|
--- /usr/lib/airtime/airtime_virtualenv/lib/python2.6/site-packages/mutagen/mp3.py (revision 108)
|
||||||
|
+++ /usr/lib/airtime/airtime_virtualenv/lib/python2.6/site-packages/mutagen/mp3.py (working copy)
|
||||||
|
@@ -209,15 +209,6 @@
|
||||||
|
bytes = struct.unpack('>I', data[xing + 12:xing + 16])[0]
|
||||||
|
self.bitrate = int((bytes * 8) // self.length)
|
||||||
|
|
||||||
|
- # If the bitrate * the length is nowhere near the file
|
||||||
|
- # length, recalculate using the bitrate and file length.
|
||||||
|
- # Don't do this for very small files.
|
||||||
|
- fileobj.seek(2, 0)
|
||||||
|
- size = fileobj.tell()
|
||||||
|
- expected = (self.bitrate / 8) * self.length
|
||||||
|
- if not (size / 2 < expected < size * 2) and size > 2**16:
|
||||||
|
- self.length = size / float(self.bitrate * 8)
|
||||||
|
-
|
||||||
|
def pprint(self):
|
||||||
|
s = "MPEG %s layer %d, %d bps, %s Hz, %.2f seconds" % (
|
||||||
|
self.version, self.layer, self.bitrate, self.sample_rate,
|
Loading…
Reference in New Issue