[webif] Web Interface 1.4.x

Status
Not open for further replies.
... busybox is a dependency of webif ....
I wonder why.

A quick scan opkg files webif | while read -r x; do file "$x" | grep -vq " text " && continue; head -1 "$x" | grep -Eq '^#![/].+[/]sh' && echo $x; done indicated that
  • webif includes these shell scripts, none of which have #!/mod/bin/busybox/sh (yes, even ...db.jim):
    Code:
    /mod/webif/lib/lib.sh
    /mod/etc/init.d/S60parseepg
    /mod/webif/lib/bin/reboot
    /mod/webif/cgi-bin/epg/db.jim
    /mod/webif/lib/bin/mkcert
    /mod/webif/lib/bin/opkg
    /mod/webif/lib/bin/lsof
    /mod/etc/init.d/S59webif
  • one line in /mod/webif/lib/bin/reboot uses commands not in /bin but could be rewritten:
    Code:
    #instead of
    mount | grep '^/dev/sd' | awk '{print $1}' | xargs umount -l
    # this
    type xargs >/dev/null ||
    	xargs() {
    		while read -r in; do 
    			"$@" "$in"
    		done
    	}
    mount | grep '^/dev/sd' | cut -f1 -d\  | xargs umount -l
    # or with added deduplication
    mount | grep '^/dev/sd' | while read -r dev _; do [ "$x" = "$dev" ] && continue; umount -l "$dev"; x=$dev; done
  • then there are commands run from Jim scripts by exec, which are revealed opkg files webif | while read -r xx; do if file "$xx" | grep -vq " text "; then continue; fi; head -1 "$xx" | grep -Eq '^#![/].+[/]jimsh' && grep -H 'exec ' $xx; done as:
    Code:
    /mod/webif/html/services/index.jim:set services [split [exec /mod/bin/service mlist]]
    /mod/webif/html/edit/get.jim:   set type [exec /mod/bin/file --brief --mime-type --dereference $file]
    /mod/webif/html/edit/perms.jim: exec chmod +x $file
    /mod/webif/html/browse/clipboard.jim:                           catch {puts [exec /mod/bin/busybox/cp -r \
    /mod/webif/html/browse/sizes.jim:if {[catch {exec /mod/bin/busybox/du -h -l -d 1 "$dir/"}  dutxt]} {
    /mod/webif/html/browse/sizes.jim:       if {[catch {exec /mod/bin/busybox/du -h "$lk"}  dutxt]} {
    /mod/webif/html/browse/sizes.jim:if {[catch {exec /mod/bin/busybox/du -hs "$dir/"}  dutxt]} {
    /mod/webif/html/browse/strip/analyse.jim:puts [exec /mod/bin/stripts -aq $base]
    /mod/webif/html/browse/join/execute.jim:puts [exec {*}$cmd]
    /mod/webif/html/browse/mp3.jim:         set lines [exec ffprobe -hide_banner -v error \
    /mod/webif/html/browse/ffmpeg.jim:puts [exec /mod/bin/ffprobe -hide_banner $file]
    /mod/webif/lib/bin/fixencflags: set anencd [exec /mod/bin/stripts -qE $rfile]
    /mod/webif/lib/bin/fixencflags:         exec /mod/bin/hmt -encrypted "$rfile.hmt"
    /mod/webif/lib/bin/fixencflags:         exec /mod/bin/hmt +encrypted "$rfile.hmt"
    /mod/webif/html/browse/crop/execute.jim:puts [exec {*}$cmd]
    /mod/webif/html/browse/crop/execute.jim:exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
    /mod/webif/html/browse/crop/execute.jim:#exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
    /mod/webif/html/m/services.jim:set services [split [exec /mod/bin/service mlist]]
    /mod/etc/recmon.d/autotrigger:exec /mod/webif/lib/auto/scan -f -prelocked -logprefix "$prefix: " \
    /mod/webif/html/browse/shrunk.jim:                  exec /mod/bin/stripts -cq "$dir/$xfile"]}]} {
    /mod/webif/html/diag/disk.jim:catch { set line [exec /bin/smartctl -H $device | sed -n 5p] } msg
    /mod/webif/html/diag/disk.jim:foreach line [split [exec /bin/smartctl -i $device] "\n"] {
    /mod/webif/html/diag/disk.jim:foreach line [split [exec /bin/smartctl -A $device] "\n"] {
    /mod/webif/html/diag/disk.jim:if {[catch {set msg [exec /bin/smartctl -l selftest $device]} xmsg]} {
    /mod/webif/lib/bin/strip-update:                set perc [exec /mod/bin/stripts -aq $file]
    /mod/webif/html/browse/decrypt/execute.jim:     if {[catch {exec wget -O "$rfile.decrypting" $url} msg opts]} {
    /mod/webif/html/browse/decrypt/execute.jim:             exec /mod/bin/stripts -@@ "$base" "$base.decrypting"
    /mod/webif/html/browse/decrypt/execute.jim:             exec /mod/bin/hmt -encrypted "$dir/$shname.hmt"
    /mod/webif/html/log/loginfo.jim:lassign [exec wc -l $file] lines
    /mod/webif/cgi-bin/usbeject.jim:                if {[catch {exec /bin/umount $usb(MP)} msg]} {
    /mod/webif/cgi-bin/service.jim:catch { puts [exec /mod/bin/service $action $service] }
    /mod/webif/html/browse/strip/execute.jim:puts [exec /mod/bin/stripts \
    /mod/webif/html/browse/strip/execute.jim:exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt"
    /mod/webif/html/browse/strip/execute.jim:exec /mod/bin/hmt "+shrunk" "$dir/$newname.hmt"
    /mod/webif/lib/bin/diskattrs:catch { set line [exec /bin/smartctl -H $disk | sed -n 5p] } msg
    /mod/webif/lib/bin/diskattrs:foreach line [split [exec /bin/smartctl -i $disk] "\n"] {
    /mod/webif/lib/bin/diskattrs:foreach line [split [exec /bin/smartctl -A -f brief $disk] "\n"] {
    /mod/webif/html/diag/dspace/index.jim:  if {[catch {set dsize [exec /mod/bin/busybox/du -s "$dir/"]} msg]} {
    /mod/webif/cgi-bin/epg/dump.jim:        puts [epg exec dump -raw 1 -service $service -event $event]
    /mod/webif/cgi-bin/epg/dump.jim:        puts [epg exec dumpraw -raw 1 -service $service -event $event]
    /mod/webif/cgi-bin/wifiscan.jim:catch {exec ifconfig wlan0 up}
    /mod/webif/cgi-bin/wifiscan.jim:if {[catch {set op [exec /mod/bin/iwlist wlan0 scan]}]} {
    /mod/webif/html/dedup/dedup:if {![llength $dirs]} { lappend dirs [exec pwd] }
    /mod/webif/cgi-bin/status.jim:if {[catch {set pid [exec pgrep -n humaxtv]}]} {
    /mod/webif/cgi-bin/status.jim:      [exec /mod/webif/lib/bin/lsof -Fnsa -p $pid]} msg]} {
    /mod/webif/html/browse/chunk/extract.jim:puts [exec {*}$cmd]
    and hence
    Code:
    /mod/bin/service
    /mod/bin/file --brief --mime-type --dereference
    chmod +x 
    /mod/bin/busybox/cp -r
    /mod/bin/busybox/du -h -l -d 1
    /mod/bin/busybox/du -h
    /mod/bin/busybox/du -hs
    /mod/bin/stripts -aq
    nicesplice
    ffprobe 
    /mod/bin/stripts -qE
    /mod/bin/hmt -encrypted 
    /mod/bin/hmt +encrypted
    /mod/bin/hmt "+setfilename=
    /mod/bin/hmt "+shrunk"
    /mod/bin/service mlist
    /mod/webif/lib/auto/scan -f -prelocked -logprefix
    /mod/bin/stripts -cq
    /bin/smartctl -H 
    sed -n 5p
    /bin/smartctl -i 
    /bin/smartctl -A
    /bin/smartctl -l selftest 
    wget -O 
    /mod/bin/stripts -@@
    wc -l 
    /bin/umount 
    /mod/bin/stripts 
    /bin/smartctl -H 
    /bin/smartctl -A -f brief
    /mod/bin/busybox/du -s
    epg exec dump -raw 1 -service 
    epg exec dumpraw -raw 1 -service
    ifconfig up
    /mod/bin/iwlist scan
    pwd
    pgrep
    /mod/webif/lib/bin/lsof
    the only commands directly invoked from the busybox package are cp and du which are also in the CF built-in busybox, while chmod, pwd (should use the Jim [pwd]?), sed, wc, and wget are invoked from the PATH and are also in the CF busybox.
Is it that previous CF versions had a less capable built-in busybox?
 
The Queue page is a bit of a pain to use.
There is no button to select Failed items for Re-submission, nor a button to select Pending items to Hold, so you have to click the check-boxes manually.
This is OK-ish until the page refreshes and loses all your selections (which it does every minute, so on average you only have to interact with it for 30 seconds before the first refresh). Then it gets rather annoying.
I've proposed some mods. to add the buttons at least.
 
Last edited:
Perhaps restart the refresh counter on each check action?
Code:
--- /mod/webif/html/diag/queue/script.js.org
+++ /mod/webif/html/diag/queue/script.js
@@ -103,6 +103,8 @@
 
 $(function() {
 
+var loader=0;
+
 $('table')
     .tablesorter({
        sortList: [[0,1]],
@@ -186,7 +188,15 @@
                    encodeURIComponent('{root}/' + dirname(file));
 });
 
-setInterval(load, 300000);
+function set_loader() {
+       if (loader != 0) clearInterval(loader);
+       loader=setInterval(load, 300000);
+}
+
+$('#queuetab')
+       .on('change', 'input[type=checkbox]', set_loader);
+       
+set_loader();          
 
 });
Obviously this could be extended to the checkbox selection button functions as well as the checkboxes themselves, except that as the trigger() method is used it's not necessary. On reflection, it might be better to use the ...Timeout() functions instead of the the ...Interval() functions and call set_loader() in the load() completion hook for $.getJSON().

My spies say that the native selector [type=checkbox] is preferred to (liable to be faster than) the jQuery pseudo-selector :checkbox, which probably pre-dates the almost universal support of CSS attribute selectors, and that might be changed elsewhere. They might also wonder what the useful-looking page_refresh() function in the file is for.

Also, in a future release the file column won't resize infinitely wide.
 
Last edited:
...
However this didn't seem to work when the test machine subsequently had an uncommanded loss of channels, requiring a retune. More testing needed.
...[fix to restore custom Favourite names doesn't work 1st time]...
Could there be an issue where the first restore fails to set the custom names but somehow populates previously missing fields in TBL_MENUCONFIG and the update then succeeds?
I had a reset today where I was able to capture the setup.db and tempsetup.db after the system rebooted and was retuned.

The items in TBL_MENUCONFIG named FAV_CUSTOM_STR0[1-5] were absent; my script to restore custom Favourite names worked - almost. After restoring the schedule and favourites, the Favourites had been restored but the custom Favourite names were absent.

Reviewing the test, it failed to increment the itemIdx because the subexpression being inserted for in that column was only evaluated once, not for each row. It's necessary to supply the itemIdx because it isn't declared as a ROWID or auto-increment column. This issue only occurs after a reset, when there are no rows in TBL_MENUCONFIG with itemName FAV_CUSTOM_STR0[1-5].

I've updated the script accordingly.

So rsvsync needs to handle the case where there are no rows in TBL_MENUCONFIG with itemName FAV_CUSTOM_STR0[1-5].
 
This fixes a stupid layout/scrollbar bug when you get a recording conflict warning.
Code:
humax /mnt/hd2/mod/webif/cgi-bin/epg # diff -u info.jim~ info.jim
--- info.jim~
+++ info.jim
@@ -31,7 +31,7 @@
            [system tuners]]
        if {[llength $conflicts]} {
                puts {
-<div class=warningbox style="width: 100%; margin: 0.2em"><div>
+<div class=warningbox style="width: auto; margin: 0.2em"><div>
This event conflicts with the following items in your scheduled recording list.
<ul>
                }

I'm done with submitting stuff using gitea. Somebody can either accept patches done here (the quick, simple way) or they can do the other thing.
Probably the latter, as most of the other stuff seems to go nowhere. This whole thing's about dead anyway.
 
I'm done with submitting stuff using gitea. Somebody can either accept patches done here (the quick, simple way) or they can do the other thing.
Probably the latter, as most of the other stuff seems to go nowhere. This whole thing's about dead anyway.
While I can understand and share your frustration with getting fixes through to released using Gitea I disagree with posting them to the forum instead.

Very few forum readers have the knowledge or willingness needed to apply patches and, even when @af123 was fully active, suggestions made via the forums often fell through the cracks and didn't make it into the packages.
Now that @af123 is much less active it is unreasonable to expect him or anyone else to be actively trawling the forums looking for fixes to apply.

At least with Git all of the potential fixes are in one place, trackable and ready to be applied to the master with a few button clicks.

I am sure @af123 had hoped to be back to normal by now but it appears that he still isn't so I do hope he will consider delegating some of his git and package repository duties to others so that we get some of these small but useful fixes integrated into the repository and he can focus on his health.
 
Suggestion for Webif >> Diagnostics >> Mux Info >> Signal Strengths above 90% to be displayed like this to show a possible problem with signal overload :-

signal-Overload.png
Also maybe change Humax on-screen Icon /opt/share/images/blue/413_1_00_IP_Strength_10.png to use this :-

413_1_00_IP_Strength_11.png
 
Last edited:
It would be better to link that to quality < 100. What evidence is there that strength > 90 is indicative of overload?
 
I would have though that your many many years as an engineering wizzard would have told you that you don't run components at the edge of their tolerance, hence the 10% margin, it also allows for the signal to safely vary without going above 100%
 
I would have though that your many many years as an engineering wizzard would have told you that you don't run components at the edge of their tolerance, hence the 10% margin, it also allows for the signal to safely vary without going above 100%
You're just being silly. Why do you do it - just to be contrary?
 
So you don't intend to defend what you said in post #450?

BH : It would be better to link that to quality < 100. What evidence is there that strength > 90 is indicative of overload?

notac : This dropped the signal on BBC1 to 98% and seemed to cure the freezing except on one channel.
I got back to Humax to be told that I needed a stronger attenuator as the signal strength should be BELOW 90%
 
At last the penny drops :-
BH : Strength > 90% - signal could be too strong.

https://hummy.tv/forum/threads/hd-picture-breakup.9978/page-3#post-150266
"Could be" are the operative words, but only if the Quality is less than 100% (which was in the original but you chose to omit in your "quotation"). To say the signal is too strong without any other supporting indication is not correct, which is how I read your assertion:
It is Humax's responsibility to ensure you have an appropriate signal strength and their current way of doing this is inadequate, at the very least they should state 90% max. In the user guide

90% is not maximum. My "90%" is purely arbitrary, chosen for diagnostic purposes, and I'll thank you not to use my words out of context (my emphasis):

The first port of call when it comes to picture problems should be Menu >> Settings >> System >> Signal Detection. This (or the similar facility on the Hidden Settings Menu) is the only way to obtain real-time signal monitoring (the tuning bars in the Info display is only a static snapshot, and the report in WebIF >> Diagnostics >> Mux Info is a snapshot stored when retuned). Monitor each listed mux in turn for as long as it takes to confirm that the Quality figure never dips below 100%. If the Quality does dip below 100%, you've found the problem.

Quality < 100%, Strength < 30% - signal could be too weak.
Quality < 100%, Strength > 90% - signal could be too strong.
Quality < 100%, Strength anything - problem could be interference.

"Interference" includes mobile phones, microwave ovens, or even the HDMI lead being too close to the aerial lead. "Signal too weak" could be just a lousy "thin" UHF patch lead from the wall (probably with moulded plastic connectors), or maybe there is an amplifier in the circuit and it needs powering up. "Signal too strong" might include having an unnecessary amplifier in the aerial feed.

Since you are intent on picking a fight, please explain why you have historically avoided using the forum link-back mechanism in your quotations - it's like you don't want people to check your sources.
 
Last edited:
I recently noticed unexpected recording of 'Top Gear' appearing in my 'Finding Alice' folder!
It turns out that both series share the series CRID on ITV (SD only) and Dave
1611160273374.png

This was a long standing bug but has been exposed by some recent changes that I made so I have coded a one-liner fix that is now awaiting integration into the master webif.
 
It turns out that both series share the series CRID on ITV (SD only) and Dave
Those two examples do have different series CRIDs.
The unabbreviated series CRID for "New: Finding Alice" is www.itv.com/ebs51149
The unabbreviated series CRID for "Top Gear" is bds.tv/ebs51149

What they have in common is that the last characters of the two series CRIDs are the same.
When assigning series CRIDs broadcasters always start the series CRID with something unique to the broadcaster so that they do not have to be concerned with what other broadcasters are using.

It is probably too late for changing all references so that the full series CRID is used instead of the abbreviation, but I'm wondering if there is also a potential issue with the one-liner fix.
When broadcasters swap channels midway through a series sometimes they do keep the same series CRID and this could cause unwanted restriction of the search results.
 
Those two examples do have different series CRIDs.
The unabbreviated series CRID for "New: Finding Alice" is www.itv.com/ebs51149
The unabbreviated series CRID for "Top Gear" is bds.tv/ebs51149

What they have in common is that the last characters of the two series CRIDs are the same.
When assigning series CRIDs broadcasters always start the series CRID with something unique to the broadcaster so that they do not have to be concerned with what other broadcasters are using.

It is probably too late for changing all references so that the full series CRID is used instead of the abbreviation, but I'm wondering if there is also a potential issue with the one-liner fix.
When broadcasters swap channels midway through a series sometimes they do keep the same series CRID and this could cause unwanted restriction of the search results.
Yes but only the crid suffixes are stored in the database to save space, this fix only affects the initial set up of the series recording and doesn't affect any subsequent episode that appear in the schedule later. We have seen occasions where broadcasters have incorrectly used the same series crid on all of their channels which is why I chose to use the service-id rather the URL prefix. BBC have not been using the same series crid when moving programmes to BBC2 for coronavirus updates and Bidens inauguration which led me to write Schedchk.
 
Status
Not open for further replies.
Back
Top