Closed snowyoneill closed 8 months ago
Interesting! Pinging @vapniks, who knows the zsh bindings best, to see if they have any insight. Perhaps the insight about the missing directory helps?
Hi, I am also having this issue.
When using beet import and ZSH (autocomplete) I get the following errors every time:
_beet:zregexparse:4: invalid regex : )
_beet:zregexparse:4: invalid regex : )
_beet:zregexparse:4: invalid regex : )
My configuration (output of beet config
) is:
library: ~/beets.db
directory: /mnt/ORGANIZED_MUSIC
plugins: acousticbrainz fetchart lastgenre scrub
paths:
default: $albumartist/$albumartist - $album%aunique{} ($year) [$format]/$track. $title
singleton: Non-Album/$artist ($year) [$format]/$track. $title
comp: Compilations/$album%aunique{} ($year) [$encoder]/$track. $title
lastgenre:
whitelist: yes
min_weight: 10
count: 1
fallback:
canonical: no
source: album
force: yes
auto: yes
separator: ', '
prefer_specific: no
fetchart:
auto: yes
minwidth: 0
maxwidth: 0
enforce_ratio: no
cautious: no
cover_names:
- cover
- front
- art
- album
- folder
sources:
- filesystem
- coverart
- itunes
- amazon
- albumart
google_key: REDACTED
google_engine: 001442825323518660753:hrh5ch1gjzm
fanarttv_key: REDACTED
store_source: no
acousticbrainz:
auto: yes
force: no
tags: []
scrub:
auto: yes
Any help would be appreciated. Thank you!
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This is still an issue for me as of beets 1.6.0
.
Same for me. Beets 1.6.0.
I'll reopen this and mark it as a bug, but I admit I have no insight into how the zsh completions work—so I'll need help from an expert to understand what's going wrong and fix it.
Hi. Same issue on ubuntu 22.04, zsh 5.8.1 (x86_64-ubuntu-linux-gnu), beets version 1.6.0, Python version 3.10.6.
A temporary solution I found is to end the path provided to the beet import
command by a start *
.
For example,
beet import Freaky\ Chakra\ \(1996\)\ Low*
then press the tab key (auto-complete), which do not trigger the above error, and should actually complete the input path to
beet import -wc Freaky\ Chakra\ \(1996\)\ Lowdown\ Motivator
I have the same experience as @Sylk1-9; same issue on Arch, zsh 5.9, beets 1.6.0 python 3.10.10.
I wanted to say thank you to you Sylk1-9, it's really a bother not to have autocomplete! (and something is better than nothing) Your workaround really helps my workflow :D
The error invalid regex : )
is triggered, if the installed awk
command is not mawk
(by Thomas E. Dickey and Michael D. Brennan). The function _join_lines
in the _beet
completion script uses a non-standard regular expression operator {,<number>}
that only mawk
seems to support. This is equivalent to the more widely supported longer form {0,<number>}
.
After adding the missing 0 before the comma, the awk
code inside _beet
contains this regexp: "^[[:space:]]{0,"ARG2"}[^[:space:]]"
and completion of subcommands started to work without that invalid regex error on my system.
To get completion of field values from the database to work (e.g. completing beet list genre:
with a genre already in use), two further changes were required:
_beet_field_values
remove the sed
filtering of the sqlite3
output and simply invoke sqlite3 -list -noheader
. The sed
invocation was missing some command terminators ;
which only some implementations of sed
support (e.g. GNU). Also, the filtering depends on some specific ASCII line-drawing in the sqlite3
output to recognize any field values. These visual separator lines were not present in the default output format of my sqlite3
.The function _beet_field_values
can only find the library database, if the zsh
completion cache is activated. The _beet
completion script already sets the cache-policy (near the top of the script), but should probably also ensure that the cache is activated, at least for its own context and the sub-contexts for the query arguments:
zstyle ":completion:${curcontext%:*}:*" use-cache true
@mthies-unibi would you be interesting in making a PR for this or at a minimum, sharing a Gist with the changes you implemented?
Problem
when i try to complete beets command using zsh command i keep seeing
_beet:zregexparse:4: invalid regex : )
im running into the same issue documented here: https://github.com/beetbox/beets/issues/3050 and here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914569
Setup
if i run
which _beet
after trying the completion i get this.The weird thing is that if i boot into the Ubuntu 19.10 live usb and try from there it works.
setup commands:
Notice that the which _beet function returns different commands in each case. On my primary system it doesn't include the
subcmds:subcommands
sectionIf i use the extra _beet version from https://github.com/beetbox/beets/blob/0301bb517dd2fd5c1ec82be9f00c865615c1d5d9/extra/_beet then it works on my machine. But without the caching that was introduced in newer versions.
Steps I've tried to resolve this issue:
None of these things worked yet for some reason beets zsh completion works fine in the live USB, but the moment i completely install the OS and try again i encounter issues.
Does anyone have any ideas what might be causing this?
UPDATE:
I've managed to replicate the bug on the Live USB by creating a bare bones config.yaml, assigning only the
library
key and pointing it to a directory that doesn't exist e.g. ~/Desktop/Music/musiclibrary.db -> ~/Desktop/Music2/musiclibrary.dbThis also causes the
which _beet
output miss thesubcmds:subcommands
like on my main installation.But i don't understand why that happening on my main system as the directories are setup correctly.