Skip to content

Commit

Permalink
paths processing improvements, tooltips update
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrj committed Dec 22, 2023
1 parent 06b55a5 commit 0e11254
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

A cross-platform GUI file cataloging program with extensive customization options to suit user preferences. Highly optimized for multi-core parallel search speed, data integrity, and repository portability.

**The software and this document are under development and in a Release Candidate (2) state.**
**The software and this document are under development and in a Release Candidate (3) state.**

## Features:
The primary purpose of this software is to enable users to catalog their files, particularly on removable media like memory cards and portable drives. It allows user to add metadata, referred to here as **custom data**, and facilitates future searching through the created records. **Custom data** consists of textual information acquired through the execution of user-chosen commands or scripts. **Custom data** may include any text data customized to meet the user's requirements, restricted only by the available memory and the software accessible for data retrieval. The retrieved data is stored in a newly created database record and can be utilized for search or verification purposes. **Liber** allows you to search files using regular expressions, glob expressions and **fuzzy matching** on both filenames and custom data. Created data records can be exported and imported to share data with others or for backup purposes.
The primary purpose of this software is to enable users to catalog their files, especially on removable media such as memory cards and portable drives. It allows user to add metadata, referred to here as **custom data**, and later search the created records with multiple cryteria. **Custom data** consists of textual information acquired through the execution of user-chosen commands or scripts. **Custom data** may include any text data customized to meet the user's requirements, restricted only by the available memory and the software accessible for data retrieval. The retrieved data is stored in a newly created database record and can be utilized for search or verification purposes. **Liber** allows you to search files using regular expressions, glob expressions and **fuzzy matching** on both filenames and **custom data**. Created data records can be exported and imported to share data with others or for backup purposes.

## Screenshots:

Expand Down
Binary file modified info/scanning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 11 additions & 25 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,36 +172,22 @@ def prepare_LUTs():
prepare_LUTs()

def get_command(executable,parameters,full_file_path,shell):
if windows:
full_file_path = full_file_path.replace('/',sep)

if ' ' in full_file_path:
full_file_path = f'"{full_file_path}"'

if shell:
res = executable

if PARAM_INDICATOR_SIGN not in res:
res = res + ' ' + PARAM_INDICATOR_SIGN
if PARAM_INDICATOR_SIGN in executable:
res = executable.replace(f'"{PARAM_INDICATOR_SIGN}"',PARAM_INDICATOR_SIGN).replace(f"'{PARAM_INDICATOR_SIGN}'",PARAM_INDICATOR_SIGN).replace(PARAM_INDICATOR_SIGN,f'"{full_file_path}"')
else:
res = executable + ' ' + f'"{full_file_path}"'

res = res.replace(PARAM_INDICATOR_SIGN,full_file_path)
res_info = res
return res,res
else:
if PARAM_INDICATOR_SIGN not in parameters:
parameters = parameters + ' ' + PARAM_INDICATOR_SIGN

if not parameters:
parameters=PARAM_INDICATOR_SIGN

parameters = parameters.replace(f'"{PARAM_INDICATOR_SIGN}"',PARAM_INDICATOR_SIGN)
parameters = parameters.replace(f"'{PARAM_INDICATOR_SIGN}'",PARAM_INDICATOR_SIGN)

parameters_list = [p_elem.replace(PARAM_INDICATOR_SIGN,full_file_path) for p_elem in parameters.strip().split() if p_elem]

res = [executable] + parameters_list
res_info = ' '.join(res)
res = [executable] + [full_file_path]
elif PARAM_INDICATOR_SIGN not in parameters:
res = [executable] + parameters.strip().split() + [full_file_path]
else:
res = [executable] + [p_elem.replace(PARAM_INDICATOR_SIGN,full_file_path) for p_elem in parameters.replace(f'"{PARAM_INDICATOR_SIGN}"',PARAM_INDICATOR_SIGN).replace(f"'{PARAM_INDICATOR_SIGN}'",PARAM_INDICATOR_SIGN).strip().split() if p_elem]

return res,res_info
return res,' '.join(res)

def kill_subprocess(subproc):
try:
Expand Down
9 changes: 5 additions & 4 deletions src/librer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,9 +1084,10 @@ def get_scan_dialog(self):
use_tooltip = "Mark to use CD Extractor"
mask_tooltip = "glob expresions separated by comma (',')\ne.g.: '*.7z, *.zip, *.gz'\n\nthe given executable will run\nwith every file matching the expression\n(and size citeria if provided)"
max_tooltip = min_tooltip = 'Integer value [in bytes] or integer with unit.\nLeave the value blank to ignore this criterion.\n\nexamples:\n399\n100B\n125kB\n10MB'
exec_tooltip = "A binary executable or batch script that will run\nwith the full path to the file to be extracted as a parameter.\nThe executable may have a full path, be located in a PATH\nenvironment variable, or be interpreted by the system shell"
exec_tooltip = "Binary executable, batch script, or entire command\n(depending on the 'shell' option setting)\nthat will run with the full path to the scanned file.\nThe executable may have a full path, be located in a PATH\nenvironment variable, or be interpreted by the system shell\n\ncheck 'shell' option tooltip."
pars_tooltip = f"The executable will run with the full path to the file to extract as a parameter.\nIf other constant parameters are necessary, they should be placed here\nand the scanned file should be indicated with the '{PARAM_INDICATOR_SIGN}' sign.\nThe absence of the '{PARAM_INDICATOR_SIGN}' sign means that the file will be passed as the last parameter.\ne.g.:const_param % other_const_param"
shell_tooltip = "Execute in the system shell\n\nWhen enabled\nCommand with parameters will be passed\nto the system shell as single string\nThe use of pipes, redirection etc. is allowed\nExample:\n7z l % | tail -n +14\n\nWhen disabled\nAn executable file must be specified,\nthe contents of the parameters field will be\nsplitted and passed as a parameters list.\n\nIn more complicated cases\nit is recommended to prepare a dedicated shell\nscript and use it as a shell command."
shell_example = '"C:\\Program Files\\7-Zip\\7z.exe" l % | more +13' if windows else "7z l % | tail -n +14"
shell_tooltip = f"Execute in the system shell\n\nWhen enabled\nCommand with parameters will be passed\nto the system shell as single string\nThe use of pipes, redirection etc. is allowed.\nUsing of quotes (\") may be necessary. Scanned\nfiles will be automatically enclosed with quotation marks.\nExample:\n{shell_example}\n\nWhen disabled\nAn executable file must be specified,\nthe contents of the parameters field will be\nsplitted and passed as a parameters list.\n\nIn more complicated cases\nit is recommended to prepare a dedicated shell\nscript and use it as a shell command."
open_tooltip = "Point executable as custom data extractor..."
timeout_tooltip = "Timeout limit in seconds for single CD extraction.\nAfter timeout executed process will be terminated\n\n'0' or empty field means no timeout."
test_tooltip = "Select a file and test your Custom Data Extractor.\n\nBefore you run scan, and therefore run your CDE on all\nfiles that will match on the scan path,\ntest your Custom Data Extractor\non a single, manually selected file.\nCheck if it's getting the expected data\nand has no unexpected side-effects."
Expand Down Expand Up @@ -3413,7 +3414,7 @@ def cde_test(self,e):
except:
timeout_int = None

command,command_info = get_command(executable,parameters,full_file_path,shell)
command,command_info = get_command(executable,parameters,normpath(full_file_path),shell)

info = command_info + '\n' + ( ('\ntimeout:' + str(timeout_int)) if timeout_int else '') + f'\nshell:{"Yes" if shell else "No"}'

Expand Down Expand Up @@ -3748,7 +3749,7 @@ def show_customdata(self):

expressions,use_smin,smin_int,use_smax,smax_int,executable,parameters,shell,timeout,crc = record.header.cde_list[rule_nr]

file_path = record.header.scan_path + sep + sep.join(subpath_list)
file_path = normpath(sep.join([record.header.scan_path,sep.join(subpath_list)]))

cd_txt = cd_data

Expand Down

0 comments on commit 0e11254

Please sign in to comment.