Skip to content

Commit 8571cdf

Browse files
committed
Fix #2
Flickr changed its markup, which broke the random image mode
1 parent a87f9ad commit 8571cdf

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

debian/changelog

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
izulu (0.6) trusty; urgency=low
1+
izulu (0.6.1) trusty; urgency=low
22

33
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
44

izulu

+9-6
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,11 @@ getFlickrImage() {
478478
;;
479479
esac
480480
local flickrpage=$(wget -O - --quiet $(wget -O - "$riverurl" --quiet | grep "class=\"noborder\" target=\"_blank\".*http://www.flickr.com/photos" | sed 's#.*href=\"\([^\"]*\)\".*#\1#g' | uniq | shuf -n 1))
481-
local imagesizes=$(echo -e "$flickrpage" | grep Y.photo.init | sed 's#.*Y.photo.init(\(.*\));#\1#g' | tr "}" "\n")
482-
for size in "Large 2048" "Original" "Large 1600" "Large\"";do
481+
local imagesizes=$(echo -e "$flickrpage" | grep modelExport: | tr "}" "\n")
482+
for size in "k" "o" "h" "l";do
483483
# not all flickr images provide every size, so we try to get the best one
484484
# It is nicer to prefer a size with a specific width, that is why Original is not first
485-
local imageurl=$(echo -e "$imagesizes" | grep "$size" | sed -e 's#.*\(http[^"]*\).*"#\1#g' -e 's#\\##g')
485+
local imageurl=$(echo -e "$imagesizes" | grep "\"$size\"" | sed -e 's#.*\(c4.staticflickr.com.*\).*"#https://\1#g' -e 's#\\##g')
486486
if [[ -n "$imageurl" ]];then
487487
break
488488
fi
@@ -493,8 +493,11 @@ getFlickrImage() {
493493
if [[ -z "$FLICKRTMP" ]];then
494494
FLICKRTMP=$(mktemp)
495495
fi
496-
wget -O "$FLICKRTMP" "$imageurl" --quiet
497-
echo "$FLICKRTMP"
496+
if wget -O "$FLICKRTMP" "$imageurl" --quiet;then
497+
echo "$FLICKRTMP"
498+
else
499+
return 1
500+
fi
498501
}
499502

500503

@@ -817,7 +820,7 @@ while [[ $# -gt 0 ]] ; do
817820
;;
818821

819822
--version)
820-
echo "izulu 0.6.0"
823+
echo "izulu 0.6.1"
821824
exit 0
822825
;;
823826
esac

0 commit comments

Comments
 (0)