Skip to content

Instantly share code, notes, and snippets.

@umrashrf
Created December 27, 2013 18:22
Show Gist options
  • Select an option

  • Save umrashrf/8150692 to your computer and use it in GitHub Desktop.

Select an option

Save umrashrf/8150692 to your computer and use it in GitHub Desktop.
code that checks current and new DE tickets and inform
#!/bin/bash
de_scrapy_audio='de-scrapy.ogg'
alarm_audio='alarm.ogg'
function get_total {
total=$(curl \
-H "Content-Type: application/json" \
-H "X-Redmine-API-Key: 146afe99da2f0f229d71e7aa4ff91949ab56e410" \
"$1" \
| grep -Po '"total_count":\d+,' \
| grep -Po '\d+,$' \
| grep -Po '\d+')
if [ $total -gt 0 ]; then
echo "" # echo issue ids here separated by space
else
echo "No tickets found"
fi
}
function get_new_total {
get_total "https://intranet.scrapinghub.com/projects/def/issues.json?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&v%5Bstatus_id%5D%5B%5D=1&f%5B%5D=assigned_to_id&op%5Bassigned_to_id%5D=%21*&f%5B%5D=tracker_id&op%5Btracker_id%5D=%21&v%5Btracker_id%5D%5B%5D=3&f%5B%5D=&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&c%5B%5D=fixed_version&c%5B%5D=done_ratio&group_by="
}
function get_current_total {
get_total "https://intranet.scrapinghub.com/projects/def/issues.json?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&v%5Bstatus_id%5D%5B%5D=2&f%5B%5D=assigned_to_id&op%5Bassigned_to_id%5D=%3D&v%5Bassigned_to_id%5D%5B%5D=me&f%5B%5D=&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&c%5B%5D=fixed_version&c%5B%5D=done_ratio&group_by="
}
new=$(get_new_total)
current=$(get_current_total)
if [[ $current == "No tickets found" ]]; then
if [[ $new != "No tickets found" ]]; then
paplay $de_scrapy_audio --volume=65536
#paplay $alarm_audio --volume=65536
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment