A tool/library for formatting and cataloging audio files, mainly for files with no metadata.
Project description
THIS PROJECT HAS MIGRATED TO RUST, CHECK OUT SongParse, A LIBRARY AND CLI TOOL WRITTEN IN RUST
audiodotturn 0.5.5
General tool/library for extracting simple metadata and producing new file formats from only a filename(s).
Metadata can be catalogued and viewed via a sql database created by audiodotturn
Extraction and construction reports can be generated in multiple file formats.
INSTALLATION
pip install audiodotturn
CONFIGURATION
User configuration settings can be set in a config.ini file placed in one of the following locations
- ~/.config/audiodotturn/config.ini,
- ~/config/audiodotturn/config.ini,
- ~/audiodotturn/config.ini,
- ~/.audiodotturn/config.ini,
User Configuration options shown below
[DATABASE]
path = <DATABASE PATH>
[PROGRAM]
exts = <COMMA SEPERATED LIST OF EXTS ie. .mp3, .mp4, .wav>
dry = <True/False>
To make sure the config settings are loaded correctly you can run adt -s
to get an overview of the current settings being used
Dependencies
External libraries:
Standard:
- os
- typing
- datetime
- sqlite3
- re
- json
- argparse
- shutil
USAGE
The extract, construct, and database modules are non-dependent on any other part of the program
Rich is only neccessary for use with the adt module or run module. The run module will soon be non-dependent on rich. It is only used for better user experience.
Refer to USAGE
EXAMPLES
Refer to EXAMPLES
Choosing a constructor
- "simple": This will produce several file options formatted as a standard audio track ie. Artist - Title ft. Feat (etc etc).mp3
- "enclosed": This will produce several file options formatted as an enclosed file name ie. (Artist)(Title)(Feat)(etc)(yt-id).mp3
Creating a database
Database path is set in config or during runtime.
A new database will be created upon the first database update.
Increased database funcitonality can be obtained through importing adt
as a library.
See examples in EXAMPLES
License
This project is licensed under the MIT License. See the LICENSE file for more info.
GENERAL
usage: adt [-h] [-v] [-p CFGPATH] [-d DBPATH] [-s] {extract,construct,database} ...
Format, organize and retrieve data from audio files.
positional arguments:
{extract,construct,database}
extract Extraction commands
construct Construction commands
database Database commands
options:
-h, --help show this help message and exit
-v, --version Show current version of audiodotturn
-p CFGPATH, --cfgpath CFGPATH
Path to a specific configuration file to use for the session.
-d DBPATH, --dbpath DBPATH
Path to .db file for library database
-s, --settings Show current settings
EXTRACT
usage: adt extract [-h] [-o OUT] [-f FILE] [-m MULTI [MULTI ...]] [-l DIR]
options:
-h, --help show this help message and exit
-o OUT, --out OUT Output format for extraction, default is dict.
-f FILE, --file FILE Extract info from single file.
-m MULTI [MULTI ...], --multi MULTI [MULTI ...]
Extract info from multiple files.
-l DIR, --dir DIR Extract info from files in a directory.
CONSTRUCT
usage: adt construct [-h] [-a] [-c CONSTRUCTOR] [-f FILE] [-m MULTI [MULTI ...]]
options:
-h, --help show this help message and exit
-a, --auto Set auto-choice
-c CONSTRUCTOR, --constructor CONSTRUCTOR
Constructor to use
-f FILE, --file FILE Construct from a single file
-m MULTI [MULTI ...], --multi MULTI [MULTI ...]
Construct from multiple files
DATABASE
usage: adt database [-h] [-f UPDATEFILE] [-m UPDATEMULTI [UPDATEMULTI ...]] [-A] [-S] [-Ai ARTISTID] [-Si SONGID]
options:
-h, --help show this help message and exit
-f UPDATEFILE, --updatefile UPDATEFILE
Update database via file.
-m UPDATEMULTI [UPDATEMULTI ...], --updatemulti UPDATEMULTI [UPDATEMULTI ...]
Update database via multiple files.
-A, --artists View all artists within the database
-S, --songs View all songs by each artist within the database
-Ai ARTISTID, --artistid ARTISTID
View songs by artist id
-Si SONGID, --songid SONGID
View song by song id
audiodotturn package basic usage
EXTRACTING AND CONSTRUCTING
import audiodotturn
file = 'turn (ft. tester) "long john" ft. me, turner.wav'
files = [
'turn (ft. tester) "long john" ft. me, turner.wav',
'YG Feat. Dj Mustard "Pop It, Shake It" (Uncut) (WSHH Exclusive - Official Music Video) [kQ2KSPz4iSw].wav',
'Lady Gaga, Ariana Grande - Rain On Me (Official Music Video) [AOm9Fv8NTG0].mp3'
]
audiodotturn = audiodotturn.AudioDotTurn()
extraction = audiodotturn.extract_file(file)
extractions = audiodotturn.extract_files(files)
for extract in extraction:
print('extraction single:\n', extract, '\n')
for extract in extractions:
print('extraction:\n', extract, '\n')
constructions = audiodotturn.construct("enclosed", extraction, auto=False)
auto_constructions = audiodotturn.construct("simple", extractions, auto=True)
print(constructions, '\n')
print(auto_constructions, '\n')
EXTRACTION IN DESIRED FORMAT
from rich.pretty import pprint
import audiodotturn
file = 'turn (ft. tester) "long john" ft. me, turner.wav'
adt_runner = audiodotturn.AudioDotTurn()
adt_runner.extract_file(file)
_dict = adt_runner.extractor.get_extraction("dict")
_yaml = adt_runner.extractor.get_extraction("yaml")
_str = adt_runner.extractor.get_extraction("str")
_values = adt_runner.extractor.get_extraction("values")
UPDATING DATABASE
from rich.pretty import pprint
from rich.console import Console
import audiodotturn
console = Console()
file = 'turn (ft. tester) "long john" ft. me, turner.wav'
adt_runner = audiodotturn.AudioDotTurn()
extraction = adt_runner.extract_file(file)
adt_runner.update_database(extraction)
artists = adt_runner.get_all_artists()
for artist in artists:
print(artist["artist_id"])
print(artist["name"])
# The above produces:
#
# 1
# turn
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file audiodotturn-0.5.5.tar.gz
.
File metadata
- Download URL: audiodotturn-0.5.5.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad3c0885a1ac82754abff83e073d65880023ba6a0a99df32103ce45631560a90 |
|
MD5 | 2cc6e154bb5fb4899cd502fe775be375 |
|
BLAKE2b-256 | 54c7fb8fe018cf2430d1e22cdbbee79a35c622f87aaeba60262dc947021da2ae |
File details
Details for the file audiodotturn-0.5.5-py3-none-any.whl
.
File metadata
- Download URL: audiodotturn-0.5.5-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 656b28a50797938d4aab2753990444ce2a765be553704170f12523d13fd9f48e |
|
MD5 | 1f964f4c4a5507fd264b205bea7d410d |
|
BLAKE2b-256 | 9f92fd1df41c6d498710a46979ba0b02b1dd86283ac839bf6b5f1a82b8d308df |