Commit 1b9c300e authored by Gabriel Margiani's avatar Gabriel Margiani
Browse files

added scripts.

parent 5f5c86c9
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
#!/bin/sh

pkill -SIGRTMIN+7 i3blocks
case $1 in
	"disconnected") # id, nr
		twmnc -t "Call $2 Terminated" -c "$3"
		;;
	"calling") # id, nr
		twmnc -t "calling $3" -c "id $2"
		;;
	"incoming") # id, nr
		twmnc -t "Incoming call from $3" -c "id $2"
		;;
	"confirmed") # id, nr
		;;
	"dtmf") # id, nr, digit
		twmnc -t "'$4' dtmf from $3" -c "id $2"
		;;
	"auto_busy")
		twmnc -t "Rejected call from $2" -c "Reason: $3"
		;;
	"running") # nr, reason
		sleep 2s
		pkill -SIGRTMIN+7 i3blocks
		;;
	"shutdown")
		sleep 2s
		pkill -SIGRTMIN+7 i3blocks
		;;
	"registration_change") # regStatus, regStatusText
		;;
	"busyall_toggle") # state (1/0)
		;;
	"muteall_toggle") # state (1/0)
		;;
	"reverse_lookup_result") # nr, name
		twmnc -t "Found '$2' to be '$3'"	
		;;
	*)
		twmnc -t "$1" -c "call $2, $3"
		;;
esac
+21 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3

import feedparser
import sys
import re

if len(sys.argv) != 2 or sys.argv[1] in ("--help", "-h", "-help", "help"):
    print("usage: telreverse [phonenumber], looks up the owner of the number on tel.search.ch")
    sys.exit(0)

tel=re.sub(r"[\s@\"\\/&?%#><]+", "", sys.argv[1], flags=re.UNICODE)

url = 'http://tel.search.ch/api/?was='

feed = feedparser.parse(url+tel)

if len(feed.entries) >= 1:
    print(feed.entries[0].title)
else:
    sys.exit(1);