pricecharts

track prices of consumer electronics
Log | Files | Refs | README

commit df8cac0fbfae50a40eed3e736c3977ec64243c69
parent bc36c6ae55a20850732ec7b936837e3a69ff62e0
Author: Kyle Milz <kyle@getaddrinfo.net>
Date:   Mon,  3 Nov 2014 19:53:17 -0700

change title, brand to description, manufacturer

Diffstat:
Mgen_index.pl | 2+-
Mgen_svg.pl | 4++--
Mhtml/index.html | 4++--
Mproduct_scraper.pl | 10++++------
Msearch.pl | 2+-
5 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/gen_index.pl b/gen_index.pl @@ -19,7 +19,7 @@ my $config = { my $template = Template->new($config); -my $query = "select distinct brand from products"; +my $query = "select distinct manufacturer from products"; my $manuf = $dbh->selectcol_arrayref($query); $query = "select part_num from products"; diff --git a/gen_svg.pl b/gen_svg.pl @@ -31,9 +31,9 @@ $query = "select min(date), max(date), min(price), max(price) " . "from prices where part_num = ?"; my $limits_sth = $dbh->prepare($query); -my $parts_sth = $dbh->prepare("select part_num, title from products"); +my $parts_sth = $dbh->prepare("select part_num, description from products"); $parts_sth->execute(); -while (my ($part_num, $title) = $parts_sth->fetchrow_array()) { +while (my ($part_num, $description) = $parts_sth->fetchrow_array()) { $limits_sth->execute($part_num); my ($x_min, $x_max, $y_min, $y_max) = $limits_sth->fetchrow_array(); if (!defined $x_min) { diff --git a/html/index.html b/html/index.html @@ -8,8 +8,8 @@ <b>[% num_manufacturers %]</b> manufacturers are being tracked across <b>[% num_vendors %]</b> retailers.</p> - <p> To start, try searching for a product or brand in the search - box at the top right. </p> + <p> To start, try searching for a product or manufacturer in the + search box at the top right. </p> <p> <em>Price</em><b>Chart</b> periodically looks up and saves the price information of different products. These prices are diff --git a/product_scraper.pl b/product_scraper.pl @@ -17,10 +17,8 @@ srand; $dbh->do("create table if not exists products(" . "part_num text not null primary key, " . - # this should be manufacturer - "brand text, " . - # this should be description - "title text, " . + "manufacturer text, " . + "description text, " . "type text, " . "first_seen int, " . "last_seen int, " . @@ -110,12 +108,12 @@ for (keys %product_map) { if ($sth->fetchrow_arrayref()) { $dbh->do("update products set last_seen = ? where part_num = ?", undef, time, $part_num); - # also update title, brand here? + # also update description, manufacturer here? vprint(" "); $old++; } else { - $dbh->do("insert into products(part_num, brand, title," . + $dbh->do("insert into products(part_num, manufacturer, description," . "type, first_seen, last_seen, last_scraped) " . "values (?, ?, ?, ?, ?, ?, ?)", undef, $part_num, $brand, $title, $_, time, time, 0); diff --git a/search.pl b/search.pl @@ -28,7 +28,7 @@ my $config = { }; my $template = Template->new($config); -my $query = "select part_num from products where title like ? or part_num like ?"; +my $query = "select part_num from products where description like ? or part_num like ?"; my $search_sth = $dbh->prepare($query); while ($request->Accept() >= 0) {