~trs-80/hf-price-check

35fd196e03f99c576b1a60b0014df8fb2b169117 — TRS-80 1 year, 5 months ago 54e5852 v1.0.0
Final pre-release README polish, add example XMPP message, etc.
1 files changed, 18 insertions(+), 8 deletions(-)

M README.md
M README.md => README.md +18 -8
@@ 38,9 38,16 @@ This is a (relatively) simple bash script that first searches through your `todo

Otherwise, if there are matches, the hfqpdb.com website will be downloaded (with `wget`) and then searched for any of the lot numbers you have specified.

After that (and whether there were matches or not), you will receive an XMPP message telling you what happened and also some feedback like whether the web page downloaded successfully or not, as well as a number with a 'total count.'
After that (and whether there were matches or not), you will receive an XMPP message telling you what happened and also some feedback like whether the web page downloaded successfully or not, as well as the results of a 'regex test.'

This 'total count' is the total number of lines that our lot number regex matched on the entire coupon page of hfqpdb.com.  We use this as a check of the regex itself (as oppsed to the particular lot numbers you may be looking for).  If this returns zero, the website probably changed and our regex broke.  In that case, please [create a ticket](https://todo.sr.ht/~trs-80/hf-price-check) or maybe even better send an email to the [mailing list](https://lists.sr.ht/~trs-80/hf-price-check) to bring it to my attention.  If I end up with any subscribers on that list, maybe I will even publish if and when I update / fix things.
```
hf-price-check script running on <hostname>, downloading HFQPDB.com and searching it for 39 lot number(s)...
Web page downloaded successfully.
Lot no. regex test returned 100 results (if 0, the website probably changed and broke our regex).
Searched for 39 lot numbers, but no hits.
```

This 'regex test' is the total number of lines (results) that our lot number regex matched on the entire downloaded coupon page of hfqpdb.com.  We use this as a check of the regex itself (as oppsed to the particular lot numbers you may be looking for).  If this returns zero, the website probably changed and our regex broke.  In that case, please [create a ticket](https://todo.sr.ht/~trs-80/hf-price-check) or maybe even better send an email to the [mailing list](https://lists.sr.ht/~trs-80/hf-price-check) to bring it to everyone's attention.  If I end up with any subscribers on that list, maybe I will even publish if and when I update / fix things.

- N.B.: I have noticed that, on the first of the month, the count may drop significantly, some times all the way to zero.  This is just a bunch of coupons expiring at once, and is completely normal.  The total will slowly climb back up again each day until the following month, and the cycle will repeat.



@@ 54,7 61,7 @@ This 'total count' is the total number of lines that our lot number regex matche

3.  Modify `hfpc.conf` to your own settings:

	- Especially `test_web_page_result_file`.  There is a `sample1.html` file included within the repo, make sure this variable points to it.
	- Especially `test_web_page_result_file`.  There is a `sampleN.html` file included within the repo, make sure this variable points to it.

	- By default, `testing` is set to `yes`.  This is to make sure everything is working properly before you start hammering hfqpdb.com with requests.
	


@@ 62,7 69,7 @@ This 'total count' is the total number of lines that our lot number regex matche
	
4. Make sure you install and configure all [Dependencies](https://sr.ht/~trs-80/hf-price-check/#dependencies) if you did not do so already.  Test and make sure they are all working.  That's out of scope for this README.

5. Because there are a lot of moving parts here (`sendxmpp`, the script itself, etc.) do us all a favor and do a few test runs and make sure everything is working correctly with the `sampleX.html` test web page:
5. Because there are a lot of moving parts here (`sendxmpp`, the script itself, etc.) do us all a favor and do a few test runs and make sure everything is working correctly with the `sampleN.html` test web page:

	- Make sure you can send / receive XMPP messages properly.
	


@@ 84,7 91,7 @@ Last but certainly not least, thanks to the guy who put up hfqpdb.com and keeps 

FWIW, I did reach out to the guy before I published this and told him about my script and asked him if he would mind that I share it with other people (in addition to my own use).  He was OK with it, so here we are.

Maybe even consider throwing him a few bucks so he can buy himself a beer / coffee.  Or click through on some of his links (I think he is ad supported), especially if you plan on buying something, anyway.
Maybe even consider throwing him a few bucks so he can buy himself a beer / coffee.  Or click through on some of his links (I think he is ad supported), but only if you plan on actually buying something, anyway.[^1]

## Please do not abuse!



@@ 96,7 103,7 @@ The guy running hfqpdb.com seems like a pretty swell guy, and he is doing us all

I keep my `todo.txt` file synchronized across all my devices with [SyncThing](https://syncthing.net).  On Android, I can highly recommend the [Simpletask](https://github.com/mpcjanssen/simpletask-android) Cloudless client (available in [F-Droid](https://f-droid.org/en/packages/nl.mpcjanssen.simpletask/).  Anyway, I digress...

I designed this script to integrate with that, because I already use it to keep my shopping lists in particular.  So it's very handy to just add this price monitoring feature where I am already keeping my list of things to pick up at Harbor Freight.
I designed this script to integrate with todo.txt, because I already use it to keep my shopping lists.  So it's very handy to just add this price monitoring feature where I am already keeping my list of things to pick up at Harbor Freight.

However if you don't use `todo.txt`, you can simply create a plain text file like the following, and set the variable `todo_txt_file` to point at it.  On the beginning of each line, use whatever you have set for `todo_txt_keyword` (here we use the default) followed by one or more lot numbers you are interested in, separated by spaces:



@@ 110,13 117,14 @@ Why more than one on the same line?  Some times there can be more than one lot n

## Changelog

- 2020-11-18 - Initial upload to sr.ht (no version number, yet).
- 2020-12-15 - v1.0.0 - Final polish of README before announcing on r/harborfreight.  Tag first version.
- 2020-11-18 -        - Initial upload to sr.ht (no version number, yet).

## Implementation Details

In case you are interested...

I wrote this in bash because it's what I was most comfortable with at the time.  If I did it today I would probably use Python and something like BeautifulSoup.
I wrote this in bash because it was what I was most comfortable with at the time.  If I did it today I would probably use Python and something like BeautifulSoup.

The hfqpdb.com website is pretty straightforward, however, and seems to be stable.  I have been running this script personally for some months before sharing it, and in that time there have been no changes I am aware of (my script has not broken yet).



@@ 129,3 137,5 @@ FWIW, this is the first project I ever pushed up to [sr.ht](https://sr.ht), in f
I have a few more things I would also like to share, once I've polished them up and feel they are ready.

I am _really_ enjoying this platform so far!  It is very, very refreshing having such a nice alternative to castles of JavaScript on proprietary platforms for a change!  So, thanks Drew for doing what needed to be done!  :)

[^1]: Apparently clicking thorough on ads but not actually buying anything negatively affects his ad (payment?) rate.  I learned this when visiting the HFQPDB.com site recently, where there is now a prominent notice to this effect.