Coder Social home page Coder Social logo

tymbalodeon / tsundeoku Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 671 KB

積んでおく ("tsundeoku"), "to pile up for later": CLI for managing imports from a shared folder to a "beets" library

Python 86.86% Just 12.41% Nix 0.73%
audio audio-files beets music music-library music-metadata

tsundeoku's Introduction

Tsundeoku

積んでおく ("tsundeoku"), "to pile up for later"

Tsundeoku is a CLI tool that helps you take audio files from a shared folder and "pile them up for later" by importing them to a beets library. When importing, albums in the folder that have already been imported will be skipped (not possible with beets alone), and newly added albums will only be imported automatically if all tracks have finished syncing. This way, the import command can safely be run repeatedly to catch all new additions to the shared folder without creating any problems in the beets library.

Metadata can also be changed to suit the user's preferences. For example, there are rules to alter common metadata formats that may not be to every user's liking--to strip bracketed years (in the format: "[YYYY]") from album fields, to expand abbreviations (such as "Rec.s" to "Recordings"), and to strip bracketed instrument indications (in the format: "[solo <instrument>]") from artist fields. Run tsundeoku reformat --help to see all reformat rules.

Installation

  • Install pdm
  • Run just build to install the tsundeoku command in your shell.

You will need to configure beets. A default beets config (using "~/Music" as the "directory") can be generated by running just beets. To provide a different directory, or to set other options, follow the instructions in the beets documentation. You will also need to import your library in order to get started and generate the pickle file.

If your local library is on an external drive, you will need to give "Full Disk Access" to /bin/zsh in System Preferences > Security & Privacy > Privacy > Full Disk Access.

Usage

  • To import new audio files from your shared folder to your music library: tsundeoku import (or tsundeoku import --as-is to leave the metadata untouched)
  • To reformat metadata for all previously imported tracks: tsundeoku reformat
  • Tsundeoku uses a config file that can be viewed and edited with: tsundeoku config and tsundeoku config --edit
  • For more information: tsundeoku --help or tsundeoku <command> --help

tsundeoku's People

Contributors

benjaminrosen avatar dependabot[bot] avatar tymbalodeon avatar

Stargazers

 avatar

Watchers

 avatar  avatar

tsundeoku's Issues

add details to email

When notifying by email, provide details about which albums could not be imported and what the error was.

should this be a beet plugin?

If this is always going to be built on top of beets, should this be a plugin instead of a separate CLI?

Keeping it separate could mean swapping out beets for some other system, and possibly also using pyinstaller to bundle this for others to install? The query system in beets is nice, but the main purpose of this is to keep track of imports from a shared folder, so it would be easy to set up the pickle file system separately and import via the specified music player rather than through beets. This might make it easier to get going for people that just want to pull in new adds to their music player and who browse there.

update config system

  • add option to display config path
  • don't display "musicbros" section
  • make directory values toml arrays [added for ignored, needed for shared]
  • add option to open config to edit
  • add options for specifying default behavior of import-new (whether as-is is default or not, etc.)

automate copying of wav to swinsian without beets

beets can't handle wav, but I still want to copy wavs to my library path automatically while importing and have it recognized by Swinsian.

Provide an option to copy wavs, perhaps with some config option to set if you want to copy through an app like Swinsian and which app, etc.

handle permissions for external drives

To schedule the command and have it copy files to an external drive, you need to give it permissions or it will throw an error. Can the appropriate settings be changed programmatically? If not, add instructions to README.

fix error import count and allow cancel

The error import count in the table title is wrong. Also, there should be a way to cancel importing anyway. Should there be a prompt for if you want to import any albums anyway?

test schedule

  • test --on for daily and hourly
  • test --off
  • test schedule displays current schedule
  • test schedule --logs shows logs

allow confirm import of only some error albums

If there are a bunch of albums requiring a user decision and some of them you know are good to go, but others you are unsure of, there should be an option to select a subset of the error albums to import and leave the rest alone. Perhaps a table display with indices that can be typed in to select which albums to import.

test reformat

  • test reformat uses default config
  • test reformat uses custom config
  • test reformat --remove-bracket-years when that isn't set in config
  • test reformat --years-as-is when that isn't set in config
  • test reformat --remove-bracket-instruments when that isn't set in config
  • test reformat --instruments-as-is when that isn't set in config
  • test reformat --expand-abbreviations when that isn't set in config
  • test reformat --abbreviations-as-is when that isn't set in config

add command to install beets and allow running without config

Is it possible to install beets and a default config with the Makefile? In any case, instructions should be added to the README for setting up beets. Since the default config will likely fail, the CLI should allow for running the help commands without crashing, and display a warning that the config is not set up properly.

replace CLI name

Find a name that doesn't include the word "bros" and replace all instances of "musicbros" in the codebase.

Keep bracketed solo instrument indications in comments or grouping

Bracketed solo instrument indications should not appear in the artist field; only the artist name should appear there. But this is also useful information. When stripping this from artist fields, preserve it by adding it to the end of the comment and/or to the grouping field.

add tests for config file-system

Add tests for all config file-system options.

  • test --shared-directories changes shared directories if good; error message if bad
  • test --pickle-file changes pickle file; error message if bad
  • test --ignored-directories changes ignored directories; error message if bad
  • test --music-player changes music player; error message if bad
  • test --add adds to list
  • test --remove removes from list

test config reformat

  • test --remove-bracket-years / --years-as-is
  • test --remove-bracket-instruments / --instruments-as-is
  • test --expand-abbreviations / --abbreviations-as-is

check year tag before stripping years from album tag

Sometimes an album comes in with a blank year tag, but a bracketed year in the album tag.

When stripping years, first check to see if the year tag is blank, and if so, copy the year into the year tag.

If the year tag is not blank, but contains a different year than the bracketed album, prompt the user for a decision to:

  • Use the bracketed year
  • Use the existing year in the year tag
  • Remove both values
  • Skip stripping for now and save decision for later without doing anything

add tests for config import

Add tests for all config import options.

  • test --reformat and --as-is update the correctly
  • test --ask-before-disc-update and --auto-update-disc update the correctly
  • test --ask-before-artist-update and --auto-update-artist update the correctly
  • test --allow-prompt and --disallow-prompt update the correctly

test import

  • test import uses default config
  • test import imports new albums
  • test import imports skips already imported albums
  • test --reformat calls reformat after importing, no matter what is set in config
  • test --as-is does not reformat, no matter what is set in config
  • test --ask-before-disc-update prompts before updating, no matter what is set in config
  • test --auto-update-disc does not prompt, no matter what is set in config
  • test --ask-before-artist-update prompts before updating, no matter what is set in config
  • test --auto-update-artist does not prompt, no matter what is set in config
  • test --allow-prompt prompts, no matter what is set in config
  • test --disallow-prompt skips albums requiring prompt, no matter what is set in config
  • test --disallow-prompt sends notification if set, does not send if not set

auto-add disc numbers

albums often come in with disc numbers blank, but I prefer to see disc 1 of 1 instead of null. add an option to fill in blank disc numbers with disc 1 of 1 (more often than not this is accurate for blank disc numbers, but this can be made optional)

add option to run only automatic imports and exit

Many decisions cannot be made programmatically. (For example, if an album is missing track totals, the program can't decide if it's complete or if more tracks will be syncing in the shared folder--this can only be decided by manually inspecting each case.) Provide an option to skip all imports requiring a human decision and run only imports that can be handled automatically. This way, the script could be run and forgotten about, perhaps on a schedule, and can be run again with prompts when convenient.

handle EP brackets

e.g., [2022 EP]. The year should be checked the same as other years and the brackets should be stripped.

provide interface for choosing which error albums to import anyway

Often a bunch of albums will come in that are flagged as errors, either because no track total is provided or else the total tracks doesn't match the track total; but I'm sure everything is synced (we could be correcting metadata on just part of a record, for example).

Currently I can only import all of the error albums or none of them, which means that if I'm not sure they're all good to go, I have to wait on importing all of them. There should be an option to select the ones I know are complete and ignore the others until I have time to check them manually.

Perhaps numbers appearing next to the albums on screen, and selecting which numbers you want to import anyway?

update metadata rules

Add rule for Recs -> Recordings (without the period)

Add rule to strip bracket years that include a range, e.g., [1945-1950] or [1945-50]

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.