Skip to content

Collection Creation

project-owner edited this page Feb 18, 2020 · 5 revisions

The SQLite database is a lightweight and efficient way to store the metadata info. It saves data in a single file. The SQLite database is available in all latest Python releases. There is no need to install it separately.

The Peppy Player Collection can be created by running Python script collector.py. The script can be executed on any machine/platform (Linux, Windows or Mac). The collection database file is the result of running the script. The name and extension of that file is arbitrary. For example it can be named peppy.db, jazz.db or just rock.

The easiest way to create the Collection database file is to use Raspberry Pi with one of the Peppy Player disk images as all required software was installed and configured. But this is not recommended way for Collection creation especially if the database file will be created on SD card. The process can degrade SD card because of multiple disk write operations especially if you have large collection (many audio files). It's highly recommended to use any other machine which doesn't have the flash storage (e.g. Windows or Mac desktop/laptop with HD or SSD disks).

In order to run the collector.py script the following software should be available on the machine where the script will be executed:

  1. Python - the Python interpreter is required to run any Python script. It can be downloaded from this web site
  2. collector.py - the script itself, it collects the metadata from audio files and saves it in the database file. The script can be found in the Peppy Player in folder /home/pi/Peppy/util/collector.py. It can be also downloaded from github
  3. Mutagen library - this Python library is required for fetching metadata (genre, album, artist etc) from audio files. It can be installed by running the following command on Linux:
pip3 install mutagen

on Windows:

python -m pip install mutagen

Here is the screenshot which shows the possible commands and parameters of the collector.py script:

collection-3

The main script commands are:

  1. files - this command can be used before collection creation to estimate the time which the process will take.
  2. create - this is the main command which creates collection database
  3. db - this command shows database statistics

The following screenshot shows the example of running the collector.py script with files command on Windows machine for the folder with audio files collection c:\music.

collection-4

The next image shows the example of running the collector.py script with create command. It takes one parameter for input folder (c:\music) and the other parameter is the name of the database file (c:\collection\peppy4.db).

collection-5

The result of the Collection creation process is the database file (for example peppy4.db in the example above). The next wiki page will explain how to use that file.

<<Previous | Next>>

Contents

Clone this wiki locally