If you ever want to open a Jupyter notebook that you’re reading in Github you can simply replace the URL from github.com to colab.research.google.com/github and the rest of the address. This will open the IPYNB in Colab for easy saving and editing.
Monthly Archives: February 2022
Saving your Audible books to MP3 using Python, Colab, and AAXtoMP3
If you’re like me and you don’t like having your audiobooks tied up in Audible. There is a way to convert them to MP3.
I wrote some Python code in Google Colab to show this process.
The first thing you’ll want to do is mount Google drive so you have access to your files. This can be done here.
Your working_folder is the location in your Google drive that the files will be backed up to.
working_folder = 'Books/audible_backup'
# <----- Make sure to mount drive in Colab first
import os
import sys
if 'google.colab' in str(get_ipython()):
print('Running on CoLab')
root_dir='/content/drive/My Drive/' + working_folder
if os.path.isdir(root_dir):
%cd $root_dir
else:
print('Check your working_folder or if Google drive is mounted')
sys.exit()
sys.path.append(root_dir)
print('Colab code has been executed')
else:
print('Not running on Colab')
Here is my Google Drive mounted in Windows for comparison
Install the dependencies
!apt-get update
!apt-get install ffmpeg libav-tools x264 x265 bc
!apt-get install mediainfo
!pip install audible
!pip install audible-cli
!pip install ffmpeg
!apt-get install mp4v2-utils
!apt-get install jq
!apt-get install bc
!add-apt-repository ppa:savoury1/ffmpeg4
!apt-get update
!apt-get install ffmpeg
!ffmpeg -version
!apt-get install mp4v2-utils
import os
Run audible-quickstart to attach your Audible account.
!audible-quickstart
Now we’re going to make a backup of all of your audiobooks in AAX and AAXC format.
%cd /content/drive/My Drive/Books/audible_backup
!audible download --all --aax --cover --cover-size 1215 --chapter
!audible download --all --aaxc --cover --cover-size 1215 --chapter
Once you clone all your books to AAX and AAXC files in Google Drive it should look like this.
Now we need your AUTHCODE for your AAX files.
AUTHKEY = !audible activation-bytes
AUTHKEY = AUTHKEY[0]
print(AUTHKEY)
Next, we’ll clone a tool from Github called AAXtoMP3 and make sure it has executable permissions. This tool does all the heavy lifting.
%cd /root
!git clone https://github.com/KrumpetPirate/AAXtoMP3.git
%cd /root/AAXtoMP3
!chmod u+x /root/AAXtoMP3/interactiveAAXtoMP3
!chmod u+x /root/AAXtoMP3/AAXtoMP3
Now that you’ve cloned AAXtoMP3 you can run the following code:
%cd '/content/drive/My Drive/Books/audible_backup'
for filename in os.listdir('/content/drive/My Drive/Books/audible_backup'):
if filename.endswith('.aaxc'):
print(filename)
os.system(f'/root/AAXtoMP3/AAXtoMP3 -e:mp3 --level 4 -c -l 1 -n {filename}')
if filename.endswith('.aax'):
print(filename)
os.system(f'/root/AAXtoMP3/AAXtoMP3 -e:mp3 --level 4 -c -A {AUTHKEY} -l 1 {filename}')
Lords of Easy Money and Thomas Hoenig
The FED’s decisions affect every asset you own all the way down to the cost of your everyday grocery purchases. I highly recommend Lords of Easy Money by Christoper Leonard. I would also recommend reading and listening to Thomas M. Hoenig’s positions on the FED policy. He served as the President of the Federal Reserve Bank of Kansas City from 1991 to 2011. This book dives into Thomas Hoenig’s dissenting votes on the FOMC and confirms that the current FED policy is a radical experiment in monetary policy. It has increased wealth inequality by driving up asset prices. Meaning, the people who own assets are getting much wealthier and those who don’t are becoming poorer. It also speaks on the current inflation that we are seeing all around us. There is no easy path out of our current situation.