# check if we already have the xml file, if we dont, download it
-# atm no API
-# FRESHMEAT_FILE="${QUILL_TMP_DIR}/${1}.xml"
+ FRESHMEAT_FILE="${QUILL_TMP_DIR}/${1}.xml"
FRESHMEAT_PROJECT_FILE="${QUILL_TMP_DIR}/${1}.fm"
@@ -43,13 +41,12 @@ function quill_fmxml_core() {
message "Done"
fi
-# no API atm
-# if [[ ! -e ${FRESHMEAT_FILE} ]]; then
-# message -n "Attempting to retrieve project XML page ... "
-# wget -q -Uquill -O ${FRESHMEAT_FILE} "${FRESHMEAT_XML_URL}" ||
-# { error_msg "Error: unable to fetch project XML page" && return 1; }
-# message "Done"
-# fi
+ if [[ ! -e ${FRESHMEAT_FILE} ]]; then
+ message -n "Attempting to retrieve project XML page ... "
+ wget -q -Uquill -O ${FRESHMEAT_FILE} "${FRESHMEAT_XML_URL}" ||
+ { error_msg "Error: unable to fetch project XML page" && return 1; }
+ message "Done"
+ fi
# check that the project was found - exsists
local not_found='404 Not Found'
@@ -61,35 +58,27 @@ function quill_fmxml_core() {
# fill in variables from xml file
-# no API
-# SPELL_NAME=$(quill_fmxml_grab_from_xml projectname_short
${FRESHMEAT_FILE} |tr 'A-Z' 'a-z')
+ SPELL_NAME=$(quill_fmxml_grab_from_xml permalink ${FRESHMEAT_FILE} |tr
'A-Z' 'a-z')
SPELL_NAME="${SPELL_NAME:-$1}"
SPELL_DESC_NAME="${SPELL_NAME}"
-# no sane info available anymore
-# local tmp_url
-# for each in url_bz2 url_tgz url_zip; do
-# tmp_url="$(quill_fmxml_grab_from_xml $each ${FRESHMEAT_FILE})"
-# if [[ $tmp_url ]] ; then
-# SPELL_SRC_URL="$(grep "$each" ${FRESHMEAT_PROJECT_FILE} | grep -v
"\<img\ src\>" | sed -e "s: *<a href.*\">\(.*\)</a><br>:\1:")"
-# break
-# fi
-# done
-
-# until the API is back this should work
-
local tmp_url
for each in "Tar/BZ2" "Tar/GZ" "Zip" ; do
- tmp_url=$(grep "$each" ${FRESHMEAT_PROJECT_FILE} | tr "\n" " " | sed -e
"s:.*<li class=\"url \".*<a href=\"\(.*\)\">$each</a>.*:\1:g")
- if grep -q "/urls/" <<< $tmp_url ; then
- break
+ tmp_url="$(quill_fmxml_grab_from_xml --cond "//approved-url/label"
--cond "//approved-url/redirector" ${FRESHMEAT_FILE} | grep -A1 "$each" |
tail -n1)"
+ if [[ -n $tmp_url ]]; then
+ SPELL_SRC_URL="$(wget -T 3 --spider $tmp_url 2>&1 | grep "Location:" |
sed -e "s:Location\: \(.*\) .*:\1:" | tail -n1)"
fi
done
- if [[ -n $tmp_url ]]; then
- SPELL_SRC_URL="$(wget -T 3 --spider http://freshmeat.net$tmp_url 2>&1 |
grep "Location:" | sed -e "s:Location\: \(.*\) .*:\1:" | tail -n1)"
- fi
-# this seems to be harder and harder to get
+ local tmp_url
+ for each in "Website" "Homepage" "Web Site" "Project Home" "Home Page" ; do
+ tmp_url="$(quill_fmxml_grab_from_xml --cond "//approved-url/label"
--cond "//approved-url/redirector" ${FRESHMEAT_FILE} | grep -A1 "$each" |
tail -n1)"
+ if [[ -n $tmp_url ]]; then
+ SPELL_URL="$(wget -T 3 --spider $tmp_url 2>&1 | grep "Location:" | sed
-e "s:Location\: \(.*\) .*:\1:" | tail -n1)"
+ fi
+ done
+
+# this seems to be harder and harder to get not in the api :(
# SPELL_LICENSE="$(quill_fmxml_grab_from_xml license ${FRESHMEAT_FILE})"
# if grep -q "(.*)" <<< "${SPELL_LICENSE}"; then
# SPELL_LICENSE="$(awk '{print $NF}' <<< "$SPELL_LICENSE" | tr -d '()')"
@@ -97,12 +86,12 @@ function quill_fmxml_core() {
SPELL_LICENSE=$(sed -n '/class=\"tag-list padtop licenses\"/,/<\/div>/ p'
${FRESHMEAT_PROJECT_FILE} | tr "\n" " " | sed -e
"s:.*class=\"tagSize4\">\(.*\)</a>.*:\1:g")
-# we lose this as well
-# SPELL_SHORT_DESCRIPTION="$(quill_fmxml_grab_from_xml desc_short
${FRESHMEAT_FILE}|sed 's/\r//g')"
+ SPELL_SHORT_DESCRIPTION="$(quill_fmxml_grab_from_xml oneliner
${FRESHMEAT_FILE}|sed 's/\r//g')"
+
+ quill_fmxml_grab_from_xml description ${FRESHMEAT_FILE} |fmt -w 80 -s >
${QUILL_TMP_DIR}/${SPELL_NAME}
-# get description but remove minimal markup
- sed -n '/<div class="project-detail">/,/<div id="tabs">/ p'
${FRESHMEAT_PROJECT_FILE} | grep -v "<div [id|class]" | sed -e "s:<p>::g" -e
"s:</p>::g" |fmt -w 80 -s > ${QUILL_TMP_DIR}/${SPELL_NAME}
}
+
#---
##
## This software is free software; you can redistribute it and/or modify
diff --git a/var/lib/quill/version b/var/lib/quill/version
index f1e76a1..d3eeeb0 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.3.0-rc13
+0.3.0-rc14
[SM-Commit] GIT changes to master quill by Andraž Levstik (dbdadb369b51d6f32078281fb48ed8c25924c309),
Andraž Levstik, 04/17/2009