Open puretokyo opened 10 years ago
An interesting situation. Have you tried something like the following?
$ xargs -d '\n' beet import -s < playlist.m3u
I had, but had come up against errors. Thanks to your encouragement, I found your previous suggestion of this approach on the Google Code board and your linked explanation for the stdin error, and was able to combine your script with the Stackover suggestions to get the following effective command:
xargs -d '\n' zsh -c '</dev/tty beet import -s "$@"' ignoreme < playlist.m3u
Note that if you're using OSX or BSD, you can simplify that to:
xargs -d '\n' -o beet import -s < playlist.m3u
And of course sub bash for zsh depending on which shell you're using. Works like a charm! I can still see a use case for supporting parsing simple files containing a list of paths, but in my case the problem is solved. Thanks so much Adrian!
Very cool; that's a great stopgap solution. I'll leave this ticket open as a feature request and, in the mean time, add your solution to the FAQ for others to find,
Anything further on this functionality? I would also love to use an m3u file to populate an import command. The command above does not seem to work for me using OSX:
xargs -d '\n' -o beet -l ~/db -d ~/ import -C -A -p -s < ~/playlist.m3u
xargs: illegal option -- d usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr] [-L number] [-n number [-x]] [-P maxprocs] [-s size] [utility [argument ...]]
I have had to resort to using Textwrangler to remove the extraneous text from the m3u file, adding the beet command to the beginning of each line and running that file as a shell script.
Here's an idea: use tr
to turn newlines in your m3u into null bytes and then use the -0
options to xargs instead of -d
.
tr '\n' '\0' < foo.m3u | xargs -0 beet import ...
It would be very useful to be able to feed the import command using a file containing paths (for instance an
.m3u
playlist). This could certainly be done with some neat shell-scripting, but would make a useful feature - basically.m3u
import with the flexibility to help users who want to feed a set of specific folders or songs to beets.For instance, taking the file
Amandas Summer Songs 2009.m3u
:the command
beet import -s Amandas\ Summer\ Songs\ 2009.m3u
would import each of those as a singleton (a file listing directory paths could obviously be imported normally, with either an error if a file contains a mix of files and directories or a smart mixed import).My particular use case is that I have playlists exported from my old iTunes library of ~100,000 songs, divided into playlist by rating. As a result I'm too scared to touch the library for fear of screwing the playlist paths and losing my ratings.
However, by feeding those playlists to beets, I could update the tags on each song, copy them to my current beets library structure, add them to the database, and at the same time generate an
importfeeds
.m3u
for each import that would reflect the original rating level (and then I could use that with the wonderful new flexible attributes feature to tag them with the appropriate rating).