Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 02-02-2025, 11:47 AM   #1
rhubarb93
Junior Member
rhubarb93 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2025
Device: Kindle Scribe, Kobo Colour
Custom column - file formats

Hello there.

Thanks for allowing me to join for forum.

I've been using Calibre for a while, but it's only now that I've sat down to organise all my books and audio books.

I've got about 680 books so far, with about 35 or so that have an audiobook version. I've added the audiobooks into Calibre - they have file formats of .m4a, .m4b, and .mp3.

I'm trying to create a custom column that uses the Formats column to check for those file formats and then populate an 'Audiobook' column with the text 'Audiobook available' or something similar.

I can get it to work with this code for one format,
Code:
program: contains(field('format'),'m4a','Audiobook available','')
so if a title has a format of .m4a, the 'Audiobook' column will show 'Audiobook available', but I can't figure out how to modify this so it will pick up .m4b and .mp3 files. I assume it will need some sort of nested statement or something - my programming knowledge stops at VB.net!!

Any help would be appreciated.

Thanks in advance
rhubarb93 is offline   Reply With Quote
Old 02-02-2025, 12:11 PM   #2
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,174
Karma: 1988646
Join Date: Aug 2015
Device: Kindle
Code:
program:
    contains(field('format'), '(mp3|m4a|m4b)', 'Audiobook available', '')
Edit: The pattern highlighted in blue, is a regular expression that can match multiple formats.

Last edited by capink; 02-02-2025 at 12:20 PM.
capink is offline   Reply With Quote
Old 02-02-2025, 12:16 PM   #3
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,269
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Something like
Code:
program:
    If 'm4a|m4b|mp3' inlist $formats then 'Audiobook available' fi
chaley is offline   Reply With Quote
Old 02-02-2025, 01:17 PM   #4
rhubarb93
Junior Member
rhubarb93 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2025
Device: Kindle Scribe, Kobo Colour
Thank you! This worked perfectly!

Quote:
Originally Posted by capink View Post
Code:
program:
    contains(field('format'), '(mp3|m4a|m4b)', 'Audiobook available', '')
Edit: The pattern highlighted in blue, is a regular expression that can match multiple formats.
rhubarb93 is offline   Reply With Quote
Old 02-02-2025, 01:19 PM   #5
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 822
Karma: 409968
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
I have something like this to tell me if it is an audio format.
This will say yes or no according to the format

Code:
program:cmp(count(template('[[format]]'), ','), 1, 'no', in_list(template('[[format]]'), ',', 'Ogg', 'Yes', 'no', ',', 'M3u', 'Yes', 'no', ',', 'M4a', 'Yes', 'no', ',', 'Mp3', 'Yes', 'no'), 'no')

Last edited by dunhill; 02-02-2025 at 01:38 PM.
dunhill is offline   Reply With Quote
Old 02-02-2025, 02:52 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,500
Karma: 29709834
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by capink View Post
Code:
program:
    contains(field('format'), '(mp3|m4a|m4b)', 'Audiobook available', '')
Edit: The pattern highlighted in blue, is a regular expression that can match multiple formats.
I use similar templates to attach audio and/or video icons to 'books' that have audio and/or video format files.

BR
BetterRed is offline   Reply With Quote
Old 02-02-2025, 08:03 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,780
Karma: 59840450
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
You could just use the basic search, then Tag all the results. No need for a custom column.

Code:
format:mp3 or format:m4a or format:m4b
Then select all (results)
The use the MDE (in bulk mode) to Add a Tag "has audiobook"
theducks is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom column to show a truncated file path TreeFrogBandit Library Management 2 02-28-2020 07:11 PM
Using RE to extract pattern from custom column into another custom column activedirectory Library Management 1 12-15-2019 08:07 PM
Custom column returns value based on value of another custom column? calvin-c Calibre 3 09-14-2013 02:24 PM
Library - Custom Column with File Name AmerInstOfBi Library Management 3 04-26-2013 11:29 AM


All times are GMT -4. The time now is 08:36 PM.


MobileRead.com is a privately owned, operated and funded community.