64 lines
2.2 KiB
Markdown
64 lines
2.2 KiB
Markdown
# iTunesScraper
|
|
|
|
> Version: 1.0.22079 \
|
|
> Created By: Jali <jali@orca0central.de> \
|
|
> Last Modified: Jali <jali@orca-central.de \
|
|
|
|
## About
|
|
|
|
The iTunes-Scraper is a small script to port and clean-up an itunes-library, when porting it to
|
|
another music player.
|
|
|
|
The trouble with iTunes is, that all meta-data is stored in a database, which is not accessible to
|
|
anyone but iTunes itself. The stored mp3 files are not tagged, unless they are already tagged by
|
|
beforehand. iTunes can read these tags, but it does not add to them, when the metadata is edited.
|
|
|
|
In the current case, this leads to an iTunes database of mostly untagged files, which are wildly
|
|
spread accross the users hard drive. To automatically clean up this mess, the file will do the
|
|
following:
|
|
|
|
- read am XML-dump of the iTunes library.
|
|
- locate the files on the hard drive and copy them into a target folder.
|
|
- read all the metadata from the iTunes library, and add id3-tags with the stored information to
|
|
the copied files.
|
|
- If the file is in wav or aiff format, which doesn't allow for tagging, convert it into flac.
|
|
|
|
This process is repeated for all files. If the file is not found on the hard drive, an entry in the
|
|
logfile is found.
|
|
|
|
## Dependencies
|
|
|
|
The solution will be a python script, and it will rely on several python libraries, that are
|
|
available from pip. Most of these libraries are fairly standard, such as id3-tagging or XML
|
|
parsing. They must be present on the target system to be used. This can be done by creating a
|
|
[venv](https://docs.python.org/3/library/venv.html) for python3.
|
|
|
|
To create your virtual environment, do
|
|
|
|
```bash
|
|
python3 -m venv .venv
|
|
```
|
|
|
|
from within the root of this repository.
|
|
|
|
Then activate the environment, and install the requirements.
|
|
|
|
```bash
|
|
source .venv/bin/activate
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
And you're good to go.
|
|
|
|
## Usage
|
|
|
|
To use the script, download it to the local machine, create the virtual environment as described
|
|
under ```Dependencies``` and then you can run the script with the command:
|
|
|
|
```bash
|
|
python3 ./scraper.py --target <targetDirectory> <itunesLibraryFile>
|
|
```
|
|
|
|
where ```<targetDirectory>``` is the folder you want your new music collection to reside, and
|
|
```<itunesLibraryFile>``` is the name of the xml file containing your iTunes library data.
|