Become a Site Supporter and Never see Ads again!

Author Topic: Linux and Olympus LS 10, file transfer script  (Read 1849 times)

0 Members and 1 Guest are viewing this topic.

Offline kyriu

  • Trade Count: (0)
  • Taperssection Newbie
  • *
  • Posts: 3
Linux and Olympus LS 10, file transfer script
« on: March 14, 2009, 09:42:09 AM »
Hi all

I've recently purchased an Olympus LS10 and was a bit upset because couldn't have a good way of recording the date of the recordings. So I made this script that copies the files to my laptop adding the creation date to the file name. It can probably be improved and so on (someone  knows a good way to add metadata to .wav files?), please be free to do it.

best regards, rreis

Code: [Select]
#!/bin/bash                                                                                                             
# transfer_ls10.sh                                                                                                     
# writen by rreis@aero.ist.utl.pt 2009.03.14                                                                           
# Under the GPL v2                                                                                                     
#                                                                                                                       
# Mount a Olympus LX 10 device, copy all wav files to a directory                                                       
# adding creation date to their names                                                                                   
#                                                                                                                       
# Usage:                                                                                                               
#                                                                                                                       
# ./transfer_ls10.sh <mount_point_of_device>                                                                           
#                                                                                                                       
# Before usage edit                                                                                                     
# savedir=<dir under where files will be saved>                                                                         
#                                                                                                                       
# As usual, use at your own risk. For me it works without problem                                                       
# your system can be diferent. This is open source, check the code,                                                     
# improve it, return it back to the rest                                                                               
#                                                                                                                       
# Happy recordings!                                                                                                     
#                                                                                                                       
##################################################################                                                     
                                                                                                                       
# mount device                                                                                                         
                                                                                                                       
device=$1                                                                                                               
checkfile="$device/olyml_tb.dat"                                                                                       
savedir=/home/fuji/audio/recordings                                                                                     
ls10dirprefx="dss_fld"                                                                                                 
tmplisting="/tmp/$$tmp"                                                                                                 
                                                                                                                       
if [[ -z "$device" ]]; then                                                                                             
  echo                                                                                                                 
  echo "WARNING: Specify mount point"                                                                                   
  echo                                                                                                                 
  exit -1                                                                                                               
fi                                                                                                                     
                                                                                                                       
# check if it is Olympus LS 10                                                                                         
                                                                                                                       
mount $device

echo "Checking for $checkfile"                                                                                         
                                                                                                                       
if [ ! -e "$checkfile" ]; then                                                                                         
  echo                                                                                                                 
  echo "WARNING: It doesn't looks like the Olympus LS 10!"                                                             
  echo "WARNING: $checkfile not present"                                                                               
  echo "WARNING: ls result"                                                                                             
  echo                                                                                                                 
  ls $device                                                                                                           
  echo                                                                                                                 
  umount $device                                                                                                       
  exit -1                                                                                                               
fi                                                                                                                     
                                                                                                                       
echo "Device OK. Looks like an Olympus LS 10"                                                                           
                                                                                                                       
# create dir for saving the transfered files                                                                           
# if dir already exists don't complain                                                                                 
                                                                                                                       
date=`date +"%Y.%m.%d"`                                                                                                 
savedir="$savedir/ls10_$date"                                                                                           
mkdir -p $savedir                                                                                                       
                                                                                                                       
# build copy script header                                                                                             
                                                                                                                       
echo "#!/bin/bash" > $tmplisting                                                                                       
echo " " >> $tmplisting                                                                                                 
chmod 700 $tmplisting                                                                                                   
                                                                                                                       
# get file times and new names                                                                                         
echo "Compiling files on device"                                                                                       
slist="a b c d"                                                                                                         
for fld in $slist; do                                                                                                   
                                                                                                                       
  dr="$device/$ls10dirprefx"$fld                                                                                       
                                                                                                                       
  find $dr -name "*.wav" -prune \                                                                                       
       -printf "cp -a $dr/%f  $savedir/%TY.%Tm.%Td-%TH:%TM.%f \n" \                                                     
       >> $tmplisting                                                                                                   
                                                                                                                       
done                                                                                                                   
                                                                                                                       
echo "Copying files"                                                                                                   
/./$tmplisting                                                                                                         

echo "Cleaning up"                                                                                                     
rm $tmplisting                                                                                                         
cd                                                                                                                     
umount $device                                                                                                         
echo "End"                                                                                                             
                                                                                                                       
exit 0 


 

RSS | Mobile
Page created in 0.048 seconds with 29 queries.
© 2002-2024 Taperssection.com
Powered by SMF