[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] script bash per playlist



fabrizio mancini wrote:
> scusa ma non potresti far fare il lavoro a xmms o juk e poi esportarti
> la lista e lavorartela se necessario?
Eh ci avevo pensato ma avrei bisogno di uno script da mettere in cron,
elimina quelle presenti e genera le nuove ogni tot tempo, per
l'eliminazione non e' un problema ma per la creazione ho dei problemi.
Ho trovato questo in giro, ci ho lgia messo le mani, genera playlist
recursivamente:

------------------------------------
# Needs to be full path (ie, ~/music won't work)
ROOT=/home/multimedia/audio
cd $ROOT

# elimino quelle gia presenti
find $ROOT -name *.pls -exec rm -rf {} \;
find $ROOT -name *.m3u -exec rm -rf {} \;

BuildPlaylist() {
 ct=1
 #NUM=$(find $1 -type f -name *.ogg | wc -l | awk '{print $1}')
 NUM=$(find $1 -type f \( -name "*.mp3" -o -name "*.ogg" \) -print | wc
-l | awk '{print $1}')
 #find . -type f \( -name "*.abc" -o -name "*.def" \) -print
 echo "[playlist]" > "$2".m3u$
 echo "NumberOfEntries=$NUM" >> "$2".m3u
 for i in "`find $1* -type f \( -name "*.mp3" -o -name "*.ogg" \)
-print`"; do
	echo "File${ct}=${ROOT}/"${i}"" >> "$2".m3u
	ct=`expr $ct + 1`
 done
}

# Do all the subdirectories
for j in "`find * -type d -maxdepth 1`" ; do
	BuildPlaylist "$j" "$j"
done

# Make a list for all of them
BuildPlaylist "" "all"
------------------------------------

Ma ancora non ci siamo, su certi nomi mi da problemi...

> ciao fabrizio
> 
> 
Ciao!

Matteo



Reply to: