Skip to content

Instantly share code, notes, and snippets.

@Tamriel
Last active November 25, 2018 19:35
Show Gist options
  • Save Tamriel/1474fba2163fee6c8871fbb274a372af to your computer and use it in GitHub Desktop.
Save Tamriel/1474fba2163fee6c8871fbb274a372af to your computer and use it in GitHub Desktop.
Convert quod libet library to opus

Convert your music library (in this case quod libet) to the opus file format

  1. In quod libet, check for files with low bitrates and replace them with better ones: &(#(bitrate < 192), encoding != VBR)
  2. Convert + delete your music files: dir2opus --recursive --verbose --delete-input --bitrate 128 --convert-all MyFolder
  1. Close quod libet
  2. Backup ~/.config/quodlibet
  3. Run this python3 script to update the library file paths:
import os

import quodlibet.library
from quodlibet.formats.xiph import OggOpusFile

library_path = os.path.join(quodlibet.get_user_dir(), "songs")
library = quodlibet.library.init(library_path)

for song in library:
    song['~filename'] = song('~filename').replace('.mp3', '.opus')
    song.__class__ = OggOpusFile
    library.changed([song])

library.save()
  1. Open quod libet and refresh the library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment