Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1416 connectés 

  FORUM HardWare.fr
  Programmation
  Shell/Batch

  [Bash] : aide sur un script svp, boucle for pour /mnt/path/*

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Bash] : aide sur un script svp, boucle for pour /mnt/path/*

n°591823
GUG
Posté le 16-12-2003 à 14:46:52  profilanswer
 

Bonjour,
je suis en train de faire un scrip de conversion de ogg => mp3.
pour l instant il ressemble a :

Code :
  1. for file in "$*";
  2. do
  3.   if [ à_trouver ];
  4.   then
  5.     fwav=`echo $file | awk -F/ '{print $(NF)}' | sed 's/ogg/wav/g'`
  6.     fmp3=`echo $file | awk -F/ '{print $(NF-1) "/" $(NF)}' | sed 's/ogg/mp3/g'`
  7.     rep=`echo $file | awk -F/ '{print $(NF-1)}'`
  8.    
  9.     echo "$rep"
  10.     echo "$fmp3"
  11.     title=`ogginfo "$file" | grep title | awk -F= '{print $2}'`
  12.     artist=`ogginfo "$file" | grep artist | awk -F= '{print $2}'`
  13.     genre=`ogginfo "$file" | grep genre | awk -F= '{print $2}'`
  14.     date=`ogginfo "$file" | grep date | awk -F= '{print $2}'`
  15.     album=`ogginfo "$file" | grep album | awk -F= '{print $2}'`
  16.     track=`ogginfo "$file" | grep tracknumber | awk -F= '{print $2}'`
  17.     mkdir "$rep"
  18.     mplayer -ao pcm -aofile "$fwav" "$file" &&
  19.     lame --tt "$title"  --ta "$artist"  --tl "$album" --ty "$date" --tn "$track" --tg "$genre"  -b 128 "$fwav" "$fmp3"
  20.   fi
  21. done;


Mais j ai diverses difficultés :  
1/comment tester si le fichier est bien un ogg  ?  
2/lorsque je fait ./script /mnt/ftp/ogg/path/*  ca  merdouille ... comment resoudre ?
 
merci d avance


Message édité par GUG le 17-12-2003 à 16:52:28
mood
Publicité
Posté le 16-12-2003 à 14:46:52  profilanswer
 

n°591846
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 16-12-2003 à 15:07:24  profilanswer
 

Juste un truc : espère pas que la conversion OGG -> MP3 te donnera un son de meilleure qualité, hein :o
(pour le reste, je sais pas ; juste que foutre des caractères accentués hors les commentaires ou les chaînes, c'est un peu risqué)


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°591903
GUG
Posté le 16-12-2003 à 15:43:58  profilanswer
 

oui mais mon baladeur n'aime pas le ogg ;)  
 
à_trouver : je cherche quel test effectuer pour savoir si le fichier est bien un ogg .. j'ai qq idee mais je ne trouve pas ca propre ;)


Message édité par GUG le 16-12-2003 à 15:54:05
n°592138
GUG
Posté le 16-12-2003 à 20:40:16  profilanswer
 

un petit up ;)

n°592173
Taz
bisounours-codeur
Posté le 16-12-2003 à 21:40:23  profilanswer
 

man file

n°592451
GUG
Posté le 17-12-2003 à 13:22:51  profilanswer
 

merci :) c'est bon pour le if ;)  
 
maintenant le for ...
comment faire pour boucler lorsque je met en arguement /mnt/ftp/path/*  ?


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Shell/Batch

  [Bash] : aide sur un script svp, boucle for pour /mnt/path/*

 

Sujets relatifs
tutoriaux bash en francaisrecherche un petit script pour un forum compatible wap et ++
[JS] - Débutant - Besoin d'aide pour un script ...script dans HTML + problem de cache avec ISA (un petit peut urgent)
SHELL/TCSH : Probleme sur un script automatiqueFichiers d'aide help&web
script perl pour topten sur cache[C] passer du dos à W2K/XP et aide aux librairies pour un debutant
Aide sur les surcharges de méthodes 
Plus de sujets relatifs à : [Bash] : aide sur un script svp, boucle for pour /mnt/path/*


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR