Git Product home page Git Product logo

mixync's Introduction

Mixync

Typecheck

Like rsync but for Mixxx databases and music.

NOTE: The project is still in very early stages, so please make sure to back up your mixxxdb and your music before trying it. Additionally the portable database's schema should be considered unstable until we have a proper solution for database migrations and schema versioning in place (e.g. using alembic), see #11.

+-------------------+
|    Your local     |
|  mixxxdb.sqlite   |   <--+                +--------------------------+
+-------------------+      |                | A portable musiclib with |
                           +--> mixync <--> |  all your tracks, cues,  |
+-------------------+      |                | grids and other metadata |
|    Your local     |   <--+                +--------------------------+
|   music folders   |
+-------------------+

A small CLI tool for copying a Mixxx database along with tracks to and from a portable and relocatable folder (*.musiclib) for archival, storage on a flash drive, a web server, etc.

Usage

All invocations of mixync follow the same pattern, roughly analogous to rsync or cp:

mixync [source] [dest]

where source and dest are so-called refs, which describe a store for metadata and music. Each ref can be one of the following:

  • A local mixxxdb, e.g. @local, path/to/mixxxdb.sqlite
  • A portable musiclib, e.g. path/to/library.musiclib
  • A debug output that prints updates just to stdout, either @debug or @debugcompact

For example:

# Copy your local mixxxdb and music to a portable musiclib
mixync @local ~/my-library.musiclib
# Copy a portable musiclib to your local mixxxdb and music folders
mixync ~/my-library.musiclib @local

More advanced examples include:

# Copy only tracks and playlists from your local mixxxdb to a portable musiclib
mixync -f tracks,playlists @local ~/my-library.musiclib
# Copy only tracks and crates from the directory named 'MyCollection' from your local mixxxdb to a portable musiclib
mixync -f tracks,crates -d MyCollection @local ~/my-library.musiclib

Note: While you can omit tracks e.g. by specifying -f crates to only copy crates, this usually isn't meaningful since the copied crates will always be empty (since no tracks were copied, thus no track ids were mapped). The same applied to playlists.

Portable Musiclib Structure

A portable musiclib (a new format introduced by this tool) as generated by mixync has the following directory structure:

my-library.musiclib
- library.sqlite3           <- Tracks (with portable paths), playlists, crates and cues
- folder1                   <- Exported music folder
  - track1.mp3
  - track2.mp3
    ...
- folder2                   <- Exported music folder
  - track1.mp3
  - track2.mp3
    ...

mixync's People

Contributors

fwcd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mixync's Issues

Omit empty playlists and crates (when filtering)

Currently, all playlists and crates are copied even if there are no tracks in them (which can happen e.g. when filtering only a certain directory). We should simply skip these playlists and crates.

Check mixxxdb schema version

Mixync is tested on schema version 39, we may want to check that the user's version is recent enough too though.

Support `mixync portable.musiclib @local` (writing back into a mixxxdb)

  • This direction requires caution, since we have to be careful to not overwrite any data by the
  • Perhaps create a backup of the user's mixxxdb before doing anything via this tool to a mixxxdb.sqlite3.backup file in the same folder (Mixxx's config directory)?
  • Only copy music to folders explicitly managed by this tool (i.e. mixync should not touch any Music directories previously configured by the user in Mixxx and instead create its own)
  • Add ability to add a musiclib's folders only by reference?

Progress:

  • Add --dest-root-dir
  • Implement directory mapping (i.e. absolutize_directory)
  • Implement track mapping (i.e. absolutize_track)
  • Implement metadata (track, playlist, crate, ...) updating in MixxxStore
  • #16
  • Test it in a isolated environment

Investigate ids and uniqueness constraints

Ideally, we'd like to have uniqueness constraints in our portable DB and use upsert operations to insert rows (also we have to be careful since we use different ids in the portable DB compared to the local one)

Use tqdm for progress bar

A well-tested progress bar library like tqdm might produce prettier output and have less overhead than our own solution.

Mixxxdb support

This issue tracks support for the mixxxdb's tables:

  • library
  • directories
  • track_locations
  • Playlists
  • PlaylistTracks
  • crates
  • crate_tracks
  • cues
  • settings (primarily for the schema version)

Out of scope for now:

  • LibraryHashes (shouldn't be necessary, but might be nice to have to ensure data integrity?)
  • track_analysis (contains only waveform analysis, which usually can be generated on-the-fly pretty quickly, beatsgrids and keysgrids are stored under library.beats and library.keys, respectively)

Third-party libraries are also out of scope:

  • itunes_library, itunes_playlist_tracks, itunes_playlists
  • rhythmbox_library, rhythmbox_playlist_tracks, rhythmbox_playlists
  • traktor_library, traktor_playlist_tracks, traktor_playlists

Long Term Ideas

Once ready, there are a number of neat things we could do with such a portable archive:

  • Provide ways to inspect/browse a mixxxlib generated by this tool
    • Perhaps via a CLI tool?
    • Or perhaps add a small app for HTTP/WebDAV-hosting a mixxxlib along with a web interface, letting the user create playlists/crates directly from the browser?

Windows testing

We should test the library on Windows, especially to make sure that the conversions behave correctly in the presence of non-slash file path separators etc. (the portable db should always use POSIX-style slashes, but during absolutization they should get converted back to platform-specific absolute paths and vice versa)

Add support for reorganizing/retagging tracks etc. in-place

This could e.g. be useful to eliminate duplicates (merging the best quality version?), merge folders, regroup tracks by a predefined path scheme e.g. ${artist}/${album} etc.

Perhaps we could do this by writing mixync [source] [source], i.e. allowing the source as destination, and perhaps sugaring that to mixync [source] or mixync --inplace [source] (though we'd want to be careful to not perform any destructive operations, so perhaps making a backup would be a good idea?)

Persist id mappings locally

It would be cool if we could persist the id mappings locally to skip matching if we already matched the track in the past.

Rename `@local` to `@mixxxdb`

Mostly to avoid confusion if we introduce other local databases (e.g. a hypothetical local Bassment database) in the future.

MVP

  • Set up project
  • Set up basic CLI (mixync [source] [dest])
  • Automatically locate the user's mixxxdb (cross-platform: Windows/macOS/Linux)
  • Support mixync @local portable.musiclib
  • #12
  • Add dry run option

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.