- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 - 37
 - 38
 - 39
 - 40
 - 41
 - 42
 - 43
 - 44
 - 45
 
                        Request() { 
 Info "Добро пожаловать в VKSearch $sys_version!"
 Info "Загрузка списка треков..."
 vkapi_signature=$(echo -n "${vkapi_id}api_id=1696393count=${cfg_search_count}method=audio.searchq=${query}test_mode=1v=2.0${vkapi_secret}"|md5sum|awk '{print $1}')
 wget "http://api.vkontakte.ru/api.php?api_id=1696393&count=${cfg_search_count}&v=2.0&method=audio.search&sig=${vkapi_signature}&test_mode=1&q=$query" -qO "${sys_temp}/vksearch.out"
 found=$(cat ${sys_temp}/vksearch.out | sed -ne 's,<count>\([^<]*\)</count>,\1,p'|sed 's/^[ \t]*//')
 error_msg="$(cat ${sys_temp}/vksearch.out | sed -n 's|<error_msg>\(.*\)</error_msg>|\1|p'|sed 's/^[ \t]*//'|head -n1 )"
 error_code="$(cat ${sys_temp}/vksearch.out | sed -n 's|<error_code>\(.*\)</error_code>|\1|p'|sed 's/^[ \t]*//'|head -n1)"
 [ -n "$error_msg" ] && Info "Ошибка: $error_msg (Код $error_code)" die
 
 song_count=$(cat ${sys_temp}/vksearch.out | grep '<url>'|wc -l )
 [ $song_count -eq 0 ] && Info "По запросу ${query} не найдено ни одного трека..." die || Info "По запросу ${query} найдено ${found} композиций. Обработка первых ${song_count}."
}
Parse() { 
 OLD_IFS=$IFS
 IFS=$'\n'
 song_urls=( `cat ${sys_temp}/vksearch.out | sed -n 's|<url>\(.*\)</url>|\1|p'|sed 's/^[ \t]*//' ` )
 song_artists=( `cat ${sys_temp}/vksearch.out | sed -n 's|<artist>\(.*\)</artist>|\1|p'|sed 's/^[ \t]*//' ` )
 song_titles=( `cat ${sys_temp}/vksearch.out | sed -n 's|<title>\(.*\)</title>|\1|p'|sed 's/^  //' ` )
 song_durations=( `cat ${sys_temp}/vksearch.out |sed -n 's|<duration>\(.*\)</duration>|\1|p'|sed 's/^[ \t]*//' ` )
 song_counts=$(( ${#song_urls[@]} - 1 ))
 IFS=$OLD_IFS
}
RemoveDoubles() {
 rm ${sys_temp}/vksearch.pars* 2>&-
 Info "Начинаю удаление треков с одинаковой длительностью..."
 for i in `seq 0 $song_counts`
 do
  echo "<1>${song_durations[$i]}<2>${song_artists[$i]}<3>${song_titles[$i]}<4>${song_urls[$i]}<5>" >> ${sys_temp}/vksearch.parsing 
 done
 cat ${sys_temp}/vksearch.parsing | sort -n | uniq -w 6 > ${sys_temp}/vksearch.parsed
 cat ${sys_temp}/vksearch.parsing | sort -n | uniq -w 6 -d > ${sys_temp}/vksearch.doubles
 OLD_IFS=$IFS
 IFS=$'\n'
 song_urls=( `cat ${sys_temp}/vksearch.parsed |sed -ne 's,.*<4>\([^<]*\)<5>.*,\1,p' ` )
 song_artists=( `cat ${sys_temp}/vksearch.parsed |sed -ne 's,.*<2>\([^<]*\)<3>.*,\1,p' ` )
 song_titles=( `cat ${sys_temp}/vksearch.parsed | sed -ne 's,.*<3>\([^<]*\)<4>.*,\1,p' ` )
 song_durations=( `cat ${sys_temp}/vksearch.parsed |sed -ne 's,.*<1>\([^<]*\)<2>.*,\1,p' ` )
 song_counts=$(( ${#song_urls[@]} - 1 ))
 IFS=$OLD_IFS
 Info "В плейлисте осталось ${#song_urls[@]} треков." 
}
                                 
        
            парочка функций из моего проекта VKSearch - поиск и сохранение музыки ВКонтакте на shell... -_-
        
        
вот GUI к нему (для KDE, kdialog): http://paste.org.ru/?5gdmfz