[webif] Web Interface 1.4.x

MikeSh

Well-Known Member
Ah. Those of us using tablets/touch screens don't get the benefit of pop-ups.
Yes, it was only chance I was dealing with this thread on the PC last night (I'm on the tablet now) and had a look at the data on box SWMBO was watching downstairs. I stumbled on the pop-ups.

Xkcd has a specific workaround for this issue with alt-text. Might it be possible to add that to webif? (I have no idea what is involved in such coding.)
 

Black Hole

May contain traces of nut
WebIF bookmark editor:

At the moment, existing bookmarks are displayed as HH:MM:SS, but the input box requires a plain integer in seconds. Please parse the input fields to accept integer seconds and HH:MM:SS format.
 

Black Hole

May contain traces of nut
[Deleted Items] folder (or whatever it may have been renamed by the user):

It would be nice if the OPT+ menu for that particular folder didn't offer the options available for usual folders (which are inappropriate anyway), but instead offered an "empty wastebasket" operation. Same would apply to the OPT+ button(s) within the folder.
 
t would be nice if the OPT+ menu for that particular folder didn't offer the options available for usual folders (which are inappropriate anyway), but instead offered an "empty wastebasket" operation. Same would apply to the OPT+ button(s) within the folder.
Yes, but special cases are a PITA for software developers, requiring extra coding and testing and likely extra bugs - so unfortunately we currently rely on end users to know all the special cases :(

If we have special handling for the Dustbin we should also have special cases for the /media directory (don't permit folder creation) and the Flatview folder (No decryption, cropping etc)

With the package structure of the webif - any special coding should be done in the associated package, It would be quite easy and logical for the Undelete package to add an 'Empty Wastebasket' item to the folder menu, but less easy for it to disable menu items added by other packages.

For the Flatview folder should it be be the responsibility of the Flatview package or the Crop (nicesplice) package to know that Crop is not a sensible option within that folder? DetectAds is even trickier since it works unless you use the decrypting/cropping flavours.
 
Quite some time ago there was a thread about managing favourites using the CF ...
[using the Humax UI] - actually creating the favorites list so that the channels appear in the correct order can be a pain.

Would it be possible to create the favourites list "off the box" and load it onto the humax? I assume it's technically possible because a favourites list created on the box can be backed up and restored using webif.
...
and as was replied
The Favourites info. is contained in *.rbk files, e.g. :- /mod/var/backup/auto-2013-Feb-22-18:06.rbk, it is worth remembering that the *.rbk files contain not only any favourites list generated but also the recording schedule list, the favourites list is quite readable, but the recording schedule is not quite so straightforward, ...
You would have to take care not to mess up the format if you edited this file
Now with the advent of Yesterday+1 in the big smoke, my list of favourites has reached 100 items, which is a limit written into the Humax blob. However the limit only applies when adding to a favourites group and is not checked afterwards (and apparently exceeding the limit doesn't blow up the software, say by overflowing some fixed buffer). So I was looking for a work-around, ideally without going into Maintenance mode and casting SQL commands to modify the Humax databases.

Edit The check is applied even if the relevant group already has more than 100 entries.

I looked at editing a copy of the autosaved .rbk file to insert Yesterday+1 into a favourites group after Yesterday; it would be a tiresome job because each data row includes an index field that would have to be incremented for every row after the inserted one.

The code to parse this file and restore the schedule and favourites data to pending copies of the relevant database tables (to replace the actual ones at startup) is in webif/lib/rsv.class in the restore method of the rsv class. Rather than start from scratch, I thought it would be both reasonable and much faster to modify that code.

I decided that a row should be allowed to have index "-" to mean that the restore process must assign it an index value one greater than the previous row and then increment all subsequent index values. Favourites are apparently saved into the file in ascending index order: rsv's matching backup method extracts favourites using a SQL order by eFavGroup, favIdx modifier and saves them in the same order, so I relied on that.

There is a test at line 1233 where if no index value has been saved it is set to 0. This didn't help my problem and I couldn't see how it would be helpful or appropriate in general: if more than one row has index 0 the restore will fail through violating index uniqueness. No doubt there is some case where it might make sense so I left it in my modified code.

Here is a difference listing against rsv.class from WebIf 1.4.4-1:
Diff:
--- rsv.class.org    2018-04-30 18:30:16.616194000 +0000
+++ rsv.class    2018-11-26 20:44:10.291106447 +0000
@@ -1213,6 +1213,8 @@
     )}

     set grp 0
+    set inc 0
+    set lastidx 1
     foreach line $data {
         set vals [split $line "\t"]

@@ -1230,7 +1232,13 @@

         lassign $vals x group type chan idx

-        if {$idx eq ""} { set idx 0 }
+        if {$idx eq ""} {
+            set idx 0
+        } elseif {$idx eq "-"} {
+            set idx $lastidx
+            incr inc
+        }
+        set lastidx $idx

         if {$grp != $group} {
             set grp $group
@@ -1253,7 +1261,7 @@
             insert into
             pending.fav(favIdx, hSvc, eFavGroup, eSvcType)
             values(%s, %s, %s, %s);
-        } $idx $hsvc $group $type
+        } [expr {$idx == 0 ? $idx : $idx + $inc}] $hsvc $group $type
     }

     system restartpending
Can something like this be included in the WebIf package?
 
Last edited by a moderator:
OP
OP
af123

af123

Administrator
Staff member
Can something like this be included in the WebIf package?
Definitely. Inserting a zero for an auto-increment column usually makes the SQL database pick the next free value - I don't remember why the "" case is there, it may have been to support an older backup format that did not include indices; that seems likely given that index is the last field.

Later: Yes, that's what it is. The index was not originally saved so to support loading backup files from before, the index is set to zero which makes sqlite3 allocate the next available index.

Here's the change where the index was added:

https://github.com/hummypkg/webif/commit/895dda6deeb95800eef41de2b84dc7a4eee52964
 
Last edited:
Definitely. Inserting a zero for an auto-increment column usually makes the SQL database pick the next free value
... The index was not originally saved so to support loading backup files from before, the index is set to zero which makes sqlite3 allocate the next available index.
...
So, in the case I wanted, a missing index would have generated the next available index which would most likely conflict with the index on the next line of data; but for antique compatibility the logic should support a missing index in the same way.

As an additional feature, "-" (perhaps better: "+") can signal that the index should be one greater than the last, and subsequent indexes should be incremented by one.
 

4ndy

Forum Supporter
Feature Request

Would it be possible to add a flag to to folders in the webif browser (similar to the optional unwatched count), this time indicating if there is a _duplicates folder to potentially delete?


Sent from my iPad using Tapatalk
 
Last edited:
OP
OP
af123

af123

Administrator
Staff member
I decided that a row should be allowed to have index "-" to mean that the restore process must assign it an index value one greater than the previous row and then increment all subsequent index values. Favourites are apparently saved into the file in ascending index order: rsv's matching backup method extracts favourites using a SQL order by eFavGroup, favIdx modifier and saves them in the same order, so I relied on that.

...

Can something like this be included in the WebIf package?
I've implemented this just slightly differently to your proposed patch, but it will be in the next webif release.

The commit is here:

https://github.com/hummypkg/webif/commit/9de13741c860c2efbae1de947a991ed76d2745a9
 
I've implemented this just slightly differently to your proposed patch, but it will be in the next webif release.

The commit is here:

https://github.com/hummypkg/webif/commit/9de13741c860c2efbae1de947a991ed76d2745a9
Thanks. It seems to be equivalent provided that the input file has either no index values or index values possibly with '-', which ought to be the case given that the former case is historical.

Should the combination case be handled, in which lastidx would have to be set from the actual index assigned by the DBMS if the input line had no index value? Or at least move lines 1243-4 into the conditional clause:
Code:
		} else {
			if {$idx eq "-"} {
				set idx $lastidx
				incr inc
			}
			set lastidx $idx
			incr idx $inc 
		}
 
OP
OP
af123

af123

Administrator
Staff member
Should the combination case be handled, in which lastidx would have to be set from the actual index assigned by the DBMS if the input line had no index value? Or at least move lines 1243-4 into the conditional clause:
I'll move the lines, thanks. I'd be astounded if anyone did try and load such an old backup file and even more if they knew about and tried this new feature in combination with it but it's neater to group the lines like this.
 
Top