Coder Social home page Coder Social logo

audiotagger's Introduction

AudioTagger

A .NET CLI program that can perform the following actions on audio files:

  • View ID3v2.3 tags
  • Auto-update tags using filename patterns
  • Update a single tag for multiple files at once
  • Auto-rename and reorganize files using filename patterns
  • Reorganize files into folders using their tag data
  • Find duplicate files by their tags
  • Auto-write genres for registered artists
  • Remove artwork
  • See media file stats
  • Apply audio normalization (ReplayGain)

This is a little labor-of-love project that I work on in my spare time. It relies on the TagLibSharp library for tag reading and writing.

Requirements

Running

Run this app from the AudioTagger.Console folder using dotnet run. Passing no arguments will show the instructions.

Additionally, settings.json should exist in the application directory for some features. A sparsely populated file will be automatically created if it does not already exist when the program is started.

A sample settings file follows:

{
  "artistGenreCsvFilePath": "/Users/me/Documents/audio",
  "resetSavedArtistGenres": true,
  "renaming": {
    "useAlbumDirectories": true,
    "ignoredDirectories": [
      "Directory 1",
      "Directory 2"
    ],
    "patterns": [
      "%ALBUMARTISTS% ≡ %ALBUM% [%YEAR%] = %TRACK% - %ARTISTS% - %TITLE%",
      "%ARTISTS% - %ALBUM% [%YEAR%] - %TRACK% - %TITLE%",
      "%ALBUMARTISTS% ≡ %ARTISTS% - %ALBUM% [%YEAR%] - %TITLE%",
      "%ARTISTS% - %ALBUM% [%YEAR%] - %TITLE%",
      "%ARTISTS% - %ALBUM% - %TRACK% - %TITLE%",
      "%ARTISTS% - %ALBUM% - %TITLE%",
      "%ARTISTS% - %TITLE% [%YEAR%]",
      "%ARTISTS% - %TITLE%",
      "%TITLE%"
    ]
  },
  "duplicates": {
    "pathSearchFor": "/Users/me/Documents/Media/",
    "pathReplaceWith": "",
    "savePlaylistDirectory": "/Users/me/Downloads/NewMusic",
    "titleReplacements": [
      " ",
      " ",
      "-",
      "~",
      "",
      "/",
      "",
      "?",
      "",
      "!",
      "",
      "AlbumVersion",
      "AlbumVer",
      "ShortVersion",
      "ShortVer",
      "()",
      "()",
      "",
      "",
      ".",
      ":",
      ""
    ]
  },
  "tagging": {
    "regexPatterns": [
      "(?:(?<albumArtists>.+) ≡ )?(?<album>.+?)(?: ?\\[(?<year>\\d{4})\\])? = (?<trackNo>\\d+) [–-] (?<artists>.+?) [–-] (?<title>.+)(?=\\.m4a)",
      "(?:(?<albumArtists>.+) ≡ )?(?<album>.+?)(?: ?\\[(?<year>\\d{4})\\])? = (?<trackNo>\\d{1,3}) [–-] (?<title>.+)(?=\\.m4a)",
      "(?:(?<albumArtists>.+) ≡ )(?<album>.+?)(?: ?\\[(?<year>\\d{4})\\])? = (?<artists>.+?) [–-] (?<title>.+)(?=\\.m4a)",
      "(?:(?<albumArtists>.+) ≡ )?(?<album>.+?)(?: ?\\[(?<year>\\d{4})\\])? = (?<title>.+)(?=\\.m4a)",    ]
  }
}

Explanation of options:

  • titleReplacements: Optional. Substrings in titles that will be ignored when searching for duplicate files. This allows pairs like "My Song" and "My Song (Single Version)" to be considered identical. Otherwise, they would be considered separate titles.
  • renamePatterns: Mandatory. When renaming files, they will be renamed according to the first such pattern that matches the populated tags in each file. For example, if a file contains only artist and title information, then it will be renamed per the third option above.
  • regexPatterns: Mandatory. When tagging files, these regexes are used to match against the filenames. When there is a match, then the appropriate ID3 tags are updated in the file.
  • artistGenres: Auto-populated when the -g option is supplied.

audiotagger's People

Contributors

codeconscious avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

audiotagger's Issues

Parsing issue when albums contain "「" and "」"

When the following file format is used to update tags (using -u), the full album and title are not parsed correctly:

歌手名 - テレビドラマ「作品名」 - 曲名.mp3

The temporary workaround is to replace them with "『" and "』".

Warning CA1416 when the app is started

Since upgrading to .NET 7, several warnings like the following one are displayed when the application is run on M1 Macs:

[redacted]/audiotagger/AudioTagger.Console/Graphics.cs(35,26): warning CA1416: This call site is reachable on all platforms. 'Bitmap' is only supported on: 'windows'. [[redacted]/audiotagger/AudioTagger.Console/AudioTagger.Console.csproj]

This is related to the currently-disabled album art functionality. I need to resolve this or else remove the functionality.

Years saved to tags are not visible in Musicolet

Years that are saved to ID3v2 tags using taglib-sharp are not visible in my Android audio player of choice, Musicolet. In Musicolet, the Year field appears blank.

At this glance, this might be caused by the two applications referring to differing ID3v2 frames. Of note, I get the feeling that taglib-sharp might use unusual (?) frames like TDRC. I considered a fork-and-fix, but it seems the project might be dead or dying.

Musicolet is closed source, and I don't know what frame it uses for years.

I need to figure how the best way to handle this so I can avoid needing to enter the years manually in Musicolet each time.

Truncated title names due to periods

Track titles within filenames that contain a period are often truncated right before that period, and that truncated version is added to the title field of the tags. This is likely due an issue with the relevant regex pattern(s) for such filename formats.

Example: If the filename is ARTIST - TITLE WITH PERIODS F.Y.I..mp3, then the title will be TITLE WITH PERIODS F.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.