2. New Functionality

This consists of newer functionality that does not download NPR episodes, nor can one straightforwardly modify them to download NPR episodes.

2.1. convertImage_youtube

convertImage_youtube converts a YouTube clip into an animated GIF. It first creates an MP4 file, and then converts that MP4 file into an animated GIF. Its help screen, when running convertImage_youtube -h, is,

usage: convertImage_youtube [-h] [--noverify] [--info] -u url -o output
                            [-q quality] [-d duration] [-s scale]

Creates an animated GIF from a YouTube clip!

optional arguments:
  -h, --help            show this help message and exit
  --noverify            If chosen, do not verify the SSL connection.
  --info                If chosen, then print out INFO level logging.
  -u url, --url url     YouTube URL of the input video.
  -o output, --output output
                        Name of the output animated GIF file that will be
                        created.
  -q quality, --quality quality
                        The quality of the YouTube clip to download. Only
                        video portion is downloaded. May be one of highest,
                        high, medium, low. Default is highest.
  -d duration, --duration duration
                        Optional argument. If chosen, the duration (in
                        seconds, from beginning) of the video to be converted
                        into an animated GIF.
  -s scale, --scale scale
                        Optional scaling of the input video. Default is 1.0.

The two required arguments are -u or --url (the YouTube URL of the input video), and -o or --output for the name of the output animated GIF. There are five optional arguments,

  • -q or --quality specifies the quality of the YouTube clip to download. May be one of highest, high, medium, or low. The default is highest.

  • -d or --duration specifies the duration (in seconds, from the beginning) of the video to convert into an animated GIF. If you don’t specify, then it will use the whole video.

  • -s or --scale resizes the width and height of the intermediate MP4 file by some number. Its default is 1.0, and it must be greater than zero.

  • --info prints out INFO level logging output.

  • --noverify ignores verification of SSL transactions. It is optional and defaults to False.

So for example, we take this fun clip from the Lucas Bros. Moving Co., which we show below,

And run this command,

convertImage youtube -u "https://www.youtube.com/watch?v=R-pmYwr8zbU" -o "lucas_bros.gif" -q highest -s 0.5

to generate a highest quality animated GIF, scaled to half the original size of the YouTube clip, into Fig. 2.1 (17M in size).

_images/lucas_bros.gif

Fig. 2.1 One of my favorite scenes from Lucas Bros. Moving Co. S01E03: Before & After Models. I giggle each time I see it.

2.2. music_to_m4a

music_to_m4a can convert a single file from MP3, OGG, or FLAC format to M4A format while preserving music file metadata, and can optionally set the total number of album tracks and the album cover if the music files is in an album. It can also rename an m4a music file into the format “artist name - song name.m4a.” The help screen for this command line tool is here,

usage: music_to_m4a [-h] --inputfile INPUTFILE [--outfile OUTFILE] [--tottracks TOTTRACKS] [--albumloc ALBUMLOC] [--quiet] [--rename] [--notitle]

optional arguments:
  -h, --help            show this help message and exit
  --inputfile INPUTFILE
                        Name of the input audio file to convert.
  --outfile OUTFILE     Optional name of the output file.
  --tottracks TOTTRACKS
                        Optional total number of tracks in album of which song is a part.
  --albumloc ALBUMLOC   Optional path to location of the album cover image file. Must be in JPEG or PNG.
  --quiet               If chosen, then verbosely print output of processing.
  --rename              If chosen, simply rename the m4a file to the form <artist>.<song title>.m4a
  --notitle             If chosen, do not use titlecase functionality to fix the titles of songs.

2.3. download_surahs

download_surahs downloads recorded surahs (Abdur-Rashid Sufi) to a directory of your choice. The help screen for this command line tool is here,

usage: download_surahs [-h] [--outdir OUTDIR]

optional arguments:
  -h, --help       show this help message and exit
  --outdir OUTDIR  Directory to put this data into. Default is /mnt/software/sources/pythonics/nprstuff.