ポッドキャストはとてもエキサイティングだったので、私は自分を引き裂くことができませんでした。 そして、私は地下鉄で彼の話を聞くのがいいだろうと決めました。 そのため、USBフラッシュドライブのようなコンピューターに接続できるPDAがあります。
ここから、2つのタスクがありました。
- PDAで残りのポッドキャストをダウンロードする
- PDAの終了時にポッドキャストをダウンロードする
働くために!
プログラマーにとって解決できない問題はありません。最初の問題を解決します。 URLベースのページからすべてのポッドキャストをダウンロードするスクリプトが必要です。 良い機能は、ポッドキャストが既にメディアに存在する場合に停止することです(新しいもののみをダウンロードする場合)。
作業の過程で、次のスクリプトを入手しました。
#!/bin/bash
#
function usage
{
echo 'Usage: rpod-get.sh -u -f <dest. folder> [-s | -d]'
echo ' -u url'
echo ' -f folder path'
echo ' -d delete old files'
echo ' -s stop on old file'
}
#
TMP=`getopt -ou:f:sd -n 'rpod-get.sh' '--' "$@"`
if [ $? != 0 ] ; then usage; exit 1; fi
eval set '--' "$TMP"
DELETE_OLD_FILES=0
STOP_ON_OLD_FILE=0
while true ; do
case "$1" in
-u) URL=$2; shift 2;;
-f) FOLDER=$2; shift 2;;
-d) DELETE_OLD_FILES=1 ; shift ;;
-s) STOP_ON_OLD_FILE=1 ; shift ;;
--) shift ; break ;;
esac
done
#
if [ "$URL" = "" ]; then
usage
exit 1
fi
if [ "$FOLDER" = "" ]; then
usage
exit 1
fi
if [ "$DELETE_OLD_FILES" -eq "1" -a "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo "Cannot use -s and -d args together"
usage
exit 1
fi
# mp3-
LINKS=`wget -cq -O - $URL | grep 'mp3?' | iconv -f cp1251 -t utf-8 | sed -r -e 's/.*"(.*)".*/\1/'`
#
DONE=0
#
for LINK in $LINKS; do
FILENAME=`echo $LINK | sed -r -e 's/.*\/([^\/]+)\?.*/\1/'`
if [ -e $FOLDER/$FILENAME ]; then
if [ "$DELETE_OLD_FILES" -eq "1" ]; then
rm $FOLDER/$FILENAME
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
if [ "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo $DONE
exit 0
fi
else
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
done
echo $DONE
?
, siski-piski-show.rpod.ru . -s - .
.
, . . .
#!/bin/bash
#
function usage
{
echo 'Usage: rpod-get.sh -u -f <dest. folder> [-s | -d]'
echo ' -u url'
echo ' -f folder path'
echo ' -d delete old files'
echo ' -s stop on old file'
}
#
TMP=`getopt -ou:f:sd -n 'rpod-get.sh' '--' "$@"`
if [ $? != 0 ] ; then usage; exit 1; fi
eval set '--' "$TMP"
DELETE_OLD_FILES=0
STOP_ON_OLD_FILE=0
while true ; do
case "$1" in
-u) URL=$2; shift 2;;
-f) FOLDER=$2; shift 2;;
-d) DELETE_OLD_FILES=1 ; shift ;;
-s) STOP_ON_OLD_FILE=1 ; shift ;;
--) shift ; break ;;
esac
done
#
if [ "$URL" = "" ]; then
usage
exit 1
fi
if [ "$FOLDER" = "" ]; then
usage
exit 1
fi
if [ "$DELETE_OLD_FILES" -eq "1" -a "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo "Cannot use -s and -d args together"
usage
exit 1
fi
# mp3-
LINKS=`wget -cq -O - $URL | grep 'mp3?' | iconv -f cp1251 -t utf-8 | sed -r -e 's/.*"(.*)".*/\1/'`
#
DONE=0
#
for LINK in $LINKS; do
FILENAME=`echo $LINK | sed -r -e 's/.*\/([^\/]+)\?.*/\1/'`
if [ -e $FOLDER/$FILENAME ]; then
if [ "$DELETE_OLD_FILES" -eq "1" ]; then
rm $FOLDER/$FILENAME
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
if [ "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo $DONE
exit 0
fi
else
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
done
echo $DONE
?
, siski-piski-show.rpod.ru . -s - .
.
, . . .
#
function usage
{
echo 'Usage: rpod-get.sh -u -f <dest. folder> [-s | -d]'
echo ' -u url'
echo ' -f folder path'
echo ' -d delete old files'
echo ' -s stop on old file'
}
#
TMP=`getopt -ou:f:sd -n 'rpod-get.sh' '--' "$@"`
if [ $? != 0 ] ; then usage; exit 1; fi
eval set '--' "$TMP"
DELETE_OLD_FILES=0
STOP_ON_OLD_FILE=0
while true ; do
case "$1" in
-u) URL=$2; shift 2;;
-f) FOLDER=$2; shift 2;;
-d) DELETE_OLD_FILES=1 ; shift ;;
-s) STOP_ON_OLD_FILE=1 ; shift ;;
--) shift ; break ;;
esac
done
#
if [ "$URL" = "" ]; then
usage
exit 1
fi
if [ "$FOLDER" = "" ]; then
usage
exit 1
fi
if [ "$DELETE_OLD_FILES" -eq "1" -a "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo "Cannot use -s and -d args together"
usage
exit 1
fi
# mp3-
LINKS=`wget -cq -O - $URL | grep 'mp3?' | iconv -f cp1251 -t utf-8 | sed -r -e 's/.*"(.*)".*/\1/'`
#
DONE=0
#
for LINK in $LINKS; do
FILENAME=`echo $LINK | sed -r -e 's/.*\/([^\/]+)\?.*/\1/'`
if [ -e $FOLDER/$FILENAME ]; then
if [ "$DELETE_OLD_FILES" -eq "1" ]; then
rm $FOLDER/$FILENAME
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
if [ "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo $DONE
exit 0
fi
else
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
done
echo $DONE
?
, siski-piski-show.rpod.ru . -s - .
.
, . . .
#!/bin/bash
#
function usage
{
echo 'Usage: rpod-get.sh -u -f <dest. folder> [-s | -d]'
echo ' -u url'
echo ' -f folder path'
echo ' -d delete old files'
echo ' -s stop on old file'
}
#
TMP=`getopt -ou:f:sd -n 'rpod-get.sh' '--' "$@"`
if [ $? != 0 ] ; then usage; exit 1; fi
eval set '--' "$TMP"
DELETE_OLD_FILES=0
STOP_ON_OLD_FILE=0
while true ; do
case "$1" in
-u) URL=$2; shift 2;;
-f) FOLDER=$2; shift 2;;
-d) DELETE_OLD_FILES=1 ; shift ;;
-s) STOP_ON_OLD_FILE=1 ; shift ;;
--) shift ; break ;;
esac
done
#
if [ "$URL" = "" ]; then
usage
exit 1
fi
if [ "$FOLDER" = "" ]; then
usage
exit 1
fi
if [ "$DELETE_OLD_FILES" -eq "1" -a "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo "Cannot use -s and -d args together"
usage
exit 1
fi
# mp3-
LINKS=`wget -cq -O - $URL | grep 'mp3?' | iconv -f cp1251 -t utf-8 | sed -r -e 's/.*"(.*)".*/\1/'`
#
DONE=0
#
for LINK in $LINKS; do
FILENAME=`echo $LINK | sed -r -e 's/.*\/([^\/]+)\?.*/\1/'`
if [ -e $FOLDER/$FILENAME ]; then
if [ "$DELETE_OLD_FILES" -eq "1" ]; then
rm $FOLDER/$FILENAME
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
if [ "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo $DONE
exit 0
fi
else
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
done
echo $DONE
?
, siski-piski-show.rpod.ru . -s - .
.
, . . .
#!/bin/bash
#
function usage
{
echo 'Usage: rpod-get.sh -u -f <dest. folder> [-s | -d]'
echo ' -u url'
echo ' -f folder path'
echo ' -d delete old files'
echo ' -s stop on old file'
}
#
TMP=`getopt -ou:f:sd -n 'rpod-get.sh' '--' "$@"`
if [ $? != 0 ] ; then usage; exit 1; fi
eval set '--' "$TMP"
DELETE_OLD_FILES=0
STOP_ON_OLD_FILE=0
while true ; do
case "$1" in
-u) URL=$2; shift 2;;
-f) FOLDER=$2; shift 2;;
-d) DELETE_OLD_FILES=1 ; shift ;;
-s) STOP_ON_OLD_FILE=1 ; shift ;;
--) shift ; break ;;
esac
done
#
if [ "$URL" = "" ]; then
usage
exit 1
fi
if [ "$FOLDER" = "" ]; then
usage
exit 1
fi
if [ "$DELETE_OLD_FILES" -eq "1" -a "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo "Cannot use -s and -d args together"
usage
exit 1
fi
# mp3-
LINKS=`wget -cq -O - $URL | grep 'mp3?' | iconv -f cp1251 -t utf-8 | sed -r -e 's/.*"(.*)".*/\1/'`
#
DONE=0
#
for LINK in $LINKS; do
FILENAME=`echo $LINK | sed -r -e 's/.*\/([^\/]+)\?.*/\1/'`
if [ -e $FOLDER/$FILENAME ]; then
if [ "$DELETE_OLD_FILES" -eq "1" ]; then
rm $FOLDER/$FILENAME
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
if [ "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo $DONE
exit 0
fi
else
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
done
echo $DONE
?
, siski-piski-show.rpod.ru . -s - .
.
, . . .
#
function usage
{
echo 'Usage: rpod-get.sh -u -f <dest. folder> [-s | -d]'
echo ' -u url'
echo ' -f folder path'
echo ' -d delete old files'
echo ' -s stop on old file'
}
#
TMP=`getopt -ou:f:sd -n 'rpod-get.sh' '--' "$@"`
if [ $? != 0 ] ; then usage; exit 1; fi
eval set '--' "$TMP"
DELETE_OLD_FILES=0
STOP_ON_OLD_FILE=0
while true ; do
case "$1" in
-u) URL=$2; shift 2;;
-f) FOLDER=$2; shift 2;;
-d) DELETE_OLD_FILES=1 ; shift ;;
-s) STOP_ON_OLD_FILE=1 ; shift ;;
--) shift ; break ;;
esac
done
#
if [ "$URL" = "" ]; then
usage
exit 1
fi
if [ "$FOLDER" = "" ]; then
usage
exit 1
fi
if [ "$DELETE_OLD_FILES" -eq "1" -a "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo "Cannot use -s and -d args together"
usage
exit 1
fi
# mp3-
LINKS=`wget -cq -O - $URL | grep 'mp3?' | iconv -f cp1251 -t utf-8 | sed -r -e 's/.*"(.*)".*/\1/'`
#
DONE=0
#
for LINK in $LINKS; do
FILENAME=`echo $LINK | sed -r -e 's/.*\/([^\/]+)\?.*/\1/'`
if [ -e $FOLDER/$FILENAME ]; then
if [ "$DELETE_OLD_FILES" -eq "1" ]; then
rm $FOLDER/$FILENAME
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
if [ "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo $DONE
exit 0
fi
else
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
done
echo $DONE
?
, siski-piski-show.rpod.ru . -s - .
.
, . . .
#!/bin/bash
#
function usage
{
echo 'Usage: rpod-get.sh -u -f <dest. folder> [-s | -d]'
echo ' -u url'
echo ' -f folder path'
echo ' -d delete old files'
echo ' -s stop on old file'
}
#
TMP=`getopt -ou:f:sd -n 'rpod-get.sh' '--' "$@"`
if [ $? != 0 ] ; then usage; exit 1; fi
eval set '--' "$TMP"
DELETE_OLD_FILES=0
STOP_ON_OLD_FILE=0
while true ; do
case "$1" in
-u) URL=$2; shift 2;;
-f) FOLDER=$2; shift 2;;
-d) DELETE_OLD_FILES=1 ; shift ;;
-s) STOP_ON_OLD_FILE=1 ; shift ;;
--) shift ; break ;;
esac
done
#
if [ "$URL" = "" ]; then
usage
exit 1
fi
if [ "$FOLDER" = "" ]; then
usage
exit 1
fi
if [ "$DELETE_OLD_FILES" -eq "1" -a "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo "Cannot use -s and -d args together"
usage
exit 1
fi
# mp3-
LINKS=`wget -cq -O - $URL | grep 'mp3?' | iconv -f cp1251 -t utf-8 | sed -r -e 's/.*"(.*)".*/\1/'`
#
DONE=0
#
for LINK in $LINKS; do
FILENAME=`echo $LINK | sed -r -e 's/.*\/([^\/]+)\?.*/\1/'`
if [ -e $FOLDER/$FILENAME ]; then
if [ "$DELETE_OLD_FILES" -eq "1" ]; then
rm $FOLDER/$FILENAME
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
if [ "$STOP_ON_OLD_FILE" -eq "1" ]; then
echo $DONE
exit 0
fi
else
wget -cq -O $FOLDER/$FILENAME $LINK
let DONE=$DONE+1
fi
done
echo $DONE
?
, siski-piski-show.rpod.ru . -s - .
.
, . . .