Changeset 4668
- Timestamp:
- May 10, 2017, 1:35:05 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devtools/desktop_to_xml/desktop_to_xml.sh
r4648 r4668 28 28 msg_select_pkg="\nSelect the name of the package to process\n" 29 29 msg_desktop_not_found="\nDesktop file not found at %s. Process aborted.\n" 30 msg_searching_img="\nSearching screenshots ...\n"30 msg_searching_img="\nSearching screenshots in %s...\n" 31 31 msg_image_found="\nScreenshoot %s finded for app %s\n" 32 32 function usage_help … … 163 163 [ -z $index ] && index=0 164 164 installDir=${installDir/\**/} 165 [ -z $installDir] && installDir='.'165 [ -z "$installDir" ] && installDir='.' 166 166 process_pkg $installDir 167 167 } … … 227 227 printf("") > outFile 228 228 xmlFile=metainfoDir"/"array[1]".appdata.xml" 229 print "XML: "xmlFile 229 230 print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > xmlFile 230 231 print "<component type=\"desktop-application\">" >> xmlFile … … 364 365 function get_screenshot 365 366 { 366 printf "$msg_searching_img" 367 printf "$msg_searching_img" "debian" 367 368 imageFound=0 368 369 pkgName=${1/.desktop/} 369 370 url="https://screenshots.debian.net/packages?page=1&search=${pkgName}&utf8=✓" 371 get_screenshot_from $url $pkgName 372 if [[ $imageFound == 0 ]] 373 then 374 printf "$msg_searching_img" "ubuntu" 375 url="http://screenshots.ubuntu.com/packages?page=1&search=${pkgName}&utf8=✓" 376 get_screenshot_from $url $pkgName 377 fi 378 379 } 380 381 function get_screenshot_from 382 { 383 url=$1 384 baseUrl=${url/packages*/} 385 pkgName=$2 370 386 outFile=$(mktemp) 371 wget $url-o /dev/null -O $outFile387 wget $url -t 2 -T 10 -o /dev/null -O $outFile 372 388 if [ $? -eq 0 ] 373 389 then … … 377 393 searchResult=${searchResult/href=\"\//} 378 394 searchResult=${searchResult/\"/} 379 url= "https://screenshots.debian.net/${searchResult}"380 wget $url-o /tmp/log -O $outFile395 url=${baseUrl}${searchResult} 396 wget $url -t 2 -T 10 -o /tmp/log -O $outFile 381 397 if [ $? -eq 0 ] 382 398 then … … 384 400 imageFound=${imageFound/href=\"\//} 385 401 imageFound=${imageFound/\"/} 386 imageFound= "https://screenshots.debian.net/${imageFound}"402 imageFound=${baseUrl}${imageFound} 387 403 printf "$msg_image_found" $imageFound $pkgName 388 404 fi
Note: See TracChangeset
for help on using the changeset viewer.