3
# Copyright (C) 2009 Steven Black <yam655@gmail.com>
4
# Contributed to podget on 2009-11-06 to be released under the same license
5
# as podget (currently GPL)
10
PODGET_DIR="$HOME/.podget"
11
config_serverlist=`sed -r -n -e 's/^[ ]*config_serverlist[ ]*=[ ]*(["]?)(.*)\1[ ]*$/\2/p' "$PODGET_DIR/podgetrc"`
12
dir_library=`sed -r -n -e 's/^[ ]*dir_library[ ]*=[ ]*(["]?)(.*)\1[ ]*$/\2/p' "$PODGET_DIR/podgetrc"`
13
case "$config_serverlist" in
15
SERVERLIST="$config_serverlist"
18
SERVERLIST="$PODGET_DIR/$config_serverlist"
21
case "$dir_library" in
23
LIBRARY_DIR="$dir_library"
26
LIBRARY_DIR="$PODGET_DIR/$dir_library"
30
if [ ! -f "$SERVERLIST" ] ; then
37
# Originally we faked a title from the URL.
38
# Now we only do that if we can't get one via curl and sed
40
if [ -x "$CURL" ] ; then
41
FAKE_TITLE=`"$CURL" -A "Mozilla/4.0" -f -L -s "$1" | sed -n -e '/<title>/{
42
s|^.*<title>\(.*\)</title>.*$|\1|Mp
46
if [ -z "$FAKE_TITLE" ] ; then
48
-e 's;^https?://;;' -e 's;[.](com|org|net)/;/;' \
49
-e 's;^(www|web|feeds?[0-9]?)?[.];;' \
50
-e 's;/(bookfeeds|[sS]ite)/;/;g' -e 's;/[mM][pP]3_[fF]eed;;g' \
51
-e 's;[.]libsyn;;' -e 's;^(me|feedburner|librivox)/;;' \
52
-e 's;/feeds?/;/;' -e 's;[.](xml|html)$;;' \
54
-e 's;/[?]feed=[^/.]+;;' -e 's;/rss/?$;;' -e 's;/$;;' \
55
-e 's;%20; ;g' -e 's;%[0-9a-fA-F][0-9a-fA-F];;' -e 'y;/;_;' \
76
if [ "$USRDIALOG" = "auto" ] ; then
80
if [ ! -z "$USRDIALOG" ] ; then
83
*) USRDIALOG=`which $USRDIALOG` ;;
85
if [ ! -x "$USRDIALOG" ] ; then USRDIALOG="" ; fi
87
if [ ! -z "$USRDIALOG" ] ; then
99
GTKDIALOG="$USRDIALOG"
102
WHIPTAIL="$USRDIALOG"
105
TCDIALOG="$USRDIALOG"
112
if [ ! -z "$DISPLAY" ] ; then
114
# Normally 'dialog' will only be used on a real TTY.
115
# They have a real TTY, so we're fine.
119
# Woah, no TTY. Perhaps we should treat this as Xdialog.
128
if [ ! -z "$DISPLAY" ] ; then
129
KDIALOG=`which kdialog`
130
XDIALOG=`which Xdialog`
131
GTKDIALOG=`which gtkdialog`
132
# Note: We *never* try to use 'zenity' unless the user specified
133
# it. It just doesn't work the way we want -- at all.
136
WHIPTAIL=`which whiptail`
137
TCDIALOG=`which tcdialog`
138
DIALOG=`which dialog`
145
if [ "$AUTOMODE" = "1" ] ; then
146
if [ ! -z "$1" ] ; then
147
echo "Running in automatic mode."
151
if [ ! -z "$DISPLAY" ] ; then
152
if [ ! -z "$1" ] ; then
153
echo "X dialog services:"
156
if [ -x "$KDIALOG" ] ; then
157
if [ ! -z "$1" ] ; then
162
if [ -x "$GTKDIALOG" ] ; then
163
if [ ! -z "$1" ] ; then
164
echo "gtkdialog: good"
168
if [ -x "$XDIALOG" ] ; then
169
if [ ! -z "$1" ] ; then
171
echo "---------- NOTICE regarding the use of Xdialog ----------"
172
echo "Xdialog does not have the capacity to load in an icon or "
173
echo "pixmap. This means it'll be uglier than the competition."
174
echo "-----------------------------------------------------------"
175
echo "For a prettier display, install kdialog or gtkdialog."
179
if [ -x "$ZENITY" ] ; then
181
echo "zenity: BAD (and UNSUPPORTED)"
182
echo "---------- WARNING regarding the use of Zenity ----------"
183
echo "'zenity' is unsupported. 'zenity' has no support for yes/no or"
184
echo "yes/no/cancel dialogs. It has no capacity to add a button and"
185
echo "change labels, allowing any sort of usable yes/no/cancel system."
186
echo "zenity does not let me repurpose ok/cancel dialogs. The return"
187
echo "code for cancel is the same as abort, so I can't even make do"
188
echo "with changing the behavior there."
190
echo "The dialogs will be confusing and missing features."
192
echo "This is why it is unsupported."
194
echo "Please install kdialog, Xdialog, or gtkdialog or run it from"
197
echo "Really, even the automatic mode works better than zenity mode."
198
echo "---------------------------------------------------------"
199
echo "zenity is unsupported. Use at your own risk."
200
if [ -z "$1" ] ; then
201
somedialog --error "'zenity' is unsupported. 'zenity' has no support for yes/no or yes/no/cancel dialogs. It has no capacity to add a button and change labels, allowing any sort of usable yes/no/cancel system. zenity does not let me repurpose ok/cancel dialogs. The return code for cancel is the same as abort, so I can't even make do with changing the behavior there.\n\nThe dialogs will be confusing and missing features.\n\nThis is why it is unsupported.\n\nPlease install kdialog, Xdialog, or gtkdialog or run it from a terminal.\n\nReally, even the automatic mode works better than zenity mode."
204
if [ $DIALOGS = 0 ] ; then
205
if [ ! -z "$1" ] ; then
206
echo "none: okay (X dialogs unavailable)"
207
echo "------------ NOTICE regarding automatic mode -------------"
208
echo "Will be fully automatic unless run from a terminal."
209
echo "----------------------------------------------------------"
210
echo "Please consider installing kdialog, Xdialog, or gtkdialog."
215
if [ ! -z "$1" ] ; then
216
echo "TTY dialog services:"
219
if [ -x "$DIALOG" ] ; then
220
if [ ! -z "$1" ] ; then
224
if [ -x "$WHIPTAIL" ] ; then
225
if [ ! -z "$1" ] ; then
226
echo "whiptail: okay (not as pretty as dialog)"
227
echo "--------- NOTICE regarding the use of whiptail ---------"
228
echo "The line-wrapping in message dialogs is fairly crude."
229
echo "This results in the message dialogs being uglier than"
231
echo "--------------------------------------------------------"
232
echo "For a prettier display, install dialog."
236
if [ -x "$TCDIALOG" ] ; then
237
if [ ! -z "$1" ] ; then
239
echo "---------- WARNING regarding the use of tcdialog ----------"
240
echo "tcdialog requires the row and column sizes be specified, so"
241
echo "it produces some awful looking dialogs as we do not "
242
echo "precompute these sizes."
244
echo "We've also seen cases of the cursor being missing in the"
245
echo "input dialog with tcdialog."
246
echo "-----------------------------------------------------------"
247
echo "Please consider installing dialog."
251
if [ ! -z "$1" ] ; then
252
echo "bash: okay (not as pretty as dialog)"
258
local MY_GROUP="${2:-$EMPTY_GROUP}"
262
MY_TITLE="${MY_TITLE:-${FAKE_TITLE:-$EMPTY_TITLE}}"
264
somedialog --input "Title for $MY_URL" "$MY_TITLE"
265
if [ $? -eq 1 ] ; then CUR_ABORT=1 ; return 1 ; fi
266
CUR_TITLE="${SOMEDIALOG:-${FAKE_TITLE:-$EMPTY_TITLE}}"
268
somedialog --input "Genre or group for $CUR_TITLE" "$MY_GROUP"
269
if [ $? -eq 1 ] ; then CUR_ABORT=1 ; return 1 ; fi
270
CUR_GROUP="${SOMEDIALOG:-$EMPTY_GROUP}"
272
somedialog --yesNOcancel "Activate <$MY_URL> in $CUR_GROUP as '$CUR_TITLE'?"
274
if [ $CUR_ACTIVATE -eq 2 ] ; then CUR_ABORT=1 ; return 1 ; fi
275
if [ -z "$CUR_GROUP" ] ; then
276
CUR_GROUP="$EMPTY_GROUP"
278
if [ -z "$CUR_TITLE" ] ; then
279
CUR_TITLE="${FAKE_TITLE:-$EMPTY_TITLE}"
281
# Because of the backticks, the \\ needs to be escaped to \\\\
282
CUR_GROUP=`sed -e 'y; /\\\\;___;' <<< "$CUR_GROUP"`
283
CUR_TITLE=`sed -e 'y;/\\\\;__;' <<< "$CUR_TITLE"`
291
if [ -x "$KDIALOG" ] ; then
292
if [ "$TYPE" = "--yesNOcancel" ] ; then TYPE="--yesnocancel" ; fi
293
if [ "$TYPE" = "--error" ] ; then
294
"$KDIALOG" --error "$*"
295
elif [ "$TYPE" = "--sorry" ] ; then
296
"$KDIALOG" --sorry "$*"
297
elif [ "$TYPE" = "--message" ] ; then
298
"$KDIALOG" --msgbox "$*"
299
elif [ "$TYPE" = "--yesno" ] ; then
300
"$KDIALOG" --yesno "$*"
302
elif [ "$TYPE" = "--yesnocancel" ] ; then
303
"$KDIALOG" --yesnocancel "$*"
305
elif [ "$TYPE" = "--input" ] ; then
306
SOMEDIALOG=`"$KDIALOG" --inputbox "$1" "$2"`
309
elif [ -x "$XDIALOG" ] ; then
310
if [ "$TYPE" = "--yesNOcancel" ] ; then TYPE="--yesnocancel" ; fi
311
if [ "$TYPE" = "--error" ] ; then
312
"$XDIALOG" --stdout --msgbox "Error: $*" 0 0
313
elif [ "$TYPE" = "--sorry" ] ; then
314
"$XDIALOG" --stdout --msgbox "Sorry: $*" 0 0
315
elif [ "$TYPE" = "--message" ] ; then
316
"$XDIALOG" --stdout --msgbox "$*" 0 0
317
elif [ "$TYPE" = "--yesno" ] ; then
318
"$XDIALOG" --stdout --yesno "$*" 0 0
320
if [ $RET -eq 255 ] ; then RET=1 ; fi
321
elif [ "$TYPE" = "--yesnocancel" ] ; then
322
"$XDIALOG" --stdout --yesno "$*" 0 0
324
if [ $RET -eq 255 ] ; then RET=2 ; fi
325
elif [ "$TYPE" = "--input" ] ; then
326
SOMEDIALOG=`"$XDIALOG" --stdout --inputbox "$1" 0 0 "$2"`
328
if [ $RET -eq 255 ] ; then RET=1 ; fi
330
elif [ -x "$GTKDIALOG" ] ; then
331
if [ "$TYPE" = "--yesNOcancel" ] ; then TYPE="--yesnocancel" ; fi
332
if [ "$TYPE" = "--error" ] ; then
333
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
337
<pixmap><input file stock=\"error\"></input></pixmap>
338
<text><label>$GTKMSG</label></text>
342
<button cancel></button>
346
"$GTKDIALOG" --program GTK_DIALOG | grep -q 'EXIT="OK"'
347
elif [ "$TYPE" = "--sorry" ] ; then
348
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
351
<hbox><pixmap><input file stock=\"sorry\"></input></pixmap>
352
<text><label>$GTKMSG</label></text></hbox>
353
<hbox><button ok></button><button cancel></button></hbox>
356
"$GTKDIALOG" --program GTK_DIALOG | grep -q 'EXIT="OK"'
357
elif [ "$TYPE" = "--message" ] ; then
358
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
361
<hbox><pixmap><input file stock=\"info\"></input></pixmap>
362
<text><label>$GTKMSG</label></text></hbox>
363
<hbox><button ok></button><button cancel></button></hbox>
366
"$GTKDIALOG" --program GTK_DIALOG | grep -q 'EXIT="OK"'
367
elif [ "$TYPE" = "--yesno" ] ; then
368
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
371
<text><label>$GTKMSG</label></text>
372
<hbox><button yes></button><button no></button></hbox>
375
GTK_EXIT=`"$GTKDIALOG" --program GTK_DIALOG | sed -n -e 's/^EXIT="\([^"]*\)"/\1/p'`
381
elif [ "$TYPE" = "--yesnocancel" ] ; then
382
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
385
<text><label>$GTKMSG</label></text>
386
<hbox><button yes></button><button no></button><button cancel></button></hbox>
389
GTK_EXIT=`"$GTKDIALOG" --program GTK_DIALOG | sed -n -e 's/^EXIT="\([^"]*\)"/\1/p'`
395
elif [ "$TYPE" = "--input" ] ; then
396
GTKMSG=`echo "$1" | sed -e 's/</[/g' -e 's/>/]/g'`
397
GTKDEFAULT=`echo "$2" | sed -e 's/</[/g' -e 's/>/]/g'`
398
# This isn't what is done in gtkdialog examples, however gtkdialog
399
# does *no escaping* of the input, so you can provide input such
400
# as '" ; rm /etc/passwd ; true "' and what you get back is:
401
# SOMEDIALOG="" ; rm /etc/passwd ; true ""
403
<vbox><text><label>$GTKMSG</label></text>
404
<entry><default>$GTKDEFAULT</default><variable>SOMEDIALOG</variable></entry>
405
<hbox><button ok></button><button cancel></button></hbox>
408
GTK_LINES=`"$GTKDIALOG" --program GTK_DIALOG`
409
SOMEDIALOG=`sed -n -e 's/^SOMEDIALOG="\(.*\)"$/\1/p' <<< "$GTK_LINES"`
410
GTK_EXIT=`sed -n -e 's/^EXIT="\([^"]*\)"/\1/p' <<< "$GTK_LINES"`
413
*) SOMEDIALOG="" ; RET=1 ;;
416
elif [ -x "$ZENITY" ] ; then
417
# There is *NO CANCEL* option, so it is depricated
418
# It also has no Yes/No, so the yesno questions come out confusing
419
if [ "$TYPE" = "--yesNOcancel" ] ; then TYPE="--yesnocancel" ; fi
420
if [ "$TYPE" = "--error" ] ; then
421
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
422
"$ZENITY" --error --text="$GTKMSG"
423
elif [ "$TYPE" = "--sorry" ] ; then
424
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
425
"$ZENITY" --warning --text="$GTKMSG"
426
elif [ "$TYPE" = "--message" ] ; then
427
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
428
"$ZENITY" --info --text="$GTKMSG"
429
elif [ "$TYPE" = "--yesno" ] ; then
430
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
431
"$ZENITY" --question --text="$GTKMSG"
433
elif [ "$TYPE" = "--yesnocancel" ] ; then
434
GTKMSG=`echo "$*" | sed -e 's/</[/g' -e 's/>/]/g'`
435
"$ZENITY" --question --text="$GTKMSG"
437
elif [ "$TYPE" = "--input" ] ; then
438
GTKMSG=`echo "$1" | sed -e 's/</[/g' -e 's/>/]/g'`
439
GTKDEFAULT=`echo "$2" | sed -e 's/</[/g' -e 's/>/]/g'`
440
SOMEDIALOG=`"$ZENITY" --entry --text="$GTKMSG" --entry-text="$GTKDEFAULT"`
443
elif tty -s && [ $AUTOMODE = 0 ] ; then
445
# trap TTY_ABORT=1 SIGINT
446
if [ -x "$DIALOG" ] ; then
447
if [ "$TYPE" = "--yesNOcancel" ] ; then TYPE="--yesnocancel" ; fi
448
if [ "$TYPE" = "--error" ] ; then
449
"$DIALOG" --msgbox "Error: $*" 0 0
450
elif [ "$TYPE" = "--sorry " ] ; then
451
"$DIALOG" --msgbox "Sorry: $*" 0 0
452
elif [ "$TYPE" = "--message" ] ; then
453
"$DIALOG" --msgbox "$*" 0 0
454
elif [ "$TYPE" = "--yesno" ] ; then
455
"$DIALOG" --yesno "$*" 0 0
456
if [ $RET -eq 255 ] ; then RET=1 ; fi
457
elif [ "$TYPE" = "--yesnocancel" ] ; then
458
"$DIALOG" --extra-button --ok-label Yes --extra-label No --no-label Cancel --yesno "$*" 0 0
459
if [ $RET -eq 1 ] ; then RET=2
460
elif [ $RET -eq 2 ] ; then RET=1
461
elif [ $RET -eq 255 ] ; then RET=2
463
elif [ "$TYPE" = "--input" ] ; then
464
"$DIALOG" --inputbox "$1" 0 0 "$2" 2>"$TMPFILE"
466
SOMEDIALOG=`cat "$TMPFILE"`
467
if [ $RET -eq 255 ] ; then RET=1 ; fi
469
elif [ -x "$WHIPTAIL" ] ; then
470
# whiptail doesn't handle 0 0 as nicely as dialog, so it
472
if [ "$TYPE" = "--yesNOcancel" ] ; then TYPE="--yesnocancel" ; fi
473
if [ "$TYPE" = "--error" ] ; then
474
"$WHIPTAIL" --msgbox "Error: $*" 0 0
475
elif [ "$TYPE" = "--sorry " ] ; then
476
"$WHIPTAIL" --msgbox "Sorry: $*" 0 0
477
elif [ "$TYPE" = "--message" ] ; then
478
"$WHIPTAIL" --msgbox "$*" 0 0
479
elif [ "$TYPE" = "--yesno" ] ; then
480
"$WHIPTAIL" --yesno "$*" 0 0
482
if [ $RET -eq 255 ] ; then RET=1 ; fi
483
elif [ "$TYPE" = "--yesnocancel" ] ; then
484
"$WHIPTAIL" --yesno "$* (ESC to cancel)" 0 0
486
if [ $RET -eq 255 ] ; then RET=2 ; fi
487
elif [ "$TYPE" = "--input" ] ; then
488
"$WHIPTAIL" --inputbox "$1" 0 0 "$2" 2>"$TMPFILE"
490
SOMEDIALOG=`cat "$TMPFILE"`
491
if [ $RET -eq 255 ] ; then RET=1 ; fi
493
elif [ -x "$TCDIALOG" ] ; then
494
# tcdialog requires the height/width values
495
# as such, it is depricated
496
if [ "$TYPE" = "--yesNOcancel" ] ; then TYPE="--yesnocancel" ; fi
497
if [ "$TYPE" = "--error" ] ; then
498
"$TCDIALOG" --msgbox "Error: $*" 20 60
499
elif [ "$TYPE" = "--sorry " ] ; then
500
"$TCDIALOG" --msgbox "Sorry: $*" 20 60
501
elif [ "$TYPE" = "--message" ] ; then
502
"$TCDIALOG" --msgbox "$*" 20 60
503
elif [ "$TYPE" = "--yesno" ] ; then
504
"$TCDIALOG" --yesno "$*" 20 60
506
if [ $RET -eq 255 ] ; then RET=1 ; fi
507
elif [ "$TYPE" = "--yesnocancel" ] ; then
508
"$TCDIALOG" --yesno "$* (ESC to cancel)" 20 60
510
if [ $RET -eq 255 ] ; then RET=2 ; fi
511
elif [ "$TYPE" = "--input" ] ; then
512
"$TCDIALOG" --inputbox "$1" 20 60 "$2" 2>"$TMPFILE"
514
SOMEDIALOG=`cat "$TMPFILE"`
515
if [ $RET -eq 255 ] ; then RET=1 ; fi
518
if [ "$TYPE" = "--error" ] ; then
520
read -p "Press <Enter> to continue." RET
522
if [ $TTY_ABORT -eq 1 ] ; then RET=1 ; fi
523
elif [ "$TYPE" = "--sorry " ] ; then
525
read -p "Press <Enter> to continue." RET
527
if [ $TTY_ABORT -eq 1 ] ; then RET=1 ; fi
528
elif [ "$TYPE" = "--message" ] ; then
530
read -p "Press <Enter> to continue." RET
532
if [ $TTY_ABORT -eq 1 ] ; then RET=1 ; fi
533
elif [ "$TYPE" = "--yesno" ] ; then
534
read -r -e -p "$* (y/N)?" RET
536
[yY]|[yY][eE][sS]) RET=0 ;;
539
if [ $TTY_ABORT -eq 1 ] ; then RET=1 ; fi
540
elif [ "$TYPE" = "--yesNOcancel" ] ; then
541
read -r -e -p "$* (yes/NO/cancel):" RET
542
if [ -z "$RET" ] ; then RET="n" ; fi
544
[yY]|[yY][eE][sS]) RET=0 ;;
545
[nN]|[nN][oO]) RET=1 ;;
548
if [ $TTY_ABORT -eq 1 ] ; then RET=2 ; fi
549
elif [ "$TYPE" = "--yesnocancel" ] ; then
550
read -r -e -p "$* (yes/no/CANCEL):" RET
552
[yY]|[yY][eE][sS]) RET=0 ;;
553
[nN]|[nN][oO]) RET=1 ;;
556
if [ $TTY_ABORT -eq 1 ] ; then RET=2 ; fi
557
elif [ "$TYPE" = "--input" ] ; then
558
read -r -e -p "$1 ($2): " SOMEDIALOG
559
if [ -z "$SOMEDIALOG" ] ; then
568
if [ "$TYPE" = "--error" ] ; then
570
elif [ "$TYPE" = "--sorry " ] ; then
572
elif [ "$TYPE" = "--message" ] ; then
574
elif [ "$TYPE" = "--yesno" ] ; then
575
echo "Yes/No: $* (defaults to NO)"
577
elif [ "$TYPE" = "--yesNOcancel" ] ; then
578
echo "Yes/No/Cancel: $* (defaults to NO)"
580
elif [ "$TYPE" = "--yesnocancel" ] ; then
581
echo "Yes/No/Cancel: $* (defaults to CANCEL)"
583
elif [ "$TYPE" = "--input" ] ; then
584
echo "Input: $1 (defaults to $2)"
593
# 0.1 - (yam655) first version
594
# 0.1.1 (2009-05-08):
595
# fix issue with feed://somewhere/...
596
# genre/title dialog order swap (as seen in 0.2 line)
597
# 0.2 - (mostly aborted) added ability to run podget afterwards
598
# 0.3 - added inactivity tag support
599
echo "podget-add-feed Version 0.3"
604
Usage: $0 {Options} <URL>
606
-h | --help : show this help message
607
-V | --version : show the version
608
-c | --check : check dialog compatibility
609
-a | --auto : run in non-interactive mode
610
-d | --dialog <dialog> : use a specific dialog program
615
TMPFILE=`tempfile -p paf.`
616
if [ -z "$TMPFILE" ] ; then TMPFILE=`mktemp -t addfeed.XXXXXXXXXX` ; fi
617
if [ -z "$TMPFILE" ] ; then TMPFILE="/tmp/podget-add-feed.$$.`hostname`" ; fi
619
while [ $# -gt 0 ] ; do
649
CUR_GROUP="$EMPTY_GROUP"
653
# Interestingly, the body of the single-quoted segments is getting
655
URL=`sed -e 's@^feed://@http://@' -e 's@^feed:\([a-z]\+:\)@\1@' \
656
-e 's/ /%20/g' -e 's/|/%7C/g' -e 's/\\\\/%5C/g' \
657
-e 's/\\$/%24/g' -e 's/"/%34/g' -e "s/'/%39/g" \
665
somedialog --error "Unknown protocol in URL: $URL"
669
FOUNDURL=`grep -e "^\(#[a-zA-Z0-9]* \)\?$URL " "$SERVERLIST"`
675
if [ ! -z "$FOUNDURL" ] ; then
678
read FACTIVE FURL FGROUP FTITLE <<< "$FOUNDURL"
679
if [ "$FACTIVE" != "#" ] ; then
680
FREASON=" (${FACTIVE:1})"
685
read FURL FGROUP FTITLE <<< "$FOUNDURL"
689
if ! somedialog --yesnocancel "Found <$FURL> in $FGROUP as \"$FTITLE\". It is $FACTIVE$FREASON. Change this?" ; then
693
if ! askquestions "$URL" "$FGROUP" "$FTITLE" ; then
697
if [ $CUR_ACTIVATE -ne 0 ] ; then
700
if [ -z "$FOUNDURL" ] ; then
701
echo "$ACTIVE$URL $CUR_GROUP $CUR_TITLE" >> "$SERVERLIST"
703
OLIBDIR="$LIBRARY_DIR/$FGROUP/$FTITLE"
704
NLIBDIR="$LIBRARY_DIR/$CUR_GROUP/$CUR_TITLE"
705
sed -e 's|^\(# \)\?'"$URL"' .*$|'"$ACTIVE$URL $CUR_GROUP $CUR_TITLE"'|g' "$SERVERLIST" > "$SERVERLIST".new
706
mv "$SERVERLIST" "$SERVERLIST~"
707
mv "$SERVERLIST".new "$SERVERLIST"
708
if [ -d "$OLIBDIR" ] ; then
709
if [ ! -d "$LIBRARY_DIR/$CUR_GROUP" ] ; then
710
mkdir -p "$LIBRARY_DIR/$CUR_GROUP"
712
if [ -d "$NLIBDIR" ] ; then
713
somedialog --sorry "Directory $NLIBDIR already existed. We could not move $OLIBDIR. You will need to move the files by hand."
715
mv -f "$OLIBDIR" "$NLIBDIR"
718
# if [ -z "$ACTIVE" -a "$FACTIVE" != "active" ] ; then
719
# if somedialog --yesno "Run podget now?" ; then