diff --git a/Makefile b/Makefile index 2c57ece..18e8ad1 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ endif git push release: commit-release deb - @latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1`); \ + @latest_tag=$$(git describe --tags `git rev-list --tags --max-count=1 2>/dev/null` 2>/dev/null); \ comparison="$$latest_tag..HEAD"; \ if [ -z "$$latest_tag" ]; then comparison=""; fi; \ changelog=$$(git log $$comparison --oneline --no-merges --reverse); \ diff --git a/README.md b/README.md new file mode 100644 index 0000000..5bea720 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +Retrieve internet tickets from Fritzbox and print on a Zebra printer +==================================================================== + +The [AVM FRITZ!Box](https://avm.de/produkte/fritzbox/) (FB) routers have a feature to allow Internet access to specific devices only for a certain amount of time. If that time is exceeded then the owner can print [Internet Tickets](https://en.avm.de/service/fritzbox/fritzbox-7490/knowledge-base/publication/show/3408_Extending-the-online-time-permitted-in-the-parental-controls-with-tickets/) that allow another 45 minutes of surfing. + +The code in this repo helps to automate the retrieval and distribution of such Internet tickets. + +Retrieving Tickets +------------------ + +The `fritzbox-get-internet-tickets.py` program will connect to the FB, retrieve the 10 available Internet tickets via web scraping (there is no API for that) and print them as a list to STDOUT. + +Set the password via the `FRITZBOX_PASSWORD` environment variable and check the code for more options. + +This program is usually not used directly, unless you plan to distribute the tickets yourself. + +Printing Tickets +---------------- + +The `fritzbox-internet-ticket` program is the main program and will first retrieve the tickets from the FB and then send the first ticket to a print queue. This program also has a Desktop starter called "Print Internet Ticket". + +Optionally it will upload the remaining 9 Internet tickets to a Google form for further processing. To enable this feature set the `FRITZBOX_GOOGLE_FORM_ID` and `FRITZBOX_GOOGLE_FORM_ENTRY_ID` variables to suitable values (get the values from a prefilled link to your form. The form should simply contain one text entry field). + +Configuration +------------- + +All configuration parameters are stored in `/etc/fritzbox-internet-ticket.conf` like this: +```bash +FRITZBOX_PASSWORD=mySuperSecretPasswort +FRITZBOX_PRINT_QUEUE=Zebra +FRITZBOX_GOOGLE_FORM_ID=1FAIpQLSfhbfiefhb437ghffsUW-WULIAkPL_J-RtJN_Kiu4Fhjdwshgw +FRITZBOX_GOOGLE_FORM_ENTRY_ID=1598434206 +``` + +Take care to protect this file with file system permissions if you are on a multi user system. \ No newline at end of file diff --git a/fritzbox-internet-ticket b/fritzbox-internet-ticket index bc41f83..0542c11 100755 --- a/fritzbox-internet-ticket +++ b/fritzbox-internet-ticket @@ -7,6 +7,8 @@ test -r /etc/fritzbox-internet-ticket.conf && source /etc/fritzbox-internet-ticket.conf +export ${!FRITZBOX_*} + tickets=( $(fritzbox-get-internet-tickets.py) ) if test "$FRITZBOX_PRINT_QUEUE" ; then