Skip to content

Instantly share code, notes, and snippets.

@chenrui333
Last active April 14, 2016 00:47
Show Gist options
  • Save chenrui333/d75f811fb5d5a367127d0ef10d306c8a to your computer and use it in GitHub Desktop.
Save chenrui333/d75f811fb5d5a367127d0ef10d306c8a to your computer and use it in GitHub Desktop.
download audio book from pingshu8.com
#! /usr/bin/sh
eps=(19 20 21 22 23 24 25 26 27 28 29 30 31 32)
#total of episodes
total=${#eps[*]}
echo 'total is ', $total
# step 1, download the episodes
for i in ${eps[@]}
do
echo "http://down01.pingshu8.com:8000/1/ys/%CE%A7%B3%C7/%CE%A7%B3%C7_${i}.mp3"
wget -c --tries=0 --read-timeout=20 "http://down01.pingshu8.com:8000/1/ys/%CE%A7%B3%C7/%CE%A7%B3%C7_${i}.mp3"
echo "Finished downloaded: %CE%A7%B3%C7/%CE%A7%B3%C7_${i}.mp3"
done
# step2, rename the files
ls *.mp3 | while read fn; do
mv "${fn}" "${fn/Χ%B3%C7/weicheng}";
done
@chenrui333
Copy link
Author

Retry download with timeout option ref_link
wget -c --tries=0 --read-timeout=20 ${url}

@chenrui333
Copy link
Author

batch rename filenames ref_link
Using bash:

ls *.xxx | while read fn; do
    mv "${fn}" "${fn/ACDC/AC-DC}";
done

If you have the rename program installed:
rename 's/ACDC/AC-DC/' *.xxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment