freq.db
(comprising one user table, TBL_FREQ) could be tweaked with an update trigger to record it, supposing the settop binary doesn't re-create the database on each retune.alter table TBL_FREQ add column updated INT default 0;
create trigger if not exists freq_u after update of ucLevel on TBL_FREQ begin update TBL_FREQ set updated=strftime('%s','now') where ulFrequency = NEW.ulFrequency; end;
create trigger if not exists freq_i after insert on TBL_FREQ begin update TBL_FREQ set updated=strftime('%s','now') where ulFrequency = NEW.ulFrequency; end;
It would be difficult for it to, because freq.db is created by tunefix!the schema offreq.db
(comprising one user table, TBL_FREQ) could be tweaked with an update trigger to record it, supposing the settop binary doesn't re-create the database on each retune.
s/freq.db/channel.db/
, then ... since TBL_FREQ seems to be just select ulFrequency, ucLevel, ucQuality from TBL_TS
.alter table TBL_TS add column updated INT default 0;
create trigger if not exists ts_u after update of ucLevel on TBL_TS begin update TBL_TS set updated=strftime('%s','now') where tsIdx = NEW.tsIdx; end;
create trigger if not exists ts_i after insert on TBL_TS begin update TBL_TS set updated=strftime('%s','now') where tsIdx = NEW.tsIdx; end;
default_channel.db
as well, it should be immune to unwanted re-creation of the DB, and as before we'll see what happens come 22 June (should retuning be necessary, as opposed to channel moves).Nothing will happen unless you do a retune of some sort using the SUI.we'll see what happens come 22 June
Tunefix is good for conditioning the weird renumberings used by the broadcasters and for eliminating channels that can't be shown (IPTV) or aren't wanted, but isn't necessary here.I could try this out now on a spare HDR Fox T2 if you like but I would need a bit more guidance on how / where to insert the code...
/var/lib/humaxtv/channel.db
. This database also holds favourites data, except the custom favourite group names. Under some circumstances (factory reset, eg?) it may make a new version of the database from /var/lib/humaxtv/default_channel.db
; the commands that create the database schema are embedded in the settop binary as well, but this appears to be for a last resort. The database gets rewritten when the settop binary closes down, but we can prevent that./etc/init.d/S90settop shut
cp /var/lib/humaxtv/channel.db /mod/tmp
sqlite3 /var/lib/humaxtv/channel.db
.close
(or ctrl+d);/etc/init.d/S90settop resume
sqlite3 /var/lib/humaxtv/channel.db
.mode column
select ulFrequency, ucLevel, ucQuality, updated from TBL_TS;
/mod/webif/html/diag/mux.jim
) could be modified to display them.So is it the case that a manual retune sets those to 0 and doesn't then update them to the actual values seen in the retune? And that's why tunefix caches the last best versions in freq.db?Is it possible to set a trigger to stop the stupid Humax code from setting ucLevel and ucQuality to 0 in the first place when doing a manual tune I wonder?
create trigger if not exists ts_u_ucLevel after update of ucLevel on TBL_TS begin update TBL_TS set ucLevel=OLD.ucLevel where tsIdx = NEW.tsIdx and NEW.ucLevel = 0;
create trigger if not exists ts_u_ucQuality after update of ucQuality on TBL_TS begin update TBL_TS set ucQuality=OLD.ucQuality where tsIdx = NEW.tsIdx and NEW.ucQuality = 0;
A manual retune sets the details for the mux. you are retuning correctly, but then sets ALL other muxes' details to 0. So, yes, tunefix caches the last non-zero values and puts them back (if the real ones are 0) on the next restart.So is it the case that a manual retune sets those to 0 and doesn't then update them to the actual values seen in the retune? And that's why tunefix caches the last best versions in freq.db?
CREATE TRIGGER if not exists ts_u_lq before update of ucLevel,ucquality on TBL_TS when new.ucLevel=0 and new.ucQuality=0 begin select raise(ignore); end;
/etc/init.d/S90settop shut
after re-tune and before step 7.Humax3# /etc/init.d/S90settop shut
[Video freezes but audio continues]
Humax3# cp /var/lib/humaxtv/channel.db /mod/tmp
Humax3# sqlite3 /var/lib/humaxtv/channel.db
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite> alter table TBL_TS add column updated INT default 0;
sqlite> create trigger if not exists ts_u after update of ucLevel on TBL_TS begin update TBL_TS set updated=strftime('%s','now') where tsIdx = NEW.tsIdx; end;
sqlite> create trigger if not exists ts_i after insert on TBL_TS begin update TBL_TS set updated=strftime('%s','now') where tsIdx = NEW.tsIdx; end;
sqlite>
[CTRL D]
Humax3# /etc/init.d/S90settop resume
[first time I tried resume the Humax restored video, however as db had "no such column",
I rebooted, did settop shut, copied /tmp/ db back to /var/lib/humaxtv/ and re-traced steps several
times but after first run resume always results in a green screen crash needing a power cycle]
[ FULL RE-TUNE EXECUTED (first run only)]
Humax3# /etc/init.d/S90settop shut
Humax3# sqlite3 /var/lib/humaxtv/channel.db
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite> .mode column
sqlite> select ulFrequency, ucLevel, ucQuality, updated from TBL_TS;
Error: no such column: updated
sqlite>
[CTRL D]
re-load original db and try again
Not required but shouldn't have made a difference./df : I don't think anything got updated, BTW I did a/etc/init.d/S90settop shut
after re-tune and before step 7.
...
Clearly, the settop binary is re-creating channel.db on a full retune. If it's just copying default_channel.db, the same procedure but this time saving and modifying...
after I found this new column I did another re -Tune, but the db was then regenerated wihout the new column
/var/lib/humaxtv/default_channel.db
might succeed.But it's no use as the Humax software regenerates the database on every shutdown or retune. You can poke the trigger in at startup, but it's pointless.I came up with this, after a bit of head-scratching, which works on an off-line database
Well that doesn't work either:So, back to the freq.db thing in post #2 I think.
# date -d '@1592259729'
Mon Jun 15 23:22:09 BST 2020
# date -d '@1592310682'
Tue Jun 16 13:31:22 BST 2020