diff options
-rw-r--r-- | lib/Multi/Image.pm | 6 | ||||
-rw-r--r-- | lib/VNDB/DB/VN.pm | 2 | ||||
-rw-r--r-- | static/f/forms.js | 2 | ||||
-rw-r--r-- | util/dump.sql | 2 | ||||
-rw-r--r-- | util/updates/update_2.6.sql | 9 |
5 files changed, 15 insertions, 6 deletions
diff --git a/lib/Multi/Image.pm b/lib/Multi/Image.pm index a0c27a51..a1e30f37 100644 --- a/lib/Multi/Image.pm +++ b/lib/Multi/Image.pm @@ -80,7 +80,7 @@ sub cv_process { # num, res sub scr_check { $_[KERNEL]->delay('scr_check'); - $_[KERNEL]->post(pg => query => 'SELECT id FROM screenshots WHERE status = 0 LIMIT 1', undef, 'scr_process'); + $_[KERNEL]->post(pg => query => 'SELECT id FROM screenshots WHERE processed = false LIMIT 1', undef, 'scr_process'); } @@ -106,12 +106,12 @@ sub scr_process { # num, res $im->Write($st); $_[KERNEL]->post(pg => do => - 'UPDATE screenshots SET status = 1, width = ?, height = ? WHERE id = ?', + 'UPDATE screenshots SET processed = true, width = ?, height = ? WHERE id = ?', [ $$old[0], $$old[1], $id ] ); $_[KERNEL]->call(core => log => 'Processed screenshot #%d in %.2fs: %.1fkB -> %.1fkB (%dx%d), thumb: %.1fkB (%dx%d)', - $_[ARG0], time-$start, $os/1024, (-s $sf)/1024, $$old[0], $$old[1], (-s $st)/1024, $$new[0], $$new[1] + $id, time-$start, $os/1024, (-s $sf)/1024, $$old[0], $$old[1], (-s $st)/1024, $$new[0], $$new[1] ); $_[KERNEL]->yield('scr_check'); diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm index d54a0123..254e24e1 100644 --- a/lib/VNDB/DB/VN.pm +++ b/lib/VNDB/DB/VN.pm @@ -238,7 +238,7 @@ sub dbVNCache { # insert a new screenshot and return it's ID # (no arguments required, as Multi is responsible for filling the entry with information) sub dbScreenshotAdd { - return shift->dbRow(q|INSERT INTO screenshots (status) VALUES(0) RETURNING id|)->{id}; + return shift->dbRow(q|INSERT INTO screenshots (processed) VALUES(false) RETURNING id|)->{id}; } diff --git a/static/f/forms.js b/static/f/forms.js index 4fb02f1e..4e59796d 100644 --- a/static/f/forms.js +++ b/static/f/forms.js @@ -484,7 +484,7 @@ function scrCheckStatus() { var tr; for(var s=0;s<ls.length;s++) { for(i=0;i<l.length-1;i++) - if(l[i].scrId == ls[s].getAttribute('id') && ls[s].getAttribute('status') > 0) + if(l[i].scrId == ls[s].getAttribute('id') && ls[s].getAttribute('processed') == "1") tr = l[i]; if(!tr) continue; diff --git a/util/dump.sql b/util/dump.sql index 583212cd..003c33ea 100644 --- a/util/dump.sql +++ b/util/dump.sql @@ -156,7 +156,7 @@ CREATE TABLE rlists ( -- screenshots CREATE TABLE screenshots ( id SERIAL NOT NULL PRIMARY KEY, - status smallint NOT NULL DEFAULT 0, + processed boolean NOT NULL DEFAULT FALSE, width smallint NOT NULL DEFAULT 0, height smallint NOT NULL DEFAULT 0 ); diff --git a/util/updates/update_2.6.sql b/util/updates/update_2.6.sql index 8cd0962a..a2fa5b32 100644 --- a/util/updates/update_2.6.sql +++ b/util/updates/update_2.6.sql @@ -34,6 +34,15 @@ ALTER TABLE anime ALTER COLUMN year DROP DEFAULT; UPDATE anime SET year = NULL WHERE year = 0; + +-- screenshots.status (smallint) -> screenshots.processed (boolean) +ALTER TABLE screenshots RENAME COLUMN status TO processed; +ALTER TABLE screenshots ALTER COLUMN processed DROP DEFAULT; +ALTER TABLE screenshots ALTER COLUMN processed TYPE boolean USING processed::int::boolean; +ALTER TABLE screenshots ALTER COLUMN processed SET DEFAULT FALSE; + + + -- automatically insert rows into the anime table for unknown aids -- when inserted into vn_anime CREATE OR REPLACE FUNCTION vn_anime_aid() RETURNS trigger AS $$ |