Columns: Books & Comics Filename Database

After making the Movie Filename Database script, I adapted it for books and comics.

This is what the script does for books and comics in any file format. There are many other columns not shown.


I'm really excited about this way of working with files and look forward to feedback and a fruitful discussion. Apart from feedback on this script, I am particularly interested in hearing your thoughts about using file naming conventions to manage metadata.

Quick Tour

1. The script is based on RegexColumnsReloaded (mmm, actually it's the other way around)

2. There is a full tutorial on my new page about Using File Names to Make a Database

3. It showcases how if you use a simple naming convention, Opus can display any column you invent for files of any kind.

4. You can adapt this simple naming convention to files of any kind.
In fact I adapted it from the Movie Filename Database Script.

The basic convention for a file is:
Title [metadata].extension

Inside the brackets, the metadata looks like this:
[year=1994_auth=Enki Bilal]

  • It is a sequence of key=value, separated by underscores.
  • The fields can be specified in any order.
  • Many fields have aliases in case you don't remember the name.
  • For each file, you only specify the fields you want.

5. Adding or editing columns is a snap. The column definitions have really cool features. See the section of the tutorial on editing and defining fields.

6. The Books & Comics Format Button
The button toggles a Comics format you specify in Prefs / Folder Formats / Favorite Formats. (If you prefer to use the Content Type Format in the same menu, the function's code is easy to adapt.)

Toggle Book View.dcf (546 Bytes)

7. List of fields


8. Books+Comics format
You will want to make a Books+Comics format either in
Prefs / Folder Formats / Favorite Formats
or in
Prefs / Folder Formats / Content Type Formats

In that format, I recommend shrinking the filename column, as you don't need to display it. Even when the file name is shrunk, you can easily select the file when enable full row selection in on (clicking anywhere on the row selects the file). The Movie button toggles full row selection so you shouldn't have to worry about that.

This is what my current view looks like.

9. Bulk addition of metadata on many files
This is a rename problem. See the bulk metadata operations section of the tutorial.

In short, you can set up rename presets.

Here's one which inserts a sample token ( cc=US token ) if you already have [metadata in brackets]:

  • Opus rename in regex mode
  • Search for ^([^\]]+)(\].*)
  • Replace with \1_cc=US\2
  • Save the preset, adapt when needed.

10. Limitation
Please bear in mind that Windows has a limit on the total length of path + file name: 260 characters. That's a lot of characters but it's good to keep in mind. Better now bury the files deep in the file hierarchy.

11. Download
Book+ComicsFilenameDB.js.txt (37.2 KB)

12. Changelog
0.9.3 Bug fix
0.9.2 At tbone's request, changed the column prefix from Book+Comics_ to Book+Comics.
0.9.1 Added three properties (got these ideas from Apocalypse): fileOnly, dirOnly, fullCupValue.


Script Code:

If you're just interested in how the buttons and script work, without downloading anything, see the similar Columns: Movie Filename Database post, which includes code in the forum post.

While investigating a crash in the thread below, we found that this script was the trigger. It most likely only happens if it's configured in a certain way. Jon suggests a 1 line change which should prevent the crash:

We'll also be changing Opus so that future versions won't crash with this kind of thing. (Scripts shouldn't be able to crash the program, at least not just by setting something to null.) But it might be worth updating the script as well, for current/previous versions (Opus 11 users in particular).

Thank you!
Edited the original post with the new file containing the suggested change.

1 Like