From: "Il'ya" <brutalfreak@gmail.com>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] Менеджеры загрузки
Date: Tue, 14 Jul 2009 11:20:44 +1000
Message-ID: <1e7e0a9a0907131820n5321fc77rf6f15cd1fd67210a@mail.gmail.com> (raw)
In-Reply-To: <1e7e0a9a0907011622o717ccdb7p2b3423b3c897c26@mail.gmail.com>
В виду того что так ничего и не нашел вразумительного для скачивания с
data.cod, то набросал скрипт, пока выглядит так:
#!/bin/sh
#переход в папку откуда запукается скрипт
cd /home/occisor/Progs/DSV_download/razr
#директория для сохранения файлов
DOWN_FOLDER='/home/occisor/Downloads/dsv'
#файл откуда будут браться ссылки для закачки
DOWNLOAD_LIST='./dsvdown.lst'
url_list=$(cat $DOWNLOAD_LIST)
for i in $url_list
do
test -f './dsvfile.tmp' && rm dsvfile.tmp
aria2 --out=dsvfile.tmp $i
#получение данных на основании которых будет очищаться список
deli=$(cat dsvfile.tmp | grep 'постоянная ссылка:' | cut -d\/ -f4 |
cut -d\" -f1)
#получение ссылки
url=$(cat dsvfile.tmp | grep btn_download | cut -d\< -f3 | cut -d\>
-f1 | cut -d\" -f2)
#получение имени файла
file=$(cat dsvfile.tmp | grep файл: | cut -d\> -f3 | cut -d\< -f1)
echo Скачивается: $file echo Ссылка: $i aria2 --continue
--dir=/home/occisor/Downloads/dsv/ --out="$file" --split=2 $url
#условия на основании которых будет очищаться список от выполненной
закачки, и вывод инфы о закачке в файл
test -f "$DOWN_FOLDER/$file" && test ! -f "$DOWN_FOLDER/$file.aria2"
&& sed -i "/$deli/d" "$DOWNLOAD_LIST" && echo "$file $i $(date)" >>
./skacheno.log
done
В целом все работает, но навряд ли это оптимальный способ. Из
основного что хотелось бы: как при необходимости полностью прекратить
выполнение скрипта?, при нажатии ctrl+c завершается процесс aria2, но
цикл продолжается, при одновременном убийстве (что тоже не знаю как
правильно сделать, убивал через менеджер программ) процессов скрипта и
aria2, все завершается с ошибкой в aria2, правда как я понял не
критичной. Так же не пробовал, но при обрыве связи закачка наверно
прекратиться, а хотелось бы указать количество попыток перед
прекращением. Ну и обработка "мусора" в ссылках, т.е. например ссылка
скопирована в файл списка с "мусором" и выглядит так "некоторый
текст.avi или еще что-нибудь http://dsv.data.cod.ru/78987564 возможно
еще текст", как из это строчки получить только
"http://dsv.data.cod.ru/78987564" для дальнейшей ее обработки?
prev parent reply other threads:[~2009-07-14 1:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-15 3:05 Il'ya
2009-06-15 9:26 ` free
2009-06-16 3:39 ` Denis Nazarov
2009-06-16 4:10 ` Il'ya
2009-06-16 5:34 ` Андрей Новосёлов
2009-06-16 7:24 ` Occisor
2009-06-16 7:56 ` Андрей Новосёлов
2009-06-16 11:56 ` Occisor
2009-06-16 8:52 ` Motsyo Gennadi aka Drool
2009-06-16 9:25 ` Occisor
2009-06-16 14:14 ` Denis Nazarov
2009-06-16 23:30 ` Speccyfighter
2009-06-17 5:14 ` Motsyo Gennadi aka Drool
2009-06-17 6:13 ` Il'ya
2009-06-17 8:46 ` Gleb Kulikov
2009-06-17 2:29 ` Denis G. Samsonenko
2009-06-17 3:57 ` Il'ya
2009-06-18 18:07 ` [Comm] Administriva Michael Shigorin
2009-07-01 23:22 ` [Comm] Менеджеры загрузки Il'ya
2009-07-14 1:20 ` Il'ya [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1e7e0a9a0907131820n5321fc77rf6f15cd1fd67210a@mail.gmail.com \
--to=brutalfreak@gmail.com \
--cc=community@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git