Various statistics based on ID3 tags of tagged files, e. g. MP3 or flac files.
This project uses the MIT licence. The licences of the used packages are listed at the bottom.
I'm ripping all my CDs to flac files. With a number of > 800 CDs I've got a large number of flac files. After listening to a song I knew from another artist I thought about some statistics.
The program is splitted up into two parts. The DataCollector will collect the information from the flac files and will store the data into a database.
The second part ID3Stats will run several plugins. Each plugin will determine a statistic.
The DataCollector will work the following steps:
- Check if given path is existing, abort if not
- Find all tagged files
- For each tagged file
- Read ID3 tag
- Insert/Update ID3 meta data in database
For details see readme of DataCollector project.
Currently there is no logic for check move of tagged files inside the collection. But to detect this a filehash (MD5) is generated during import and written to the DB. This may slow down the process. This is configurable, the default is do not calculate the hash. For details see DataCollectorConfig.UseHash.
The ID3Stats program will establish a connection to the database. Additional an output stream for a HTML file is created. Then it will load all plugins and pass the db connection as well as the output stream to each plugin. Forces by an interface each plugin will run a simple db task, the results are written to the passed output stream.
For details see readme of id3stats project.
The plugin mechanism is based on my other project, weatherstation here.
The source of the diagram is here. To get fast results for the plugins a flat table is used. This will also simplify the queries in the plugins.
The diagram is made with PlantUML.
- This program is written in C#
- Inspired from my other project Weatherstation
- The configuration file handling
- The plugin system
- Reading the ID3 tags is based on [TagLibSharp][lib_taglib#]
After compilation somewhere at the bin path you can find two executables.
datacollector.exe- The part to get the data into the database.id3stats.exe- The part to generate the statistics.
There are a bunch of config files where the program can be adjusted to the needs.
This config file defines the name of the SQLite database.
<?xml version="1.0" encoding="utf-8"?>
<DBConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<DBFilename>id3stats.db</DBFilename>
</DBConfig>This config is used to influence the DataCollector. The settings are
ID3Path=> Root path of the collection of files with ID3 tagID3Pattern=> Obviously the file extension of the tagged filesDataTranslation=> This is a workarround to fix the behaviour of TagLib#. There the single artistAC/DCwill become to two artistsACandDC. The translation data is case sensitive!UseHash=> If this is set totrue, a MD5 hash is created of the tagged file when it is added to the internal list. This setting has heavy influence on the speed.
<?xml version="1.0" encoding="utf-8"?>
<DataCollectorConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ID3Path>m:\</ID3Path>
<ID3Pattern>*.flac</ID3Pattern>
<DataTranslation>{'ac;dc':'ac/dc'}</DataTranslation>
<UseHash>false</UseHash>
</DataCollectorConfig>This config is used to influence the ID3Stats. The settings are
StatisticsMainFile=> The name of the main statistics file -index.htmlis so annoyingPathPlugin=> In case the plugins reside in a subdirectoryPathOutput=> Outpout path of the statistics
<?xml version="1.0" encoding="utf-8"?>
<ID3StatsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<StatisticsMainFile>ID3Stats.html</StatisticsMainFile>
<PathPlugin />
<PathOutput>./id3stats/</PathOutput>
</ID3StatsConfig>An example of a statistic can be viewed here.
All used libraries are sticked to id3stats_core to have no redundancy of various versions of the NuGet packages.
