From f15491d4b3f72d69bb27c53670f1ca851e43a639 Mon Sep 17 00:00:00 2001 From: Aleteoryx Date: Fri, 7 Feb 2025 23:35:08 -0500 Subject: [PATCH] html table --- README | 2 + table.html | 1249 ++++++++++++++++++++++++++++++++++++++++++++++++++++ table.tcl | 49 +++ 3 files changed, 1300 insertions(+) create mode 100644 table.html create mode 100755 table.tcl diff --git a/README b/README index 00eddbd2f92d57e7dfe5efde1890246f689b3170..201870050a75d22403e4208e5b3b8c03d1149a25 100644 --- a/README +++ b/README @@ -16,3 +16,5 @@ scripts: marks each GAMEURL to be ignored by stats.tcl * unignore.tcl DB-PATH GAMEURL ?GAMEURL ...? unmarks each GAMEURL to be ignored by stats.tcl +* table.tcl DB-PATH + generates an html file with game info diff --git a/table.html b/table.html new file mode 100644 index 0000000000000000000000000000000000000000..606de4b8b327a18c907fbeebab9324eb945fd318 --- /dev/null +++ b/table.html @@ -0,0 +1,1249 @@ + + + + + Game Stats + + +

Unplayed Games

+ +

Played Games

+ + + diff --git a/table.tcl b/table.tcl new file mode 100755 index 0000000000000000000000000000000000000000..2be9b4e240783ce6f4a48874e5e44e009ff31a55 --- /dev/null +++ b/table.tcl @@ -0,0 +1,49 @@ +#!/bin/env tclsh + +package require json +package require sqlite3 + +proc fatal {reason {code -1}} { + puts stderr "$argv0: fatal: $reason" + exit $code +} + +proc usage {} { + global argv0 + puts stderr "usage: $argv0 DB-PATH" + exit -1 +} +if {[llength $argv] != 1} usage +set dbpath [lindex $argv 0] + +if {[catch {sqlite3 db $dbpath -create false}]} { + fatal "can't open \"$dbpath\"" +} + +set unplayed [db eval {SELECT name,href FROM titles WHERE played ISNULL AND ignore = 0}] +set played [db eval {SELECT name,href,played FROM titles WHERE played NOTNULL AND ignore = 0}] + +puts "" +puts "" +puts "" +puts " " +puts " Game Stats" +puts "" +puts "" + +puts "

Unplayed Games

" +puts " " + +puts "

Played Games

" +puts " " + +puts "" +puts ""