Debian Codegraph @

SCRIPTS/v0.8.5/pod2player.sh

raw symbols SCIP
1 #!/bin/bash
2 # pod2player.sh : Move podget podcasts to a mobile player
3 # Copyright 2017, Bruce Ingalls. See COPYING for GPL 3.0 license
4 # WARNING! You can lose files, if you do not read, understand & edit this script!
5 #
6 # This script effectively does `mv ~/pod/* dest/`, while dealing with similar
7 # subdirectory names shared between source & destination directories
8 #
9 # For this to work, you must first mount the filesystem of your media player device
10 # (e.g. Android). Finally, you should have the same directory structure in the podcast
11 # destination directory, as the ~/pod/ source podcatcher directory on your laptop
12 # Currently, this script handles 2 levels of nesting: podcast directories in category
13 # directories, with a default prefix of AUDIO_
14
15 #echo "Read instructions, and disable this line, before running this script"; exit
16
17 # The removable media mount point
18 #DEVICE=/Volumes/MyPlayerDevice/Podcasts # Mac uses /Volumes, Linux uses /media or /mnt
19
20 #DEVICE="/Volumes/BLU\\ 1/Podcasts"
21 DEVICE="/Volumes/BLU/Podcasts"
22 #DEVICE="/Volumes/BLU\\ 2/Podcasts"
23
24 # Default Podget Library storage directory
25 DIR_LIBRARY=~/POD
26 CATEGORY_PREFIX='AUDIO_' # Prefix for all your podcast categories, to filter, say, videos
27
28 # End of user edited section. You should not need to modify below
29
30 pushd "${DIR_LIBRARY}" # default podget storage directory
31 for CAT in ${CATEGORY_PREFIX}*; do
32 pushd "${DIR_LIBRARY}/${CAT}"
33 for CHAN in *; do
34 DEST="${DEVICE}/${CAT}/${CHAN}/"
35 # j=$(echo ${i} | sed 's/\([ ()]\)/\\\1/g') # escape spaces, parens. Other weird podcast chars?
36 eval mkdir -p "${DEST}"
37 eval mv "${CHAN}/*" ${DEST}
38 rmdir ${CHAN} # clean up podcast directory (channel)
39 echo "moved directory ${CHAN} to ${DEST}"
40 done
41 popd
42 eval rmdir "${DIR_LIBRARY}/${CAT}" # clean up category name
43 done