~aleteoryx/bundlemania

ref: 89045f5e4d1c099b0909838538c534501e664bfa bundlemania/unignore.tcl -rwxr-xr-x 616 bytes
89045f5eAleteoryx add a game, reformat readme 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/env tclsh

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 GAME-URL ?GAME-URL ...?"
  exit -1
}
if {[llength $argv] < 2} usage
set gameurls [lassign $argv dbpath]


if {[catch {sqlite3 db $dbpath -create false}]} {
  fatal "can't open \"$dbpath\""
}


foreach url $gameurls {
  if {![db exists {SELECT * FROM titles WHERE href = :url}]} {
    puts stderr "game not in database: $url"
    continue
  }
  db eval {
    UPDATE titles SET ignore = 1
      WHERE href = :url
  }
}