-
Notifications
You must be signed in to change notification settings - Fork 19
/
aax2mp3_easy.sh
executable file
·79 lines (68 loc) · 2.36 KB
/
aax2mp3_easy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
LOGIN=$1
PASSWORD=$2
FILES=$3
# Check if the number of arguments is equal or greater than 3.
if [ "$#" -lt 3 ]; then
echo "Illegal number of parameters, expecting at least 3. Usage:"
echo -e " $ bash aax2mp3_easy.sh <audible_login> <audible_password> <files_to_be_converted.aax> \n"
exit 1
fi
#------------------
# Set-up AAXtoMP3
#------------------
if [ ! -d "AAXtoMP3-master" ]; then
echo "Downloading AAXtoMP3..."
brew install wget
wget https://github.com/KrumpetPirate/AAXtoMP3/archive/master.zip -O aaxtomp3.zip
unzip aaxtomp3.zip
rm aaxtomp3.zip
brew install ffmpeg
brew install gnu-sed
brew install grep
brew install mp4v2
fi
#--------------------------
# Set-up Audible-Activator
#--------------------------
if [ ! -d "audible-activator-master" ]; then
echo "Downloading audible-activator..."
brew install wget
wget https://github.com/paladini/audible-activator/archive/master.zip -O audible-activator.zip
unzip audible-activator.zip
rm audible-activator.zip
echo "Downloading Chrome-Driver-Latest..."
if [ $(uname) == "Darwin" ]; then
# Install Chrome-Driver for OSX
brew cask install chromedriver
ln -fs `which chromedriver` chromedriver
else
brew install wget
# Install Chrome-Driver for Linux
wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -O chromedriver-latest-release.txt
LATEST_CHROMEDRIVER_VERSION=$(cat chromedriver-latest-release.txt)
# Detect if system is 64 bits or 32 bits
if [ $(uname -m) == 'x86_64' ]; then
wget https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER_VERSION/chromedriver_linux64.zip -O chrome-driver-latest.zip
else
wget https://chromedriver.storage.googleapis.com/$LATEST_CHROMEDRIVER_VERSION/chromedriver_linux32.zip -O chrome-driver-latest.zip
fi
unzip chrome-driver-latest.zip
rm chrome-driver-latest.zip
fi
# Downloading prerequisites (Requests, Selenium)
if [ ! $(command -v pip) ]; then
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
fi
sudo pip install requests
sudo pip install selenium
fi
#--------------------------
# Getting activation code
#--------------------------
ACTIVATION=$(python audible-activator-master/audible-activator.py -d --username=$LOGIN --password=$PASSWORD | tail -1)
#--------------------------
# Converting files
#--------------------------
bash AAXtoMP3-master/AAXtoMP3 -A $ACTIVATION $FILES