Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ID3STATS

Various statistics based on ID3 tags of tagged files, e. g. MP3 or flac files.

Licence

This project uses the MIT licence. The licences of the used packages are listed at the bottom.

Motivation

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.

Details

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.

DataCollector

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.

ID3STATS

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.

Plugin mechanism

The plugin mechanism is based on my other project, weatherstation here.

ERM diagram

ID3Stats ERM diagram

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.

Technology

  • 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#]

Usage

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.

Configs

There are a bunch of config files where the program can be adjusted to the needs.

DBConfig.config

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>

DataCollectorConfig.config

This config is used to influence the DataCollector. The settings are

  • ID3Path => Root path of the collection of files with ID3 tag
  • ID3Pattern => Obviously the file extension of the tagged files
  • DataTranslation => This is a workarround to fix the behaviour of TagLib#. There the single artist AC/DC will become to two artists AC and DC. The translation data is case sensitive!
  • UseHash => If this is set to true, 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>

ID3StatsConfig.config

This config is used to influence the ID3Stats. The settings are

  • StatisticsMainFile => The name of the main statistics file - index.html is so annoying
  • PathPlugin => In case the plugins reside in a subdirectory
  • PathOutput => 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>

Sample output

An example of a statistic can be viewed here.

Libraries

All used libraries are sticked to id3stats_core to have no redundancy of various versions of the NuGet packages.

About

Statistics about MP3 collection

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages