Skip to main content

audio-libraries-tlk

A set of Python tools to explore and modify data contained in a music library such as playlists or album cover artwork.

Links to

Acknowledgments

This project is heavily relying on, on the one hand Scholnicks' itunesLibrary (itself a port of Drew Stephen's Mac-iTunes-Library), on the other hand on KristoforMaynard's music-tag. The template used to create MiniDisc inner labels is coming from MiniDisc Wiki

Usecases

This project originates from the following needs:

  1. Transferring playlists from different audio devices.
  2. Convert cover artwork of songs to non-prog images.
  3. Explore inconsistencies in a music library (incomplete albums, songs placed in the wrong location, etc).
  4. These would be possible for both an iTunes or Apple Music managed library and a library managed by hand in folders.

How to install

Through pip

python3 -m pip install audio-libraries-tlk

Warnings

In general:

  • You are using this script at your own risks. Make sure you try the script on a duplicated small sample of your library to verify that it is achieving what you want.

In particular:

  • Running the playlists components of the script should be safe as these don't imply modifying your music library but just extract some playlists and create new ones.

  • Running the cover artwork options is much more risky as the script will potentially modify the cover artworks inside your music files. If your music files are not properly split by album (two songs of different albums are present in the same folder) then you the cover artworks of the two albums will be mixed (one will replace the other). In other word, the script assumes that songs in the same location belong to the same album. In case of doubt, you can start by running the script with all the cover artwork options set as False (the default case) and with the option Create special playlists option as True. This will produce a csv file showing all the locations containing songs of multiple albums.

  • Again try the script on a small duplicated sample of your music files and check if the result pleases you.

Be patient

Depending on the option you choose the script can take a long time to run: up to ~1 hour for 1 30k songs library on a mac mini M2.

To save time in the case you need to run the script twice and to avoid the full scan of the music files or of the .xml file twice, a .pickle and a .csv file are created by the first scan of the library. These will be reused in the the second call to significantly reduce the time of the second call.

However, if your music files or .xml have changed between the first and the second call, you need to remove the existing .pickles and .csv are these wont reflect anymore the state of your music library.

Outputs

  • The .m3u8, .csv and .picklefiles created by the script will be located inside the PATH_TO_LIBRARY_DATA.
  • Image files extracted from your music metadata will be located in the album folders.

How to run

  • To run the script from an iTunes or Apple Music, first go to setting/Library/Export Library. Save the .xml file in a folder and copy this path (for instance /Users/user_name/Music/ where you have placed the file My_Library.xml).
  • To run the script from a music library that is simply organised in folders (for instance Artist/Album). Simply copy the path pointing to our music directory (for instance /Users/user_name/Music/Music/Media/Music).

Then, for instance, to extract all the playlists contained in your music library, convert them into a format readable by a new audio device, and create a cover.jpg file for inside each album folder, run the command:

python3 -m audio-libs-tlk --path_to_library_data='/Users/user_name/Music/' --orginal_path_written_in_playlists='/Users/user_name/Music/' --updated_path_written_in_playlists='/home/Music/' --create_cover_jpg=True

To save time on the second run

To save time in the case you need to run the script twice and to avoide the full scan of the music files or of the .xmlfile twice, a .pickle and a .csv file are created by the first scan of the library. These will be reused in the the second call to significantly reduce the time of the second call.

However, if your music files or .xml have changed between the fiorst and the second call, you need to remove the existing .pickles and .csv are these wont reflect anymore the state of your music library.

Detailed options

options:
  -h, --help            show this help message and exit
  --path_to_library_data PATH_TO_LIBRARY_DATA
                        Path containing to a folder containing an iTunes library .xml file or all
                        a music library organized album folders.
  --orginal_path_written_in_playlists ORGINAL_PATH_WRITTEN_IN_PLAYLISTS default=None
                        Part of the path to be replaced in the original playlists (for instance
                        '/Users/UserName/Music/Music/Media/Music'). Open an m3u8 playlist with a
                        text editor to know what to use.
  --updated_path_written_in_playlists UPDATED_PATH_WRITTEN_IN_PLAYLISTS default=None
                        Part to be used in the new music location (for instance
                        '/home/sony/walkman/Music'). Open an m3u8 playlist with a text editor to
                        know what to use.
  --create_cover_jpg CREATE_COVER_JPG default=False
                        If True an image file called 'cover.jpg' will be created inside each
                        location containing some music files. Only 1 file will be created per
                        location. Even if two songs have distinct cover art
  --create_album_title_jpg CREATE_ALBUM_TITLE_JPG default=False
                        If True an image file called 'title of the album.jpg' will be created
                        inside each location containing some music files. Only 1 file will be
                        created per location. Even if two songs have distinct cover art
  --complete_missing_cover_art COMPLETE_MISSING_COVER_ART default=False
                        Use the cover art of a song (any arbitrary one) contained in the same
                        location to fil all the missing cover arts
  --convert_to_non_prog CONVERT_TO_NON_PROG default=False
                        Convert the cover arts to non-prog images.
  --create_special_playlists CREATE_SPECIAL_PLAYLISTS default=False
                        Create some playlists and csv file to underline some aspects of a music
                        library.
  "--create_minidisc_labels default=False
                        From an .m3u8 file, create some MiniDisc labels using the cover artwork 
                        present in the audio library.

Metadata

Release files for audio-libraries-tlk 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for audio-libraries-tlk 1.2.3
File Size Uploaded Provenance Actions
audio_libraries_tlk-1.2.3.tar.gz 29.0 kB Without provenance Details for audio_libraries_tlk-1.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for audio-libraries-tlk 1.2.3
File Interpreter ABI Platform Actions
audio_libraries_tlk-1.2.3-py3-none-any.whl Python 3 none any Details for audio_libraries_tlk-1.2.3-py3-none-any.whl

Total release size: 59.9 kB

Release files / audio_libraries_tlk-1.2.3.tar.gz

Download URL audio_libraries_tlk-1.2.3.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d7a2490c0edce0af6847220ca0e76e9e439ed53361979b785de183a06c004ce2
BLAKE2b-256 checksum
How to use checksums
cde754fb8abc597489f4d50d63ef75452ab59b3aca3b9cecda5c4c0d7e3c0578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / audio_libraries_tlk-1.2.3-py3-none-any.whl

Download URL audio_libraries_tlk-1.2.3-py3-none-any.whl
Size 30.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b4f3d44efe6d25f595aabeb57d9194ca0d11e38a4a4b3bed039c05f0199bafa
BLAKE2b-256 checksum
How to use checksums
db53aa831ba46116f32a9e93059ce072a9954e2708d4499aaf30e9bae8b92fed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for audio-libraries-tlk 1.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page