Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Find next ep more flexibly.
[utils.git]
/
autodlctl
diff --git
a/autodlctl
b/autodlctl
index
3f390ce
..
004f5cf
100755
(executable)
--- a/
autodlctl
+++ b/
autodlctl
@@
-2,6
+2,26
@@
paths=(/home/pub/video/anime $HOME/dc/autodl/cur)
paths=(/home/pub/video/anime $HOME/dc/autodl/cur)
+function findcurep
+{
+ if [ -r badlist ]; then
+ echo badlist `head -n 1 curep`
+ return 0
+ fi
+ if [ -r curep ]; then
+ if [ -r maxep ]; then
+ if [ "`cat curep`" -le "`cat maxep`" ]; then
+ echo curep `cat curep`
+ fi
+ else
+ echo curep `cat curep`
+ fi
+ return 0
+ fi
+ echo none
+ return 1
+}
+
function getnext
{
cd "$1/.autodl/"
function getnext
{
cd "$1/.autodl/"
@@
-9,20
+29,15
@@
function getnext
echo "checking $tag"
sexpr="`cat sexpr`"
unset badsizes
echo "checking $tag"
sexpr="`cat sexpr`"
unset badsizes
- if [ -r "badlist" ]; then
- read curep <"badlist"
- echo "downloading bad files, curep $curep"
- epfrom=badlist
- elif [ -r curep ]; then
- curep="`cat curep`"
- echo "downloading series, curep $curep"
- epfrom=curep
- else
+ epinfo=(`findcurep`)
+ if [ "${epinfo[0]}" = none ]; then
echo "no available episode of $tag" >&2
echo "$tag" >>"$HOME/dc/autodl/faulty"
touch disabled
return 1
fi
echo "no available episode of $tag" >&2
echo "$tag" >>"$HOME/dc/autodl/faulty"
touch disabled
return 1
fi
+ epfrom="${epinfo[0]}"
+ curep="${epinfo[1]}"
unset badsizesl
if [ -r badsizes ]; then
badsizesl="$(sed -n "s/^0*$curep \([^#]*\)\( *#.*\)\?$/\1/p" badsizes)"
unset badsizesl
if [ -r badsizes ]; then
badsizesl="$(sed -n "s/^0*$curep \([^#]*\)\( *#.*\)\?$/\1/p" badsizes)"
@@
-90,13
+105,6
@@
function getnext
mv -f newbadlist badlist
if [ `wc -l <badlist` -eq 0 ]; then
rm badlist
mv -f newbadlist badlist
if [ `wc -l <badlist` -eq 0 ]; then
rm badlist
- if [ -r curep ]; then
- if [ -r maxep ] && [ "`cat curep`" -gt "`cat maxep`" ]; then
- touch disabled
- fi
- else
- touch disabled
- fi
echo "$tag has no more bad episodes"
echo "$tag" >>"$HOME/dc/autodl/badmaxed"
fi
echo "$tag has no more bad episodes"
echo "$tag" >>"$HOME/dc/autodl/badmaxed"
fi
@@
-113,13
+121,16
@@
function getnext
echo "$curep" >curep
if [ -r maxep ]; then
if [ "$curep" -gt "`cat maxep`" ]; then
echo "$curep" >curep
if [ -r maxep ]; then
if [ "$curep" -gt "`cat maxep`" ]; then
- touch disabled
echo "$tag has reached max"
echo "$tag" >>"$HOME/dc/autodl/maxed"
fi
fi
;;
esac
echo "$tag has reached max"
echo "$tag" >>"$HOME/dc/autodl/maxed"
fi
fi
;;
esac
+ if ! findcurep; then
+ echo "no more episodes to download from $tag"
+ touch disabled
+ fi
fi
fi
rm -f "$outfile"
fi
fi
rm -f "$outfile"