Coder Social home page Coder Social logo

audio-archiver's Introduction

Audio Archiver

Audio Archiver is a PHP script which deals with the archiving of your music library. Our music record collections are often comprised by folders originating from various sources. This results in file name, audio metadata and format/bitrate inconsistencies. This program takes over the chore of manually standardizing your audio files and folders by automating this process.

Program Specifications

Audio Archiver performs the following tasks:

  1. Backs up the target folder (optional)
  2. Scans the target folder for subfolders (records) that contain audio files (tracks)
  3. Renames the track file names and record folders according to a specified format. Examples using the default format settings:
  • Us Or THeM - 2005 record will be formatted to (2005) Us or Them
  • 03-waltz for the fallen.mp3 track will be formatted to 03 Waltz for the Fallen.mp3
  1. Fills empty track metadata with the information available and also formats them according to a specified conversion
  2. Converts tracks to .mp3 format (optional). The bitrate is specified through the program's settings
  3. Creates an archiver_log_${currentData}.txt log file with information about the program's execution.

The program's algorithm detects record and track information such as name, artist, release year etc by using various methods, including parsing the file/folder names and using the existing audio file metadata.

Running

In order to run the script, first copy/clone the program repo and then run the following commands in your terminal:

$ cd {installFolder}
$ php audio_archiver [-options] ${targetFolder}

where targetFolder is the folder containing your audio folders/files.

Available Options

  • -b: Creates a back up of targetFolder
  • -c: Converts the scanned audio files according to the provided settings. The format used is .mp3
  • -d: Debug mode on
  • -s ${settingsFile}: Loads the specified .ini settings file

Settings

You can provide custom settings for your program by loading a .ini file using the -s option:

$ php audio_arhiver -s ${settingsFile} ${targetFolder}

In the repo you can find an example of a settings file. The available settings with their default values are listed bellow:

Category Name Default Value Description
audio bitrate 192 The bitrate in kbps that will be used in the audio file conversion
format lowercase a,and,but,for,in,on,the,to A comma separated string specifying which words should not be capitalized during file/folder name and metadata formatting
track[title] %n{2} %t The format that will be used for the audio file names. See delimiters
record[title] (%y{4}) %r The format that will be used for the record folder names. See delimiters

Delimiters

Delimiters are used as generic variables for track/record name formatting. Each delimiter is translated to a record/track metadata element, eg %a denotes the album's artist. The available delimiters are the following:

Delimiter Type Translation
%a string Album artist
%n{x} numeric Track number
%r string Album title
%t string Track title
%y{x} numeric Album year

Numeric delimiters

There are two types of delimiters: string and numeric. For delimiters of numeric type, an optional integer can be enclosed in {} to denote the digits that will be used for representing the number.

For this integer the following rules apply:

  • The last digits of a number are kept
  • In case the number is smaller than the specified digits, it is prefixed with leading 0s.

For example, if year == 2013:

Delimiter Value
%y{2} 13
%y{4} 2013
%y{5} 02013

Usage examples

Track data:

  • Title: Avdei Far'oh
  • Artist: Revolted Masses
  • Album: Revolted Masses
  • Year: 2013
  • Track Number: 6

%n{2} %t => 06 Avdei Far'oh.mp3
%y{4}) %r => (2013) Revolted Masses

Requirements

  • *NIX Operating System
  • PHP5-7 CLI (no server required)
  • ffmpeg (file conversion command line program)
  • id3v2 (audio metadata command line program)

Authors

Kostas Karvounis - kael89

License

This project is licensed under the GNU General Public License v3.0

audio-archiver's People

Contributors

kael89 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.