This commit is contained in:
Ignacio Serantes
2026-05-09 10:26:57 +02:00
parent 3fb55ee4f3
commit 6207cab27a
7 changed files with 622 additions and 177 deletions

View File

@@ -5,7 +5,7 @@ Bagheera Search Tool - CLI Client
"""
__appname__ = "BagheeraSearch"
__version__ = "1.0"
__version__ = "1.1"
__author__ = "Ignacio Serantes"
__email__ = "kde@aynoa.net"
__license__ = "LGPL"
@@ -24,9 +24,9 @@ from bagheera_search_lib import BagheeraSearcher
# --- CONFIGURATION ---
PROG_NAME = "Bagheera Search Tool"
PROG_ID = "bagheerasearch"
PROG_VERSION = "1.0"
PROG_BY = "Ignacio Serantes"
PROG_DATE = "2026-03-19"
PROG_VERSION = __version__
PROG_BY = __author__
PROG_DATE = "2026-05-09"
CONFIG_DIR = Path.home() / ".config" / PROG_ID
CONFIG_FILE = CONFIG_DIR / "config.json"
@@ -61,9 +61,9 @@ Baloo offers a rich syntax for searching through your files. Certain attributes
For example 'type' can be used to filter for files based on their general type:
type:Audio or type:Document
type:Audio OR type:Document
The following comparison operators are supported, but note that 'not equal' operator is not available.
The following comparison operators are supported, but note that 'not equal' (!=) operator is not available.
· : - contains (only for text comparison)
· = - equal
· > - greater than
@@ -72,7 +72,6 @@ The following comparison operators are supported, but note that 'not equal' oper
· <= - less than or equal to
Currently the following types are supported:
· Archive
· Folder
· Audio
@@ -83,9 +82,77 @@ Currently the following types are supported:
· Presentation
· Text
These expressions can be combined using AND or OR and additional parenthesis, but note that 'NOT' logical operator is not available.
These expressions can be combined using logical operators 'AND' or 'OR' and additional parenthesis, but note that 'NOT' logical operator is not available.
The full list of properties which can be searched is listed below. They are grouped by file types.
All Files
· filename
· mimetype
· modified
· rating
· tags
· userComment
Audio
· Album
· AlbumArtist
· Artist
· BitRate
· Channels
· Comment
· Composer
· Duration
· Genre
· Lyricist
· ReleaseYear
· SampleRate
· TrackNumber
Documents
· Author
· Copyright
· CreationDate
· Generator
· Keywords
· Language
· LineCount
· PageCount
· Publisher
· Subject
· Title
· WordCount
Media
· AspectRatio
· FrameRate
· Height
· ImageDateTime
· ImageMake
· ImageModel
· ImageOrientation
· Images
· PhotoApertureValue
· PhotoDateTimeOriginal
· PhotoExposureBiasValue
· PhotoExposureTime
· PhotoFlash
· PhotoFNumber
· PhotoFocalLength
· PhotoFocalLengthIn35mmFilm
· PhotoGpsAltitude
· PhotoGpsLatitude
· PhotoGpsLongitude
· PhotoISOSpeedRatings
· PhotoMeteringMode
· PhotoPixelXDimension
· PhotoPixelYDimension
· PhotoSaturation
· PhotoSharpness
· PhotoWhiteBalance
· Width
[... omitted for brevity, but includes the full list of searchable properties as in your original script ...]
{PROG_NAME} recognizes some natural language sentences in English, as long as they are capitalized, and transforms them into queries that can be interpreted by the search engine.
@@ -93,21 +160,18 @@ Supported natural language sentences and patterns for queries are:
· MODIFIED TODAY
· MODIFIED YESTERDAY
· MODIFIED THIS [ DAY | WEEK | MONTH | YEAR ]
· LAST <NUMBER> [ DAYS | WEEKS | MONTHS | YEARS ]
· <NUMBER> [ DAYS | WEEKS | MONTHS | YEARS ] AGO
· MODIFIED LAST <NUMBER> [ DAYS | WEEKS | MONTHS | YEARS ]
· MODIFIED <NUMBER> [ DAYS | WEEKS | MONTHS | YEARS ] AGO
<NUMBER> can be any number or a number text from ONE to TWENTY.
Remarks: LAST DAY, if used, is interpreted as YESTERDAY.
Supported expressions for --exclude and --recursive-exclude are:
· width<CMP_OP>height - only if file has width and height properties
· height<CMP_OP>width - only if file has width and height properties
· PORTRAIT - only if file width is greater or equal to height
· LANDSCAPE - only if file height is greater or equal to width
· SQUARE - only if file width equals to height
<CMP_OP> can be: != | >= | <= | = | > | <"""
The --exclude and --recursive-exclude options allow you to filter files out of the results. The syntax for both options supports parentheses and logical operators (AND, OR, and NOT) to combine multiple patterns.
In addition to standard query comparison operators, the not equal (!=) operator is available for comparing properties against specific values. Furthermore, you can compare two properties directly; for example, 'width > height' is a valid expression.
Remarks:
· All text comparison are case insensitive.
· Tags comparisons are performed against both individual full tag string (using the '/' character as a level separator) and each individual level. All individual level values are normalized to lowercase and stripped of accents or diacritics. For example, a file tagged as 'Opera,Person/María Callas,Singer' would match any of the following elements: ['Opera', 'Person/María Callas', 'Singer', 'callas', 'maria', 'opera', 'person', 'singer']."
· Only text and numeric data are supported."""
print(help_query)
@@ -146,7 +210,7 @@ def main():
parser.add_argument("--day", type=int, help="day fixed filter, --month is required")
parser.add_argument("--month", type=int, help="month fixed filter, --year is required")
parser.add_argument("--year", type=int, help="year filter fixed filter")
parser.add_argument("--year", type=int, help="year fixed filter")
parser.add_argument("--help-query", action="store_true", help="show query syntax help")
parser.add_argument("--version", action="store_true", help="show version information")
@@ -163,7 +227,7 @@ def main():
raise ValueError("Missing --month (required when --day is used)")
if args.month is not None and args.year is None:
raise ValueError("Missing --year (requered when --month is used)")
raise ValueError("Missing --year (required when --month is used)")
if args.help_query:
print_help_query()