Initial commit

This commit is contained in:
Edward Betts 2023-10-06 18:32:20 +01:00
commit 55bb3697b6
7 changed files with 559 additions and 0 deletions

36
templates/index.html Normal file
View file

@ -0,0 +1,36 @@
{% extends "page.html" %}
{% block title %}Price per TB{% endblock %}
{% block content %}
<h1>{{self.title()}}</h1>
List of hard drives available for sale from <a href="http://newegg.com/">Newegg.com</a>, sorted by the price per TB.<p>
Built by <a href="http://edwardbetts.com">Edward Betts</a>.
Comments welcome: edward@4angle.com
<p>Last updated: {{ today.strftime('%d %B %Y') }}.<p>
<table>
{% for cat in best %}
<tr><td colspan="4"><h2>{{ cat.label }}</h2></td></tr>
<tr>
<th align="right">Price<br>per TB</th>
<th align="right">Price</th>
<th align="right">Size</th>
<th align="left">Drive</th>
</tr>
{% for hdd in cat['items'][:16] %}
<tr>
<td align="right">${{ '%.2f' | format(hdd.price_per_tb) }}</td>
<td align="right">${{ hdd.price }}</td>
<td align="right">{{ hdd.size }}</td>
<td><a href="https://www.newegg.com/Product/Product.aspx?Item={{ hdd.number }}">{{ hdd.title }}</a></td>
</tr>
{% endfor %}
<tr><td colspan="4"><a href="{{ cat.name }}/index.html">more</a></td></tr>
{% endfor %}
</table>
{% endblock %}

35
templates/item_list.html Normal file
View file

@ -0,0 +1,35 @@
{% extends "page.html" %}
{% block title %}{{what}} sorted by price/TB{% endblock %}
{% block content %}
<h1>{{self.title()}}</h1>
<p>List of {{ what }} available for sale from <a href="http://newegg.com/">Newegg.com</a>, sorted by the price per TB.</p>
<p>Built by <a href="http://edwardbetts.com">Edward Betts</a>.
Comments welcome: edward@4angle.com</p>
<p><a href="../index.html">back to index</a></p>
<p>Last updated: {{ today.strftime('%d %B %Y') }}.<p>
<table class="main">
<tr>
<th align="right">Price<br>per TB</th>
<th align="right">Price</th>
<th align="right">Size</th>
<th align="left">Drive</th>
</tr>
{% for hdd in items %}
<tr>
<td align="right">${{ '%.2f' | format(hdd.price_per_tb) }}</td>
<td align="right">{{ hdd.price }}</td>
<td align="right">{{ hdd.size }}</td>
<td><a href="https://www.newegg.com/Product/Product.aspx?Item={{ hdd.number }}">{{ hdd.title }}</a>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}

42
templates/page.html Normal file
View file

@ -0,0 +1,42 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
{% block title %}{% endblock %}
</title>
<style>
body { font-family: sans-serif; }
th { vertical-align: bottom; }
table.main td { padding-left: 5px; background: #eee; }
table.main td.stock { padding-left: 5px; background: white; }
td,th { padding-left: 10px; }
.label {
padding: 1px 3px 2px;
font-size: 9.75px;
font-weight: bold;
color: #ffffff;
text-transform: uppercase;
background-color: #999999;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.label-important {
background-color: #b94a48;
}
.label-warning {
background-color: #f89406;
}
</style>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>