a bash script to help manage your rockbox library
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-01 14:01:22 -07:00
library-import.sh initial commit 2026-09-01 13:53:52 -07:00
README.md minor readme changes 2026-09-01 14:01:22 -07:00

Rockbox Utility Scripts

A bash script to help synchronize your organized music library with a rockbox media player with some optimizations

  • Media files are reencoded to 320kbps mp3 files in transit
  • Folder structure is preserved using vfat-compatible filenames
  • Artwork is removed from media files, and instead stored as a single scaled-down cover.jpg
  • Successfully transferred files are remembered, and skipped in subsequent synchronizations
  • Deleted source files, or tracks no longer synced due to removal from the sync.txt file are removed from the rockbox library

Usage:

library-import.sh [-vfD] -d /rockbox/device/root -l /music/library/root

  Required flags:
    -d  Path to your rockbox device's root
    -l  Path to your music library's root
        Should be structured as /Artist/Album/tracks.ext
  Optional flags:
    -v  verbose output
    -f
    -D

Example

Music Library

  /home/user/Music/
    The Reverent Marigold/
      Joshua Jericho (2024)/
        01 - Joshua.flac
        ...
        12 - Jericho.flac
      SICK, TRANS, GLORIOUS MOONDREAM! (2022)/
        01 - Post-Op(penheimer).flac
        ...
        06 - JUDAS (Acoustic).flac
    Cassie Candles/
      Hat (2026)/
        01 - When I Write.flac
        ...
        12 - Truman Show.flac
      Romance and Its Consequences (2025)/
        01 - Still a Kid.flac
        ...
        11 - Come Over.flac

Rockbox Library Before Import

  /run/media/user/rockbox/Music
    Cassie_Candles/
      Romance_and_Its_Consequences-2025-/
        01-Still_a_Kid.mp3
        ...
        11-Come_Over.mp3
    Some_Artist/
      Some_Album-2020-/
        01-Some_Track.mp3
        ...
        04-Some_Other_Track.mp3

Sync List

/run/media/user/rockbox/.syncinfo/sync.txt

  Cassie Candles                                 # Import an entire artist by only listing the artist's directory name
  The Reverent Marigold/Joshua Jericho (2024)    # or specific albums by listing the artist's directory name and album subdirectory

run the script like so: library_import.sh -d /run/media/user/rockbox -l /home/user/Music

Rockbox Library After Import

  /run/media/user/rockbox/Music
    The_Reverent_Marigold/                  # Imported, since it did not already exist
      Joshua_Jericho-2024-/                 # and was found by the sync.txt list
        01-Joshua.mp3
        ...
        12-Jericho.mp3
    Cassie_Candles/
      Hat-2026-/
        01-When_I_Write.mp3
        ...
        12-Truman_Show.mp3
      Romance_and_Its_Consequences-2025-/   # Not imported, since it already existed,
        01-Still_a_Kid.mp3                  # but not deleted, because it was still found
        ...                                 # by the sync.txt list
        11-Come_Over.mp3
                                            # 'Some Artist' was removed because they were
                                            # not listed in the sync.txt list

Todo:

  • enable customizing the encode settings/format
    • detect lower/variable bitrate tracks and only reencode as needed?
    • allow customizable album artwork image size or omission entirely
  • add support for multi-disk subdirectory structures
  • tidy up code
  • other things, probably
  • rewrite in a better language using an actual database

Further out:

  • Listenbrainz scrobbling