Just a quick update to confirm that your suggestion solved my issue. For reference, this commandline did the magic (I changed album with ID for a more precise and hopefully faster query):
beet ls -a original_year:0000 -f'id:$id original_year=$year' | xargs -I STR -- sh -c 'beet modify -ay STR' Thank you again! Il giorno venerdì 4 maggio 2018 18:30:16 UTC+2, Adrian Sampson ha scritto: > > Hello! I think the problem here is that using `-a STR` is passing the > entire string—including the query and the modification—as a single > argument. So this looks to beets like just one query argument and no > modifications. > > So perhaps one solution would be to run your command in a shell. That is, > use `sh -c` followed by the `beet` command, which will let the shell parse > your quotes and spaces to pass two arguments to the underlying command. > > Good luck! > > Adrian > > > On May 4, 2018, at 1:25 AM, Wism <[email protected] <javascript:>> > wrote: > > Hi there! > I'm trying to batch modify a dozen of albums with wrong original_year > (probably from discogs imports); I found out that the "modify" command > doesn't (yet?) accept templates, so I thought of a simple xargs command; > but I'm banging my head against it without any results. > > I built the arguments with a simple > > beet ls -a original_year:0000 -f'"album:$album" original_year=$year' > > that returns the correct list of arguments: > > "album:Ten Bulls" original_year=1998 > "album:Amarantine (Special Christmas Edition)" original_year=2006 > "album:Absolutely Free" original_year=1967 > "album:Freak Out!" original_year=1966 > "album:Uncle Meat" original_year=1968 > [...] > > but when I try to pass these lines to "beet modify" via xargs, something > goes wrong: > > beet ls -a original_year:0000 -f'"album:$album" original_year=$year' | > xargs -p -I STR -- beet modify -a STR > > this command echoes a commandline (for confirmation, with the -p xargs > argument) that seems to be perfect: > > beet modify -a "album:Ten Bulls" original_year=1998 ?... > > but when I confirm the execution, beets returns > > error: no modifications specified > > If I copy and paste the command to test the syntax, it's executed > correctly. What am I missing? > > For the sake of completeness, I have to use the xargs -I syntax because my > version of the command (docker contained) doesn't support the -d argument. > > Thank you! > > -- > You received this message because you are subscribed to the Google Groups > "beets" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "beets" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
