Skip to main content

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

MIT

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

audiodotturn-0.5.5.tar.gz (20.5 kB view hashes)

Uploaded Source

Built Distribution

audiodotturn-0.5.5-py3-none-any.whl (21.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page