Demlo - A dynamic and extensible music library organizer (in pure Lua)

Demlo organizes your music library automatically and dynamically. It runs a chain of user-defined scripts using variables such as tags and file properties. This way it yields virtually unlimited customization power to the user.
Use case
As an example, consider a music library that is a a perfect definition of chaos:
No folder structure.
Tags are not homogeneous, some entries are filled, other not, it varies from file to file.
Some files have bad audio quality.
Audio codecs are not always the same. Some file are CBR/VBR, lossless/lossy, ...
mp3's ID3 tags are a nightmare.
Covers are sometimes embedded in tags, others are of terrible quality.
Features
A few scripts are already provided and they give a good example of what you can do. You can choose to use them, to rewrite them, or to write a new script from scratch. You can preview changes, and once you are done you call the program over you music library, it will process everything in one single run!
Scripts can be chained: this feature makes Demlo extremely flexible and powerful!
Move all files according to a unique, yet dynamic folder hierarchy. For
instance, setting
output.filename = table.concat {library, '/', o.artist, '/',
                 not empty (o.album) and (empty (o.date) and o.album .. '/' or o.date .. ' - ' .. o.album .. '/') or '',
                 empty (track_padded) and '' or track_padded .. ' - ',
                 o.title}
will move "john doe - 1. intro.ogg" to
"/home/$USER/music/John Doe/2013 - Great Album/01 - Intro.ogg" if there is an album and a date,
"/home/$USER/music/John Doe/Great Album/01 - Intro.ogg" if there is an album and no date,
"/home/$USER/music/John Doe/01 - Intro.ogg" if there is no album.
Case checking: a powerful script that will turn everything to title case. It supports special cases such as Roman numerals, McDonald, etc. It also supports a list of exceptions (e.g. AC-DC, DJ, feat., etc.).
Encoding: you can conditionally re-encode you files, so you can choose to only re-encode files with some particular encoding settings. You can set the desired bitrate, etc.
Covers: automatically remove embedded covers, remove duplicates, remove files beyond/below a quality threshold, etc.
Different kinds of music: classical, OST, and band songs have usually different kinds of tags and folder structures. You can manage different audio libraries easily by setting the corresponding "library" variables.
Edit tags of a file set with your favorite text editor.
Support for cue sheets. (Both external and embedded.)
Demlo can be interfaced with any other program, both ways. (X calls Demlo or Demlo calls X.)
MusicBrainz support for online tagging and cover fetching.
Technical characteristics
This program is completely written in Lua. Its only major dependency is FFmpeg. A few Lua modules are required, which should not eat more than a few KiB on your drive. This leads to a lightweight codebase for a portable and extensible program.
Dependencies
ffmpeg
lua (>= 5.1)
lua-dkjson
lua-filesystem
lua-llthreads2
lua-penlight
lua-socket
slnunicode
chromaprint (optional)
History
This program is based on Musish by the same author.
The original program was written in POSIX shell but suffured from many limitations as well as performance issues. It was rewritten in Lua to circumvent all those issues while applying minor changes to the CLI options and to the variable names. The syntax of the script changed to Lua as well. Here follows a list of major changes:
Traversing folders recursively is no longer a security issue.
Overall performance got boosted by a factor of approx. 2.
Scripts and configuration files are sandboxed, which means they can no longer contain harmful code. However it is no longer possible to chain scripts.
All tags are processed dynamically, no more hard-coded tags.
Links
Official web page
Arch Wiki
AUR package
Issue tracker: Please file bug reports there thanks!
Last edited by Ambrevar (2015-02-20 09:22:22)

 I hoped the structure I presented was clear enough. No, all/majority of tags would be a little too much, but genre, different release types, file types and some other basic distinctions, yes and tagsfs will probably help with that. There are special folders like [Compilation], [High Voltage SID Collection] and probably others in the future, maybe with help of tagsfs. Compilations and Artists are prepended by the leading letter of 'sorted artists/albums' level. Then albums/artists are sorted/presented in the manner visible in the Picard script:
$if($eq(%compilation%,1),
%COMPILATION%///%FIRSTLETTER%///$if2(%ALBUM%,%NONALBUMTRACKS%,[Other]) - $if(%DATE%,[%DATE%],),
%FIRSTLETTER%///$trim($if2(%ALBUMARTIST%,%ARTIST%),.)///$if(%DATE%,%DATE% - ,)$if2(%ALBUM%,%NONALBUMTRACKS%,[Other]) )
$if(%RELEASETYPE%,[%RELEASETYPE%],)%BARCODE%$if(%INCOMPLETE%,[%INCOMPLETE%],)[%EXT%]///
$if(%DISCNUMBER%,%DISCNUMBER%-,)%TRACKNUMBER%. %ARTIST% - %TITLE%
 Picard has preview examples, so copying the whole script into file naming script under options should make this definitely clear.
Ambrevar wrote:Thinking about it, a similar feature is provided by most library managers where you can choose filters and tree structure and so on. It remains virtual though, it does not touch the filesystem. Is it really necessary to you to have that sort of view directly on your filesystem? The problem of the filesystem view seems very complex to me.
Not all devices provide that capability. It is more pleasant to work with that approach than previous structures I used, remember that I can restructure the whole library at any time and probably copy the local one elsewhere using the new structure, but I have not looked into that yet.
 We probably have very different experiences, I see this as very comfortable and convenient. Before that I had been using folders for different file types in the main directory, but it ended up with so many entries for FLAC and MP3, that parsing that directories in a player or any maintenance using a file browser/terminal was too troublesome/slow. So I reduced the number of files, by using the alphabet and additional characters as sorting mechanism. And since that was one step away from separating compilations from albums/single releases, I did that also. Now I can access the whole library very quickly, even when one or two additional characters need to be typed.
Ambrevar wrote:Furthermore, would you consider this to be an automated task or a manual one? Using your example, how can a program know that Lauge & Baba Gnohm is both Lauge and Baba Gnohm if no tags says so?
 Both, I want as always full control. MusicBrainz [database] relations.
Ambrevar wrote:Hard links do not work for folders.
Symlinks cause problems with most file browsers that do not follow them during copying.
 I do not recall writing they should link folders, the directory structure would have to be [re]build and then files [hard/sym]linked, which might pose a maintenance issue, although deleting links and empty directories not really, but "leftovers" like covers could block cleaning. *The only file browser* I would recommend is Proto from a very friendly Polish programmer named Mieszko Lassota, but it is, or at least was last time I checked, Windows only and slowly further developed, although still kills every mc, mucommander and ranger on sight, that is how I remember it. SpaceFM is bearable, but I still only use rsync to copy files and see no point using anything else.
Ambrevar wrote:Can you elaborate on this? What are the limitations of Picard beyond symlinking? It could be interesting to know what feature you would like.
 The recursive/linking aspect it the main point here. I hope this is not too big of a disappointment. Having too long names has also been a problem in few cases, classical music if I recall correctly, but those are limitations of the file system, however even that could be overcome with Picard, but the code would not be as easily readable as it is now. The question would be what should be abbreviated/priorities, what to do when after abbreviation the directory/file names are still too long and so on. I had to do it by hand these few times. Picard does not handle covers/images well in my experience, but I used something else for that, puddletag I think. I would have to continue to organize the library to remember.
 Furthermore, not all media players/organizers do have the capability to get exactly this structure with formatting, leading letters and distinction between compilations and albums being two examples. Browsing this robust file structure with ncmpcpp is very efficient, I almost never use the library view. As long as a media player has the browsing capability, I have the same view/behavior. And other hardware also works without issues. Yes, it basically comes down to having the file system do, what media players should, however with a few exceptions I had only positive results for more than almost two years now. Do you now see benefits of having that file structure?
 Again I will take a look at your tool, when I find some time and what progandy suggested also of course. How do you save your music on the file system?
Edit: Style. Clarification.
Last edited by emeres (2014-09-12 13:02:34)

Similar Messages

  • Musish - a dynamic and extensible music library organizer (in CLI!)

    Note: this program is deprecated and has been superseeded by Demlo.
    Musish organizes your music library automatically and dynamically. It runs a user-defined script using variable such as tags and file properties. This way it yields virtually unlimited customization power to the user.
    Example: your music library is a a perfect definition of "chaos".
    No folder structure.
    Tags are not homogeneous, some entries are filled, other not, it varies from file to file.
    Some files have bad audio quality.
    Audio codecs are not always the same. Some file are CBR/VBR, lossless/lossy, ...
    mp3's ID3 tags is a nightmare.
    Covers are sometimes embedded in tags, you have a lot of bad quality covers.
    A few scripts are already provided and they give a good example of what you can do. You can choose to use them, to rewrite them, or to write a new script from scratch. You can preview the changes, and once you are done you call the program over you music library, it will process everything in one single run!
    Move all files according to a unique, yet dynamic folder hierarchy. For instance, setting
      filename="$library/$artist/${album:+${date:+$date - }$album/}${track:+$track - }$title.$ext"
    will move the "john doe - 1. intro.mp3" to "/home/$USER/musics/John Doe/2013 - Great Album/01 - Intro.ogg".
    Case checking: a powerful gawk script that will turn everything to title case. It supports special cases such as Roman numerals, McDonald, etc. It also supports a list of exceptions (e.g. AC-DC).
    Encoding: you can conditionally re-encode you files. For instance, if the input is lossless, you can encode to FLAC, if it is lossy, you can encode to OGG. You can choose to only re-encode files with some particular encoding settings. You can set the desired bitrate, etc.
    Covers: automatically remove embedded covers, remove duplicates, remove files beyond/below a quality threshold, etc.
    Different kinds of music: classic, OST, and band musics have usually different kings of tags and folder structure. You can manage different audio libraries easily by setting the corresponding "library" variables.
    This program is completely written in POSIX Shell + gawk. This leads to a lightweight codebase (less than 1000 lines), and near universal portability.
    Dependencies:
    ffmpeg
    POSIX awk
    POSIX shell
    Optional:
    cuetools
    jshon
    AUR package: git version
    Official web page: https://bitbucket.org/ambrevar/musish
    Please file bug reports on the issue tracker, not on this forum, thanks!
    Warning: this program has been tested for a while, but some bugs might still be floating around. Make sure to backup your data before proceeding.
    Last edited by Ambrevar (2014-09-11 09:32:49)

    FFmpeg is always run, at least for the metadata editing part (i.e. tags). It does not necessarily means that the audio track will be changed.
    If no script is provided, the file is not reencoded. Actually it is not modified at all. This is the 'raw default' behaviour with -s "".
    However the default configuration file sets a "default" script that is run by default. This script does always transcode. This is a debatable choice: maybe I should remove the default script and let the user choose his/her own default script. What do you think?
    Regarding the lossy trancoding, the rules are as follows: if the output format is the same as the input and bitrate is still the same, we do not transcode. But for some reasons you may want to lower the bitrate (e.g. smaller file size), in which case we do transcode.
    Another major reason for lossy transcoding: switching from mp3 to a decent format (ogg, aac...). An mp3 music library is a nightmare to maintain (different ID3 version, CBR/VBR, etc.).
    The man page definitely needs some clarifications. Feel free to comment!
    Last edited by Ambrevar (2013-12-09 14:49:52)

  • Cleaning and Updating Music Library's

    I created a large music library from many CD’s and organized them into several sub-folders by artist name within a master “My Music Folder”. I then imported the “My Music Folder” into iTunes. The process worked great but when I reviewed the details in iTunes and on my iPod, I found duplicates, some misspellings, and duplicate artist names (i.e. “Beatles” and “The Beatles; “Clash” and “The Clash” I would like to clean up the library and organize the music to reduce the duplicates, simplify the artist list by a common name, and correct wrong information and in some cases add info to the artists.
    My question is where is the best place to make these changes so that I can have one integrated and master music library incorporating the changes? Should the edits be done in the original folders or should the edits be done in iTunes and then saved as a new exported library? Or is there a better or recommended way?
    Thank you,

    Use the (free) software Mp3tag. It can do 'Actions' to update, e.g. all "The Beatles" by "Beatles" etc. I just cleaned my ~4,000 songs library using that. iTunes is doable, but nowhere near as flexible. You may want to clean everything first and then reimport everything into iTunes for cleanest results.

  • The error message I get on my PC is "The ITunes library file cannot be saved" An unknown error occurred (-50)and my music library has disappeared.  I recently tried to copy a CD to my library - it appeared to copy ok but then did not appear in my music li

    The error message I get on my PC is "The ITunes library file cannot be saved" An unknown error occurred (-50)and my music library has disappeared.  I recently tried to copy a CD to my library - it appeared to copy ok but then did not appear in my music library.  The library does not show up even when my iPad is connected to my PC.  My entire library is now held on my iPad and I wish to have it in iTunes so I can sync my iPhone to it as well.  Help?

    Don't know what changed today but it downloaded and installed on the shuffle. So far so good.

  • Changing default directory for iTunes Library.itl and iTunes Music Library.

    I need to change the default directory for the files iTunes Library.itl and iTunes Music Library.xml permanently.
    It must be relocated from the My Documents directory due to VPN reasons.
    Has anybody an idea if this is possible? I could not find a corresponding registry entry.
    Notebook Windows XP Pro

    Using TweakUI to Move or Create Your Library/My Music Location
    Use TweakUI (See: ’Disk is locked’ or ‘iTunes folder cannot be found’ when installing or opening iTunes ) to create a 'My Music' folder in a spot where you desire. iTunes should then find this location and deposit its Library files there, and the 'iTunes' folder and sub-folders as well (if you direct it to).
    First, see this Article for some background information: What are the iTunes Library files?
    If you cannot see the ‘My Music’ folder within the TweakUI drop-down selection, proceed on to the following:
    1 On the start menu go to ‘Run’
    2 Type in RegEdit
    3 Navigate in RegEdit to HKEYCURRENTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
    4 Delete any entry for ‘My Music’
    5 Navigate up the tree to HKEYCURRENTUSER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
    6 Make sure there is an entry for ‘My Music’ and is pointing to C:\Documents and Settings\[username]\My Documents\My Music (you can edit the value by double clicking it)
    7 Close RegEdit
    8 Reboot
    iTunes &/or TweakUI should now be able to find the folder.

  • Airplay and iTunes Music Library

    I tried to stream Christmas music from my MacBook Pro computer's iTunes music library through my ATV2 to a TV while playing pictures and the music would play one or two songs and then the music would stop. Not sure if its the ATV, my computer or what. The computer drive is NOT going to sleep although the screen is blank. Any ideas?

    Be sure all the songs in your iTunes library are checked...... unchecked songs won't play in playlists or shuffle, et.c.

  • ITunes and entire music library lost in compute crash... help needed please

    Evening everyone.
    I lost my iTunes and complete library in computer crash, but music is still on my 4G iPod touch.
    Can I use this to copy my music library back to my PC?
    Thanks
    Anna Marie

    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities

  • Description column and iTunes Music Library.xml??

    I see that there is a column in Itunes called description. I'd like to use it to store information but Itunes doesn't give me access to it. Why is it there then? I tried to open iTunes Music Library.xml file and add a description tag but that doesn't work. Does anybody ever tried to edit the xml file?
    Thanks
    JL
    PC   Windows XP  

    I found an update from sony (entertainment platform update)

  • I just purchased new computer and my music library is empty

    i recently purchase new computer..downloaded itunes but my music library is empty?  can you please help me restore my music.
    thank you
    janet

    Your media is only where YOU put it.  Installing iTunes and signing into your account has never made media magically appear on a computer.
    Copy the media from the old computer to the new computer.
    For instructions, type "move itunes library" into the search bar at the top or your favorite search engine.

  • Upgraded and lost music library except for purchased songs

    I followed the upgrade prompt, and it wiped out my entire music library and playlists except for those songs I had purchased on I-tunes. The hundreds I downloaded from my own purchased CDs are gone. Help!

    I had this happen to me a year ago when I upgraded from an older version. I was saddened when I lost all of my library. I then tried to install the older version that I still had in my recycle bin, and then by some miracle I got back my whole library. To this day I do not know what I did to restore it as I don't understand this process very well. But one thing I do know I will not upgrade. I still have iTunes 6.0 and will keep it. BUT I have another post out there because I can not burn a disk of one of my files. I keep getting the message "iTunes has to close now ...sorry for the inconvience etc." I need an answer to that question. Hopefully someone will be able to help me.

  • I transferred all my music to my new computer, went to sync my iphone and the music library won't sync. It's like it's leaving the old library on and trying to add a duplicate one, keeps saying there isn't enough room. Help please?

    Everything from my old computer is still in the music portion of my phone, I don't know how but it hasn't synced that part.  I went through and edited the new library and there are fewer songs, it's telling my I don't have enough room on my phone.  This is impossible when it is less music than I am currently holding.  How do I get it to delete the old information and put on the new library?

    How exactly was the music transferred to the new computer?
    The correct way is to copy the ENTIRE iTunes folder from the old computer to the new computer.  If it was transferred properly there are no issues with syncing to the iOS device.

  • Associating music files with palylists and/or music library

    My HD went out but luckily (I thought) I had a backup of my iTunes folder on an external drive. After installing the new hard drive and all the updates to TIGER 10.4.x I copied my original iTunes folder to new drive to the music folder.
    I see all my files in my library and play lists, but they all have an "!" by them and when I choose a particular song, a message comes up saying that iTnes can NOT find the associated music file (even though the file is actual there in the iTUnes folder and on my HD). Short of manually associating every library/playlist song with the actual music file (more that 2,000 files), is there any automated process or method to associate all the music files with the library/playlist files?????

    Morris:
    First, back up your iTunes Library file - just in case the original gets damaged, you will have a clean copy to restore to.
    *From the File menu, select Export Library and save as an .xml file to your desktop.
    *Go to iTunes Preferences>>Advanced, and make sure that you have DESELECTED Copy music to iTunes folder when adding to library and SELECTED Keep iTunes Music folder organized.
    *Close iTunes
    *Now, go to the ~/Music/iTunes folder and remove the
    b iTunes Library
    file from this folder.
    *Restart iTunes - your Source Menu and Library should be empty of everything except the standard preset playlists.
    *From the File Menu, select "Add to Library" and navigate to the location of your music files.
    *When the import process is finished, go to the File Menu, select Import and navigate to the Library.xml file you created in the first step.
    Your links between songs should be reestablished and your metadata intact.
    Good luck and let us know how you make out.
    Lita

  • Need help managing two iphones, two iTunes accounts, and one music library

    We have digitized all our music and it's successfully set up on an external hard drive. This is all great for me, as my iphone is synced to my iTunes account, so everything is set.
    Problem is my husband set up his own iTunes account with his iphone and now he wants to access the music on our home computer/iTunes account.
    So what we have is:
    USER A =
    computer + digital hard drive w/music (managed by iTunes account A)
    iTunes account A
    iphone A (synced with iTunes account A)
    USER B =
    iTunes account B
    iphone B (synced with iTunes account B)
    iTunes account B = very few music files + lots of Aps
    What we want is for USER B to be able to access the computer + digital hard drive w/music (managed by iTunes account A), but retain his Aps that he's purchased for his iphone.
    I hope this is clear. Can someone tell us the best way to accomplish getting USER B access to our home music collection?
    Thanks!

    My problem is similar, except for 3 different devices: IPod Nano, Old style Shuffle, and Iphone 3Gs.
    To answer one post as to "why" different accounts... 1 pre-teen user; wife/husband have (maybe) a 10 song overlap in the library, and I have tons of apps.
    Ok, all I want to do is play the same stuff on my home computer as on my work computer. There are 3 I-tunes accounts on my home computer (mine is one). My apps/movies and music don't show up on this computer, even though it has been authorized. I have synced the phone, but no changes, even after adjusting the prefs. Oh, and this is a side note, my Outlook calendars are not playing well together either. My home Outlook is "stand alone" while my work calendar is accessed by others all the time and both appts and email are "pushed" to my phone. (This is not a big deal, however)
    All I want is to be able to use my home computer to get MY movies and songs onto my I-phone (from the home computer)-- and download new stuff, that once I put on my phone will transfer to my work computer when I plug sync my phone and work computer together.
    Honestly, I don't need my wife's stuff or my kid's stuff, nor do I need for them to have my stuff. I don't care if we do share, I just don't want to chew up the memory on my phone with "Kidz Bop Vol 1-99", etc.
    My work computer is my primary for my Itunes. If you are still with me, please help. Thanks!

  • Downloaded itunes 8 and my music library disappeared! HELP PLEASE!

    Is there any way to get my library back after downloading itunes 8? It cleared everything - all my music, playlists....
    and no....I do not have my music saved to disc/or external harddrive yet....

    When you open iTunes do you have the dreaded ! next to each tune? If so then you need to put the tunes back where they were before the problem occurred. Are your PL listed on the left side?
    The default path for iTunes is HD>Users>My Account>Music>iTunes>iTunes Music. iTunes music is where the folders would be nested by Artist>Album>Tune.
    If in iTunes prefs>Advanced you have selected the options to 'keep' and 'copy' the above path is the normal place where your tunes should be. This is also where you set the path for iTunes to go find your tunes.
    MJ

  • Discrepancy between iTunes Library and iTunes music library in Finder

    iTunes is reporting that I have 2313 files @ 13.96GB
    but when im looking at the iTunes music folder within Finder(username/Music/iTunes/iTunes Music, Finder reports that I've got 4400 files @ 20.13GB
    iTunes is set to control my library at that folder.
    What's going on here...?
    This is all under osx 10.6.2 and iTunes 9.0.2
    Thanks
    Calvin
    <Titled edited by Host to reflect intent of original poster>
    Message was edited by: Host

    The stats at the bottom of the screen when you look at the Music section of your library are just for music, there are separate totals for Movies, TV Shows, Podcasts, iTunes U, Audiobooks, Applications & Ringtones. When you look at *iTunes\iTunes Music* in Finder this will contain all the files from all the sections. It is also possible that you have at some point deleted files from iTunes without deleting them from the hard disk or manually placed files within the iTunes Music folders and then neglected to import them into iTunes. If you have any *iTunes LPs* these will count as a single file in the iTunes library but typically contain 100s of individual files (html, artwork, scripts etc.). I don't know about Macs, but on a PC if the library is also accessed by Windows Media Player then there can be artwork placed in album folders adding to the file count shown in the operating system.
    In short there is no reason to expect the numbers & sizes to match. That said, it is still possible that there are files in your folders that are not in your library, and vice versa. The following from Doug's AppleScripts for iTunes should help you check for any discpreancies:
    Music Folder Files Not Added v2.0 - Lists files in your music folder that are not in your library.
    List MIAs v1.2 - Lists files in your library that are not in your music folder.
    tt2

Maybe you are looking for

  • Noob needs help with site creation -- interactive?

    I want to make a site where people can post and/or reply to other posts. I've used iWeb for a couple years so I'm good with "static" sites but how can I make one where people can post to the site themselves? For example, I write ::"what is your favor

  • Scheduling Agreement Release

    Hi All Scheduling agreement is created & released. Release indicator is 6, after the release again some line items are blocked & some line items are deleted without affecting any characteristic of release strategy ( No Change in value , Document type

  • Automatic payment printing error:Program RFFOUS_C: No records selected

    Hi, I need to excute printing after payment with f110 using program RFFOUS_C. I have done the following configurations: - Assigned SAPScript in 'payment methods in company code' in Tcode FBZP. - Assigned printing program in 'payment method in country

  • Large numbers calculation problem (determinant calculation)

    Hello experts, I have really interesting problem. I am calculatig determinant in ABAP with a large numbers (in CRM 5.0 system). My formula for determinant is : FORM calculate_determinant USING    det      TYPE zsppo_determinant                       

  • RAW Reprocessing

    I don't recall this in ver 5, but now when I import my RAW files from my nikon d70 and then try to click and drag it from iphoto 6 to the photoshop cs icon in order to open it in adobe camera raw it comes up as a jpeg. Previously, that would only hap