/pyAudioFYTB

from a list of song to audio files on disk

Primary LanguagePython

pyAudioFYTB

from a list of song to audio files on disk. The objective is to transform a shopping list of songs (text format) to a directory of audio files (mp3 with title and album metadata) on disk.

overall processing

  1. read the input text file
  2. for each line of the file, a youtube search is started to check if a video clip or simple audio is available, then get the link of the file
  3. get file details
  4. download the file on disk
  5. extract audio and convert to mp3
  6. delete temporary files (video, convertion data)
  7. add to a playlist

APIs world

google API

searching using google api, you need a developper key, see https://developers.google.com/api-client-library/python/guide/aaa_apikeys https://developers.google.com/youtube/v3/code_samples/python https://developers.google.com/youtube/v3/code_samples/python#search_by_keyword

pytube

https://github.com/nficano/pytube pytube is a lightweight, dependency-free Python library (and command-line utility) for downloading YouTube Videos. the starting point si to get a link to the video to use this code. http://youtube.com/watch?v=9bZkp7q19f0

Planning

  • start it
  • use python 3.x
  • overall objectives and specification
  • run on windows
  • use pytest
  • test pytube
  • test google api
  • manage python unit test
  • first python code extracts mp4 files
  • run test using a list of 116 songs
  • filter extra characters in the input list for robustness
  • second python code extracts mp4 files and convert to mp3
  • test playlist type search to get id of the playlist and get all the videos links using playlist items
  • update code to manage playlist and playlist items [branch + pull request]
  • test using known playlists of 50, 100 items
  • test using bigger playlists
  • wip
  • run on linux
  • run on mac OS
  • dockers ?

Install

  • Windows

    python:
    https://www.python.org/downloads/release/python-364/

    ffmpeg:
    https://ffmpeg.zeranoe.com/builds/
    (select static for 32 or 64 bit)

    google api:
    pip install --upgrade google-api-python-client

    six:
    pip install --upgrade six

    progress bar:
    pip install --upgrade tqdm

    httplib2:
    pip3 install httplib2 --upgrade

    google dev key:
    https://docs.simplecalendar.io/google-api-key/

    progress bar:
    pip install tqdm --upgrade

    urllib:
    pip3 install urllib3 --upgrade

    typical command line, don't define a path for the playlist, it will be stored in the audio output directory

    <yourpath>\python.exe <yourpath>\pyAudioMain.py --inputlist <yourpath>\myinput.txt --devkey <yourgooglekey> --audiooutdir <yourpath> --playlist mytestplaylist.m3u8

  • Linux

    wip

  • Mac OS

    wip