On 08/08/2019 18.05, David Haller wrote:
Hello,
On Thu, 08 Aug 2019, Carlos E. R. wrote:
On Thursday, 2019-08-08 at 09:27 +0200, David Haller wrote:
On Wed, 07 Aug 2019, Carlos E. R. wrote:
The last time I needed to generate a play list for an USB stick of mp3 files I used eyeD3. That package is now missing.
<https://eyed3.readthedocs.io/en/latest/>
What else can I use?
find ... -printf '%p\n' > foo.m3u
Perfect! :-)
find 2015-11/Piano/* -iname *.aac -type f -printf '%p\n'
I had no idea it was that easy. The lists I had all have two lines per file:
#EXTINF:486,02/ - Mauro Giuliani - Mostly Classical - 12 Landler for Flute and Guitar Classical\0001 -- Mauro Giuliani - 12 Landler for Flute and Guitar.mp3
Jep. The "extended info" may or may not be there and may or may not be used by the player (software). You could add that by piping the filenames into a script running mediainfo --Inform=... See mediainfo --Info-Parameters.
You might want to start with:
==== find2m3u.sh ==== #!/bin/bash EXTINF='%Duration/String3%/ %Genre% - %Album/Performer% - %Album% - %Title% -- %Codec%/%BitRate/String%'
# you could use e.g. %FolderName%\%FileName%.%FileExtension% too do_info() { f="$1" # mediainfo --Inform="General;#EXTINF:${EXTINF}\n%CompleteName%" "$f" mediainfo --Inform="General;#EXTINF:${EXTINF}" "$f" # [ do something to $f ] printf '%s\n' "$f" } for file; do do_info "$file" done while read -r file; do do_info "$file" done ====
find ... | find2m3u.sh
Ah. Interesting!
For more control, I recommend using a perl-script with 'use File::Find;' and 'use MediaInfo;' (from package perl-Mediainfo). The File::Find module gives you very fine grained control over how to find files (start with 'find2perl'!) and Mediainfo gives you easy access to the metainfo that Mediainfo can read. See 'man 3pm Mediainfo'.
I would have to learn perl first
Alternatively, you could use Exiftool instead of Mediainfo. See 'man Image::ExifTool'.
Although... I think I have to search and replace all "/" with "\".
$ find ... | tr '/' '\\' > foo.m3u
I used the editor :-) In fact, what I do is that, having a directory per genre, I generate the play list taking one file from each directory in rotation. I wrote a script for that, and having a single line source play list (per directory) makes things easier. #!/bin/bash declare -a ENTRADAS_1 SALIDATMP=/tmp/2015-11.m3u SALIDA=2015-11.m3u COUNT=1 while read FILES ; do ENTRADAS_1[$COUNT]="$FILES" COUNT=`expr $COUNT + 1` done < Genre_1.m3u COUNT_1=$COUNT echo ${ENTRADAS_1[1]} COUNT=`expr $COUNT - 1` echo ${ENTRADAS_1[$COUNT]} COUNT=1 while read FILES ; do ENTRADAS_2[$COUNT]="$FILES" COUNT=`expr $COUNT + 1` done < Genre_1.m3u COUNT_2=$COUNT echo ${ENTRADAS_2[1]} COUNT=`expr $COUNT - 1` echo ${ENTRADAS_2[$COUNT]} ... # 11 genres echo "read" echo > $SALIDATMP for((i=1; i<=2000;i++)) do if [ $i -le $COUNT_1 ]; then echo ${ENTRADAS_1[$i]} >> $SALIDATMP fi if [ $i -le $COUNT_2 ]; then echo ${ENTRADAS_2[$i]} >> $SALIDATMP fi ... if [ $i -le $COUNT_10 ]; then echo ${ENTRADAS_10[$i]} >> $SALIDATMP fi done echo "coyping to stick" cp $SALIDATMP $SALIDA (sure, functions would be appropriate, but I did not bother for a one_shot) Generating or handling the information line is a complication I do not like. If my car needs it, I will go back to the chair and do something about it, using your samples, so thanks :-) Mmm... Not that complicated, though. As I write each line, first obtain its info line and print it :-) -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)