diff --git a/CONTROL/control b/CONTROL/control
index cd57b11..ac78ad1 100644
--- a/CONTROL/control
+++ b/CONTROL/control
@@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
-Version: 0.12.0-3
+Version: 0.12.1
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
-Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.12),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05)
+Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05)
Suggests: ffmpeg
Description: An evolving web interface for the Humax.
diff --git a/var/mongoose/html/browse/aexpiry.jim b/var/mongoose/html/browse/aexpiry.jim
new file mode 100755
index 0000000..e625898
--- /dev/null
+++ b/var/mongoose/html/browse/aexpiry.jim
@@ -0,0 +1,24 @@
+#!/mod/bin/jimsh
+
+package require cgi
+source /mod/webif/lib/setup
+
+httpheader
+
+# dir=%2Fmedia%2FMy+Video%2FWeatherview
+# aexpiry_days=13
+
+set dir [cgi_get dir "-"]
+set days [cgi_get aexpiry_days 7]
+if {$dir eq "-"} exit
+
+if {![file isdirectory $dir]} {
+ puts "Not a directory."
+ exit
+}
+
+set fd [open "$dir/.autoexpire" w]
+puts $fd $days
+$fd close
+puts "Ok."
+
diff --git a/var/mongoose/cgi-bin/browse/assets.jim b/var/mongoose/html/browse/assets.jim
similarity index 90%
rename from var/mongoose/cgi-bin/browse/assets.jim
rename to var/mongoose/html/browse/assets.jim
index 3a71191..1f6b5e7 100755
--- a/var/mongoose/cgi-bin/browse/assets.jim
+++ b/var/mongoose/html/browse/assets.jim
@@ -68,6 +68,7 @@ if $flatten {
}
puts {
+
diff --git a/var/mongoose/cgi-bin/browse/audio/audio.jim b/var/mongoose/html/browse/audio/audio.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/audio/audio.jim
rename to var/mongoose/html/browse/audio/audio.jim
diff --git a/var/mongoose/cgi-bin/browse/audio/audio.js b/var/mongoose/html/browse/audio/audio.js
similarity index 89%
rename from var/mongoose/cgi-bin/browse/audio/audio.js
rename to var/mongoose/html/browse/audio/audio.js
index 61585a7..ebdc542 100755
--- a/var/mongoose/cgi-bin/browse/audio/audio.js
+++ b/var/mongoose/html/browse/audio/audio.js
@@ -15,7 +15,7 @@ $(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
- window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+ window.location = '../index.jim?dir=' + $('#params').attr('dir');
});
$('#audioit').button().click(function() {
diff --git a/var/mongoose/cgi-bin/browse/audio/execute.jim b/var/mongoose/html/browse/audio/execute.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/audio/execute.jim
rename to var/mongoose/html/browse/audio/execute.jim
diff --git a/var/mongoose/cgi-bin/browse/audio/progress.jim b/var/mongoose/html/browse/audio/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/audio/progress.jim
rename to var/mongoose/html/browse/audio/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/chunk/chunk.css b/var/mongoose/html/browse/chunk/chunk.css
similarity index 100%
rename from var/mongoose/cgi-bin/browse/chunk/chunk.css
rename to var/mongoose/html/browse/chunk/chunk.css
diff --git a/var/mongoose/cgi-bin/browse/chunk/chunk.jim b/var/mongoose/html/browse/chunk/chunk.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/chunk/chunk.jim
rename to var/mongoose/html/browse/chunk/chunk.jim
diff --git a/var/mongoose/cgi-bin/browse/chunk/chunk.js b/var/mongoose/html/browse/chunk/chunk.js
similarity index 96%
rename from var/mongoose/cgi-bin/browse/chunk/chunk.js
rename to var/mongoose/html/browse/chunk/chunk.js
index 9d52ca4..2dad681 100644
--- a/var/mongoose/cgi-bin/browse/chunk/chunk.js
+++ b/var/mongoose/html/browse/chunk/chunk.js
@@ -69,7 +69,7 @@ $('#back').button().click(function(e) {
e.preventDefault();
var dir = $(this).attr('dir');
- window.location = '/cgi-bin/browse.jim?dir=' + dir;
+ window.location = '../index.jim?dir=' + dir;
});
});
diff --git a/var/mongoose/cgi-bin/browse/chunk/extract.jim b/var/mongoose/html/browse/chunk/extract.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/chunk/extract.jim
rename to var/mongoose/html/browse/chunk/extract.jim
diff --git a/var/mongoose/cgi-bin/browse/chunk/progress.jim b/var/mongoose/html/browse/chunk/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/chunk/progress.jim
rename to var/mongoose/html/browse/chunk/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/clipboard.jim b/var/mongoose/html/browse/clipboard.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/clipboard.jim
rename to var/mongoose/html/browse/clipboard.jim
diff --git a/var/mongoose/cgi-bin/browse/crop/crop.jim b/var/mongoose/html/browse/crop/crop.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/crop/crop.jim
rename to var/mongoose/html/browse/crop/crop.jim
diff --git a/var/mongoose/cgi-bin/browse/crop/crop.js b/var/mongoose/html/browse/crop/crop.js
similarity index 91%
rename from var/mongoose/cgi-bin/browse/crop/crop.js
rename to var/mongoose/html/browse/crop/crop.js
index 708502a..382d8d2 100755
--- a/var/mongoose/cgi-bin/browse/crop/crop.js
+++ b/var/mongoose/html/browse/crop/crop.js
@@ -17,7 +17,7 @@ $(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
- window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+ window.location = '../index.jim?dir=' + $('#params').attr('dir');
});
$('#cropit').button().click(function() {
diff --git a/var/mongoose/cgi-bin/browse/crop/execute.jim b/var/mongoose/html/browse/crop/execute.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/crop/execute.jim
rename to var/mongoose/html/browse/crop/execute.jim
diff --git a/var/mongoose/cgi-bin/browse/crop/progress.jim b/var/mongoose/html/browse/crop/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/crop/progress.jim
rename to var/mongoose/html/browse/crop/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/decrypt/decrypt.jim b/var/mongoose/html/browse/decrypt/decrypt.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/decrypt/decrypt.jim
rename to var/mongoose/html/browse/decrypt/decrypt.jim
diff --git a/var/mongoose/cgi-bin/browse/decrypt/decrypt.js b/var/mongoose/html/browse/decrypt/decrypt.js
similarity index 89%
rename from var/mongoose/cgi-bin/browse/decrypt/decrypt.js
rename to var/mongoose/html/browse/decrypt/decrypt.js
index 701da58..b0644e6 100755
--- a/var/mongoose/cgi-bin/browse/decrypt/decrypt.js
+++ b/var/mongoose/html/browse/decrypt/decrypt.js
@@ -15,7 +15,7 @@ $(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
- window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+ window.location = '../index.jim?dir=' + $('#params').attr('dir');
});
$('#decryptit').button().click(function() {
diff --git a/var/mongoose/cgi-bin/browse/decrypt/execute.jim b/var/mongoose/html/browse/decrypt/execute.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/decrypt/execute.jim
rename to var/mongoose/html/browse/decrypt/execute.jim
diff --git a/var/mongoose/cgi-bin/browse/decrypt/progress.jim b/var/mongoose/html/browse/decrypt/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/decrypt/progress.jim
rename to var/mongoose/html/browse/decrypt/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/delete.jim b/var/mongoose/html/browse/delete.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/delete.jim
rename to var/mongoose/html/browse/delete.jim
diff --git a/var/mongoose/cgi-bin/browse/download.jim b/var/mongoose/html/browse/download.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/download.jim
rename to var/mongoose/html/browse/download.jim
diff --git a/var/mongoose/cgi-bin/browse/enc.jim b/var/mongoose/html/browse/enc.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/enc.jim
rename to var/mongoose/html/browse/enc.jim
diff --git a/var/mongoose/cgi-bin/browse/epgtitle.jim b/var/mongoose/html/browse/epgtitle.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/epgtitle.jim
rename to var/mongoose/html/browse/epgtitle.jim
diff --git a/var/mongoose/cgi-bin/browse/ffmpeg.jim b/var/mongoose/html/browse/ffmpeg.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/ffmpeg.jim
rename to var/mongoose/html/browse/ffmpeg.jim
diff --git a/var/mongoose/cgi-bin/browse/file.jim b/var/mongoose/html/browse/file.jim
similarity index 97%
rename from var/mongoose/cgi-bin/browse/file.jim
rename to var/mongoose/html/browse/file.jim
index 30f0b3b..e82696c 100755
--- a/var/mongoose/cgi-bin/browse/file.jim
+++ b/var/mongoose/html/browse/file.jim
@@ -146,7 +146,7 @@ puts "
"
-set url "/cgi-bin/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
+set url "/bin/browse/ffmpeg.jim?file=[cgi_quote_url $file]"
puts {
-
-
+
+
}
-source browse/assets.jim
+source assets.jim
puts "
$dir
diff --git a/var/mongoose/cgi-bin/browse/join/execute.jim b/var/mongoose/html/browse/join/execute.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/join/execute.jim
rename to var/mongoose/html/browse/join/execute.jim
diff --git a/var/mongoose/cgi-bin/browse/join/join.css b/var/mongoose/html/browse/join/join.css
similarity index 100%
rename from var/mongoose/cgi-bin/browse/join/join.css
rename to var/mongoose/html/browse/join/join.css
diff --git a/var/mongoose/cgi-bin/browse/join/join.jim b/var/mongoose/html/browse/join/join.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/join/join.jim
rename to var/mongoose/html/browse/join/join.jim
diff --git a/var/mongoose/cgi-bin/browse/join/join.js b/var/mongoose/html/browse/join/join.js
similarity index 95%
rename from var/mongoose/cgi-bin/browse/join/join.js
rename to var/mongoose/html/browse/join/join.js
index fbf080d..8694edc 100755
--- a/var/mongoose/cgi-bin/browse/join/join.js
+++ b/var/mongoose/html/browse/join/join.js
@@ -22,7 +22,7 @@ $(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
- window.location = '/cgi-bin/browse.jim?dir=' + $(this).attr('dir');
+ window.location = '../index.jim?dir=' + $(this).attr('dir');
});
$('#filelist').sortable().disableSelection();
diff --git a/var/mongoose/cgi-bin/browse/join/progress.jim b/var/mongoose/html/browse/join/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/join/progress.jim
rename to var/mongoose/html/browse/join/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/lock.jim b/var/mongoose/html/browse/lock.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/lock.jim
rename to var/mongoose/html/browse/lock.jim
diff --git a/var/mongoose/cgi-bin/browse/mknewdir.jim b/var/mongoose/html/browse/mknewdir.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/mknewdir.jim
rename to var/mongoose/html/browse/mknewdir.jim
diff --git a/var/mongoose/cgi-bin/browse/mpg/execute.jim b/var/mongoose/html/browse/mpg/execute.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/mpg/execute.jim
rename to var/mongoose/html/browse/mpg/execute.jim
diff --git a/var/mongoose/cgi-bin/browse/mpg/mpg.jim b/var/mongoose/html/browse/mpg/mpg.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/mpg/mpg.jim
rename to var/mongoose/html/browse/mpg/mpg.jim
diff --git a/var/mongoose/cgi-bin/browse/mpg/mpg.js b/var/mongoose/html/browse/mpg/mpg.js
similarity index 89%
rename from var/mongoose/cgi-bin/browse/mpg/mpg.js
rename to var/mongoose/html/browse/mpg/mpg.js
index c30be07..c487fc3 100755
--- a/var/mongoose/cgi-bin/browse/mpg/mpg.js
+++ b/var/mongoose/html/browse/mpg/mpg.js
@@ -15,7 +15,7 @@ $(document).ready(function() {
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
- window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+ window.location = '../index.jim?dir=' + $('#params').attr('dir');
});
$('#mpgit').button().click(function() {
diff --git a/var/mongoose/cgi-bin/browse/mpg/progress.jim b/var/mongoose/html/browse/mpg/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/mpg/progress.jim
rename to var/mongoose/html/browse/mpg/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/new.jim b/var/mongoose/html/browse/new.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/new.jim
rename to var/mongoose/html/browse/new.jim
diff --git a/var/mongoose/cgi-bin/browse/newdir.jim b/var/mongoose/html/browse/newdir.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/newdir.jim
rename to var/mongoose/html/browse/newdir.jim
diff --git a/var/mongoose/cgi-bin/browse/rename.jim b/var/mongoose/html/browse/rename.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/rename.jim
rename to var/mongoose/html/browse/rename.jim
diff --git a/var/mongoose/cgi-bin/browse/resetnew.jim b/var/mongoose/html/browse/resetnew.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/resetnew.jim
rename to var/mongoose/html/browse/resetnew.jim
diff --git a/var/mongoose/cgi-bin/browse/savestream.jim b/var/mongoose/html/browse/savestream.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/savestream.jim
rename to var/mongoose/html/browse/savestream.jim
diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/html/browse/script.js
similarity index 87%
rename from var/mongoose/cgi-bin/browse/browse.js
rename to var/mongoose/html/browse/script.js
index 227515f..af04836 100755
--- a/var/mongoose/cgi-bin/browse/browse.js
+++ b/var/mongoose/html/browse/script.js
@@ -26,7 +26,7 @@ function reloadclipboard()
$('#clipboard')
.empty()
.html('
Loading...')
- .load('/cgi-bin/browse/clipboard.jim', function() {
+ .load('/browse/clipboard.jim', function() {
// Start Clipboard post-load actions
@@ -42,13 +42,13 @@ else
}
$('#clipclear').button().click(function() {
- $.get('/cgi-bin/browse/clipboard.jim?act=clear', function() {
+ $.get('/browse/clipboard.jim?act=clear', function() {
reloadclipboard();
});
});
$('a.clipdel').click(function() {
- $.get('/cgi-bin/browse/clipboard.jim?act=remove&path=' +
+ $.get('/browse/clipboard.jim?act=remove&path=' +
$(this).attr('path'), function() {
reloadclipboard();
});
@@ -59,7 +59,7 @@ $('#paste').button()
disableall();
pastedialogue();
$('#pwfeedback').load(
- '/cgi-bin/browse/clipboard.jim?act=paste&dir='
+ '/browse/clipboard.jim?act=paste&dir='
+ encodeURIComponent(dir), function() {
$('#pwdialogue').dialog('close');
window.location.reload(true);
@@ -150,7 +150,7 @@ function delete_callback(file, dir, id)
$(results)
.html('

Deleting, please wait...')
.slideDown('slow')
- .load('/cgi-bin/browse/delete.jim', {
+ .load('/browse/delete.jim', {
'dir': dir,
'files': [decodeURIComponent(file)]
}, function() {
@@ -162,40 +162,48 @@ function delete_callback(file, dir, id)
function lock_callback(file, type, id)
{
- var url = '/cgi-bin/browse/lock.jim?file=' + file;
+ var url = '/browse/lock.jim?file=' + file;
$.get(url, function() { window.location.reload(true); });
}
function enc_callback(file, type, id)
{
- var url = '/cgi-bin/browse/enc.jim?file=' + file;
+ var url = '/browse/enc.jim?file=' + file;
$.get(url, function() { window.location.reload(true); });
}
function new_callback(file, type, id)
{
- var url = '/cgi-bin/browse/new.jim?file=' + file;
+ var url = '/browse/new.jim?file=' + file;
$.get(url, function() { window.location.reload(true); });
}
function rename_submit()
{
var s = $('#renameform_form').serialize();
- $.post('/cgi-bin/browse/rename.jim', s,
+ $.post('/browse/rename.jim', s,
function() { window.location.reload(true); });
}
function drename_submit()
{
var s = $('#drenameform_form').serialize();
- $.get('/cgi-bin/browse/rename.jim?' + s,
+ $.get('/browse/rename.jim?' + s,
+ function() { window.location.reload(true); });
+}
+
+function aexpiry_submit()
+{
+ $('#aexpiry_working').slideDown('slow');
+ var s = $('#aexpiry_form').serialize();
+ $.get('/browse/aexpiry.jim?' + s,
function() { window.location.reload(true); });
}
function newdir_submit()
{
var s = $('#newdirform_form').serialize();
- $.get('/cgi-bin/browse/mknewdir.jim?' + s,
+ $.get('/browse/mknewdir.jim?' + s,
function() { window.location.reload(true); });
}
@@ -204,7 +212,7 @@ function savestream_submit()
var s = $('#savestream_form').serialize();
var sf = $('#save_stream').attr('file');
$('#savestream_spin').show();
- $.get('/cgi-bin/browse/savestream.jim?sfile=' +
+ $.get('/browse/savestream.jim?sfile=' +
encodeURIComponent(sf) + '&' + s,
function() {
window.location.reload(true);
@@ -249,12 +257,7 @@ function preparemenu(el, menu)
else
$(menu).disableContextMenuItems('#crop');
-/*
- if (el.attr('def') == 'HD')
- $(menu).disableContextMenuItems('#strip');
- else
-*/
- $(menu).enableContextMenuItems('#strip');
+ $(menu).enableContextMenuItems('#strip');
if (el.attr('rsize') > 4294967296)
$(menu).enableContextMenuItems('#chunk');
@@ -355,6 +358,7 @@ function preparedmenu(el, menu)
fixdmenu(el, menu, 'autodedup', '#dedup', 'Auto-dedup', 0);
fixdmenu(el, menu, 'autodecrypt', '#decrypt', 'Auto-decrypt', 1);
fixdmenu(el, menu, 'autompg', '#mpg', 'Auto-mpg', 0);
+ fixdmenu(el, menu, 'autoexpire', '#expire', 'Auto-expire', 0);
}
$(document).ready(function() {
@@ -380,7 +384,7 @@ var menuclick = function(action, el, pos)
break;
// Fallthrough
case 'cut':
- $.get('/cgi-bin/browse/clipboard.jim?act=add&mode=' + action +
+ $.get('/browse/clipboard.jim?act=add&mode=' + action +
'&path=' + file, function() {
reloadclipboard();
});
@@ -412,7 +416,7 @@ var menuclick = function(action, el, pos)
if (type == 'ts')
{
- $.getJSON('/cgi-bin/browse/epgtitle.jim?file=' +
+ $.getJSON('/browse/epgtitle.jim?file=' +
file, epginfo_callback);
}
@@ -420,38 +424,38 @@ var menuclick = function(action, el, pos)
break;
case 'download':
- window.location.href = '/cgi-bin/browse/download.jim?file=' +
+ window.location.href = '/browse/download.jim?file=' +
file + '&base=' +
encodeURIComponent(document.URL.match(/:\/\/(.[^/]+)/)[1]);
break;
case 'crop':
- window.location.href = '/cgi-bin/browse/crop/crop.jim?file=' +
+ window.location.href = '/browse/crop/crop.jim?file=' +
file;
break;
case 'strip':
- window.location.href = '/cgi-bin/browse/strip/strip.jim?file=' +
+ window.location.href = '/browse/strip/strip.jim?file=' +
file;
break;
case 'chunk':
- window.location.href = '/cgi-bin/browse/chunk/chunk.jim?file=' +
+ window.location.href = '/browse/chunk/chunk.jim?file=' +
file;
break;
case 'decrypt':
window.location.href =
- '/cgi-bin/browse/decrypt/decrypt.jim?file=' + file;
+ '/browse/decrypt/decrypt.jim?file=' + file;
break;
case 'audio':
- window.location.href = '/cgi-bin/browse/audio/audio.jim?file=' +
+ window.location.href = '/browse/audio/audio.jim?file=' +
file;
break;
case 'mpg':
- window.location.href = '/cgi-bin/browse/mpg/mpg.jim?file=' +
+ window.location.href = '/browse/mpg/mpg.jim?file=' +
file;
break;
@@ -463,14 +467,14 @@ var menuclick = function(action, el, pos)
function flagdir(file, flag, iconset, output, options)
{
- var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
+ var url = '/browse/flagdir.jim?dir=' + file +
'&flag=' + flag;
$(output).load(url, function() {
$(iconset)
.empty()
.html('

Updating...')
- .load('/cgi-bin/browse/iconset.jim?file=' + file);
+ .load('/browse/iconset.jim?file=' + file);
if ($(options).attr(flag) == '1')
$(options).attr(flag, 0);
else
@@ -492,7 +496,7 @@ var dmenuclick = function(action, el, pos)
case 'paste':
pastedialogue();
$('#pwfeedback').load(
- '/cgi-bin/browse/clipboard.jim?act=paste&dir=' +
+ '/browse/clipboard.jim?act=paste&dir=' +
file, function() {
$('#pwdialogue').dialog('close');
reloadclipboard();
@@ -509,7 +513,7 @@ var dmenuclick = function(action, el, pos)
.html('

' +
'Deleting, please wait...')
.slideDown('slow')
- .load('/cgi-bin/browse/delete.jim', {
+ .load('/browse/delete.jim', {
'dir': dir,
'files': [decodeURIComponent(file)]
}, function() {
@@ -525,7 +529,7 @@ var dmenuclick = function(action, el, pos)
break;
// Fallthrough
case 'cut':
- $.get('/cgi-bin/browse/clipboard.jim?act=add&mode=' + action +
+ $.get('/browse/clipboard.jim?act=add&mode=' + action +
'&path=' + file, function() {
reloadclipboard();
});
@@ -537,6 +541,22 @@ var dmenuclick = function(action, el, pos)
$('#drenameform').dialog('open');
break;
+ case 'expire':
+ if ($(el).attr('autoexpire') == 1)
+ flagdir(file, 'autoexpire', iconset, results, el);
+ else
+ {
+ $('#aexpiry_ldir').val(decodeURIComponent(file));
+ if ($(el).attr('autoexpiredays') > 0)
+ $('#aexpiry_days')
+ .val($(el).attr('autoexpiredays'));
+ else
+ $('#aexpiry_days').val(7);
+ $('#aexpiry_working').hide('fast');
+ $('#aexpiry').dialog('open');
+ }
+ break;
+
case 'flat':
flagdir(file, 'noflatten', iconset, results, el);
break;
@@ -566,7 +586,7 @@ var dmenuclick = function(action, el, pos)
break;
case 'resetnew':
- var url = '/cgi-bin/browse/resetnew.jim?dir=' + file;
+ var url = '/browse/resetnew.jim?dir=' + file;
$.get(url, function() { window.location.reload(true); });
break;
@@ -647,7 +667,7 @@ var dmenuclick = function(action, el, pos)
var type = $(this).attr('type');
var opt = $(this).nextAll('a').find('img.opt');
- var url = '/cgi-bin/browse/file.jim?file=' + file
+ var url = '/browse/file.jim?file=' + file
+ '&type=' + type;
$dialog.load(url);
@@ -688,6 +708,19 @@ var dmenuclick = function(action, el, pos)
close: function() { $('#drename').val(''); }
});
+ $('#aexpiry').dialog({
+ autoOpen: false,
+ height: 'auto', width: 'auto',
+ modal: true,
+ buttons: {
+ "Update": aexpiry_submit,
+ "Close": function() {
+ $(this).dialog('close');
+ }
+ },
+ close: function() { $('#aexpiry_days').val('0'); }
+ });
+
$('#savestreamform').dialog({
autoOpen: false,
height: 'auto', width: 'auto',
@@ -710,15 +743,15 @@ var dmenuclick = function(action, el, pos)
});
// Load folder sizes
- $.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
+ $.getJSON('/browse/sizes.jim?dir=' + encodeURIComponent(dir),
folder_size_callback);
// Flag shrunk recordings
- $.getJSON('/cgi-bin/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
+ $.getJSON('/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
shrunk_callback);
// Flag folders with unwatched items
- $.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
+ $.getJSON('/browse/newdir.jim?dir=' + encodeURIComponent(dir),
new_folder_callback);
// Load clipboard
@@ -738,7 +771,7 @@ var dmenuclick = function(action, el, pos)
$('#savestream_spin').hide();
$('#savestreamform').dialog('open');
$('#savestream_detail').load(
- '/cgi-bin/browse/ffmpeg.jim?file=' +
+ '/browse/ffmpeg.jim?file=' +
encodeURIComponent($('#save_stream').attr('file')));
});
@@ -758,7 +791,7 @@ var dmenuclick = function(action, el, pos)
files.push($(this).attr('file'));
});
//console.log("%o", files);
- window.location.href = '/cgi-bin/browse/join/join.jim?files=' +
+ window.location.href = '/browse/join/join.jim?files=' +
files.join();
});
@@ -790,7 +823,7 @@ var dmenuclick = function(action, el, pos)
}
});
$('#pwfeedback').load(
- '/cgi-bin/browse/delete.jim', {
+ '/browse/delete.jim', {
'dir': dir,
'files': files
}, function() {
@@ -812,7 +845,7 @@ var dmenuclick = function(action, el, pos)
'Copying recordings can take a very long time!'))
return;
- $.post('/cgi-bin/browse/clipboard.jim', {
+ $.post('/browse/clipboard.jim', {
'act': 'add',
'dir': dir,
'mode': action,
@@ -857,7 +890,7 @@ var dmenuclick = function(action, el, pos)
function checkstream()
{
- $.get('/cgi-bin/streamsize.jim', function(size) {
+ $.get('/browse/streamsize.jim', function(size) {
//console.log('Stream size: %o', size);
var mb = size / (1024 * 1024);
mb = mb|0;
diff --git a/var/mongoose/cgi-bin/browse/shrunk.jim b/var/mongoose/html/browse/shrunk.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/shrunk.jim
rename to var/mongoose/html/browse/shrunk.jim
diff --git a/var/mongoose/cgi-bin/browse/sizes.jim b/var/mongoose/html/browse/sizes.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/sizes.jim
rename to var/mongoose/html/browse/sizes.jim
diff --git a/var/mongoose/cgi-bin/streamsize.jim b/var/mongoose/html/browse/streamsize.jim
similarity index 100%
rename from var/mongoose/cgi-bin/streamsize.jim
rename to var/mongoose/html/browse/streamsize.jim
diff --git a/var/mongoose/cgi-bin/browse/strip/analyse.jim b/var/mongoose/html/browse/strip/analyse.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/strip/analyse.jim
rename to var/mongoose/html/browse/strip/analyse.jim
diff --git a/var/mongoose/cgi-bin/browse/strip/execute.jim b/var/mongoose/html/browse/strip/execute.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/strip/execute.jim
rename to var/mongoose/html/browse/strip/execute.jim
diff --git a/var/mongoose/cgi-bin/browse/strip/progress.jim b/var/mongoose/html/browse/strip/progress.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/strip/progress.jim
rename to var/mongoose/html/browse/strip/progress.jim
diff --git a/var/mongoose/cgi-bin/browse/strip/strip.jim b/var/mongoose/html/browse/strip/strip.jim
similarity index 100%
rename from var/mongoose/cgi-bin/browse/strip/strip.jim
rename to var/mongoose/html/browse/strip/strip.jim
diff --git a/var/mongoose/cgi-bin/browse/strip/strip.js b/var/mongoose/html/browse/strip/strip.js
similarity index 92%
rename from var/mongoose/cgi-bin/browse/strip/strip.js
rename to var/mongoose/html/browse/strip/strip.js
index dd80f74..4524d68 100755
--- a/var/mongoose/cgi-bin/browse/strip/strip.js
+++ b/var/mongoose/html/browse/strip/strip.js
@@ -27,7 +27,7 @@ $('#analysis').load('analyse.jim?file=' + $('#params').attr('file'),
$('#progressbar').reportprogress(0);
$('#back').button().click(function() {
- window.location = '/cgi-bin/browse.jim?dir=' + $('#params').attr('dir');
+ window.location = '../index.jim?dir=' + $('#params').attr('dir');
});
$('#stripit').button().click(function() {
diff --git a/var/mongoose/cgi-bin/browse/style.css b/var/mongoose/html/browse/style.css
similarity index 100%
rename from var/mongoose/cgi-bin/browse/style.css
rename to var/mongoose/html/browse/style.css
diff --git a/var/mongoose/html/css/jquery.contextMenu.css b/var/mongoose/html/css/jquery.contextMenu.css
index 7ab4f61..35fe861 100644
--- a/var/mongoose/html/css/jquery.contextMenu.css
+++ b/var/mongoose/html/css/jquery.contextMenu.css
@@ -70,5 +70,6 @@
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }
.contextMenu LI.decryptr A { background-image: url(/img/context/decryptr.png); }
.contextMenu LI.mpg A { background-image: url(/img/context/mpg.png); }
+.contextMenu LI.clock A { background-image: url(/img/context/clock.png); }
diff --git a/var/mongoose/html/dedup/dedup b/var/mongoose/html/dedup/dedup
index 9bb7908..bc7276b 100755
--- a/var/mongoose/html/dedup/dedup
+++ b/var/mongoose/html/dedup/dedup
@@ -73,6 +73,7 @@ foreach dir $dirs {
# Dooooo, it.
$ts settitle $syn
ts renamegroup $file $fn
+ $ts set_deduped
}
}
}
diff --git a/var/mongoose/html/dedup/process.jim b/var/mongoose/html/dedup/process.jim
index 5b7d814..405195c 100755
--- a/var/mongoose/html/dedup/process.jim
+++ b/var/mongoose/html/dedup/process.jim
@@ -4,6 +4,12 @@ require system.class
proc dedupprocess {file} {{seen {}}} {
set ts [ts fetch $file 1]
+
+ if {[$ts flag "Deduped"]} {
+ lappend seen [file rootname [file tail $file]]
+ return [list nothing $ts "" ""]
+ }
+
set dir [file dirname $file]
set base [file tail [file rootname $file]]
set syn [dedupnormalise [$ts get synopsis] [$ts get title]]
@@ -12,7 +18,7 @@ proc dedupprocess {file} {{seen {}}} {
regsub -all -- {[?]} $fn "" fn
set stat ok
- if {[system inuse [file rootname $file]]} {
+ if {[$ts inuse]} {
set stat inuse
} elseif {$fn in $seen} {
set stat dup
@@ -20,6 +26,7 @@ proc dedupprocess {file} {{seen {}}} {
set stat error
} elseif {$base eq $fn} {
set stat nothing
+ $ts set_deduped
} elseif {[file exists "$dir/$fn.ts"]} {
set stat preserve
}
diff --git a/var/mongoose/html/dedup/script.js b/var/mongoose/html/dedup/script.js
index 469fd7c..44dbea4 100755
--- a/var/mongoose/html/dedup/script.js
+++ b/var/mongoose/html/dedup/script.js
@@ -2,7 +2,7 @@
$(function() {
$('#browse').button().click(function() {
- window.location = '/cgi-bin/browse.jim?dir=' +
+ window.location = '/browse/index.jim?dir=' +
encodeURIComponent($('#dir').text());
});
diff --git a/var/mongoose/html/lib/header.jim b/var/mongoose/html/lib/header.jim
index ac50070..8aecb19 100755
--- a/var/mongoose/html/lib/header.jim
+++ b/var/mongoose/html/lib/header.jim
@@ -4,6 +4,7 @@ puts {
+
}
source /mod/webif/include/model.jim
diff --git a/var/mongoose/html/m/script.js b/var/mongoose/html/m/script.js
index 9935a7a..659ff77 100644
--- a/var/mongoose/html/m/script.js
+++ b/var/mongoose/html/m/script.js
@@ -112,15 +112,15 @@ $(document).delegate('#browsepage', 'pageinit', function() {
//console.log('DIR: %O', dir);
// Load folder sizes
- $.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
+ $.getJSON('/browse/sizes.jim?dir=' + encodeURIComponent(dir),
folder_size_callback);
// Flag folders with unwatched items
- $.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
+ $.getJSON('/browse/newdir.jim?dir=' + encodeURIComponent(dir),
new_folder_callback);
// Flag shrunk recordings
- $.getJSON('/cgi-bin/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
+ $.getJSON('/browse/shrunk.jim?dir=' + encodeURIComponent(dir),
shrunk_callback);
});
diff --git a/var/mongoose/include/menuicons.jim b/var/mongoose/include/menuicons.jim
index 9dfa412..dc7192a 100755
--- a/var/mongoose/include/menuicons.jim
+++ b/var/mongoose/include/menuicons.jim
@@ -38,7 +38,7 @@ if {[[settings] epg_style] eq "grid"} {
puts {}
menuitem "Browse Media Files" "/images/323_1_10_Menu_Video.png" \
- /cgi-bin/browse.jim 217 228
+ /browse/index.jim 217 228
menuitem "Scheduled Events" "/images/321_1_00_Menu_CHList.png" \
/sched/sched.jim 217 228
menuitem "EPG" "/images/328_1_26_Menu_TV_Guide.png" \
diff --git a/var/mongoose/include/toolbar.jim b/var/mongoose/include/toolbar.jim
index 8780d9c..550026a 100755
--- a/var/mongoose/include/toolbar.jim
+++ b/var/mongoose/include/toolbar.jim
@@ -38,7 +38,7 @@ puts {
if {[file exists "/mod/bin/ir"]} {
tb "/img/remote.png" "Remote" "/plugin/ir/remote.jim"
}
-tb "/images/323_1_10_Menu_Video.png" "Browse" "/cgi-bin/browse.jim"
+tb "/images/323_1_10_Menu_Video.png" "Browse" "/browse/index.jim"
tb "/images/321_1_00_Menu_CHList.png" "Schedule" "/sched/sched.jim"
tb "/images/328_1_26_Menu_TV_Guide.png" "EPG" $epglink
tb "/img/spanner.png" "Services" "/services.shtml"
diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto
index 7c15340..1fe2288 100755
--- a/var/mongoose/lib/bin/auto
+++ b/var/mongoose/lib/bin/auto
@@ -1,7 +1,7 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
-require lock system.class ts.class tdelete pretty_size
+require lock system.class ts.class tdelete pretty_size browse.class safe_delete
set debug 0
@@ -95,17 +95,9 @@ if {[system pkginst undelete]} {
log "Dustbin: $dustbin"
-proc bindir {file binroot} {
- set dir [file dirname $file]
- regsub "^[system mediaroot]" $dir $binroot ndir
- if {$dir eq $ndir} { set ndir $binroot }
- system mkdir_p $ndir
- return $ndir
-}
-
proc dedup {dir} {
log "DEDUP: \[$dir]"
- loop i 0 2 {
+ loop i 0 1 {
foreach line [split \
[exec /mod/webif/html/dedup/dedup -yes -auto $dir] "\n"] {
log $line 1
@@ -113,9 +105,34 @@ proc dedup {dir} {
}
}
+proc do_expire {ts} {
+ global ax_days
+ set file [$ts get file]
+
+ # Calculate the age of the file in days.
+ set age $(([clock seconds] - [$ts get start]) / 86400.0)
+ log " EXPIRE: $file (age = $age)"
+
+ if {$age > $ax_days} {
+ log " EXPIRE: $file ($age > $ax_days)" 1
+ if {[$ts inuse]} {
+ log " In use." 1
+ return
+ }
+ if {[safe_delete $file]} {
+ log " Deleted." 1
+ }
+ }
+}
+
proc do_shrink {ts} {
global tmp dustbin tsgroup
+ if {[$ts flag "Shrunk"]} {
+ log " Already shrunk."
+ return
+ }
+
set file [file rootname [$ts get file]]
if {[catch {
set perc [exec /mod/bin/stripts -aq $file]
@@ -131,6 +148,11 @@ proc do_shrink {ts} {
if {$perc == 0} {
log " Already shrunk."
+ $ts set_shrunk
+ return
+ }
+ if {[$ts inuse]} {
+ log " In use." 1
return
}
set size [$ts size]
@@ -161,18 +183,8 @@ proc do_shrink {ts} {
file rename $f "${file}_shrunk${ext}"
}
- # Move the old recording to the bin if undelete is installed.
- if {$dustbin ne ""} {
- $ts move [bindir $file "$dustbin/webif_autoshrink"] 1 1
- } else {
- # Delete otherwise.
- if {[$ts delete]} {
- log "Successfully deleted $file."
- } else {
- log "Problem deleting $file, [$ts get error]" 1
- return
- }
- }
+ # Remove the old recording (-> bin if undelete is installed)
+ safe_delete [$ts get file] "webif_autoshrink"
# Finally, rename the shrunken recording again.
foreach ext $tsgroup {
@@ -181,6 +193,7 @@ proc do_shrink {ts} {
file rename $f "${file}.$ext"
}
}
+ $ts set_shrunk
log "Done... [endclock $size]" 1
}
@@ -208,6 +221,10 @@ proc do_decrypt {ts} {
return
}
+ if {[$ts inuse]} {
+ log " In use." 1
+ return
+ }
set size [$ts size]
dsc $size
startclock
@@ -230,7 +247,7 @@ proc do_decrypt {ts} {
log " Removing/binning old copy."
# Move the old recording to the bin if undelete is installed.
if {$dustbin ne ""} {
- set bin [bindir $file "$dustbin/webif_autodecrypt"]
+ set bin [_del_bindir $file "webif_autodecrypt"]
set tail [file tail $rfile]
file rename "$rfile.encrypted" "$bin/$tail.ts"
foreach ext {nts hmt thm} {
@@ -269,6 +286,10 @@ proc do_mpg {ts} {
return
}
+ if {[$ts inuse]} {
+ log " In use." 1
+ return
+ }
dsc [$ts size]
log " MPG: $file" 1
@@ -295,11 +316,6 @@ proc entries {dir callback} {
if {![string match {*.ts} $entry} continue
if {[catch {set ts [ts fetch "$dir/$entry"]}]} continue
if {$ts == 0} continue
- if {[system inuse [file rootname "$dir/$entry"]]} {
- log "$entry - in use\n" 1
- continue
- }
- #dsc [file size "$dir/$entry"]
$callback $ts
}
}
@@ -319,6 +335,14 @@ proc mpg {dir} {
entries $dir do_mpg
}
+proc expire {dir} {
+ global ax_days
+ log "EXPIRE: \[$dir]"
+
+ set ax_days [{dir expiry} $dir]
+ entries $dir do_expire
+}
+
proc scan {dir attr {force 0}} {{indent 0}} {
global dustbin
@@ -369,10 +393,10 @@ set rootdev $rootstat(dev)
#log "Root device: $rootdev" 1
if {[llength $argv] > 0} {
- if {[lindex $argv 0] eq "test"} { set debug 1 }
+ set debug 1
foreach arg $argv { scan $root $arg }
} else {
- foreach arg {dedup decrypt shrink mpg} {
+ foreach arg {dedup decrypt shrink mpg expire} {
set st [clock milliseconds]
scan $root $arg
log "$arg scan completed in [elapsed $st] seconds." 1
diff --git a/var/mongoose/lib/browse.class b/var/mongoose/lib/browse.class
index 013198c..f03525e 100644
--- a/var/mongoose/lib/browse.class
+++ b/var/mongoose/lib/browse.class
@@ -15,6 +15,16 @@ proc _addicon {img {hover ""} {class va}} {
return $icon
}
+proc {dir expiry} {dir} {
+ if {[catch {
+ set fd [open "$dir/.autoexpire"]
+ set days $([read $fd] + 0)
+ $fd close
+ }]} { set days 0 }
+ if {!$days} { set days 7 }
+ return $days
+}
+
proc {dir iconset} {dir} {
set icons {}
set attrs {}
@@ -73,6 +83,15 @@ proc {dir iconset} {dir} {
lappend attrs "autompg=1"
}
+ set autoexpire 0
+ if {[file exists "$dir/.autoexpire"]} {
+ set days [{dir expiry} $dir]
+ set autoexpire 1
+ lappend icons [_addicon "/img/clock.png" \
+ "Auto-Expire ($days day$($days == 1 ? "" : "s"))"]
+ lappend attrs "autoexpire=1" "autoexpiredays=$days"
+ }
+
return [list $icons $attrs]
}
diff --git a/var/mongoose/lib/safe_delete b/var/mongoose/lib/safe_delete
index 47ea231..a94c322 100755
--- a/var/mongoose/lib/safe_delete
+++ b/var/mongoose/lib/safe_delete
@@ -10,11 +10,13 @@ if {![exists -proc _del_bindir]} {
set _del_dustbin ""
}
- proc _del_bindir {file} {
+ proc _del_bindir {file {prefix ""}} {
global _del_dustbin
+ set lbin $_del_dustbin
+ if {$prefix ne ""} { append lbin "/$prefix" }
set dir [file dirname $file]
- regsub "^[system mediaroot]" $dir $_del_dustbin ndir
- if {$dir eq $ndir} { set ndir $_del_dustbin }
+ regsub "^[system mediaroot]" $dir $lbin ndir
+ if {$dir eq $ndir} { set ndir $lbin }
system mkdir_p $ndir
return $ndir
}
@@ -23,23 +25,23 @@ if {![exists -proc _del_bindir]} {
exec /mod/bin/busybox/touch $file
}
- proc safe_delete {file} {
+ proc safe_delete {file {px ""}} {
global _del_dustbin
- # Check if the file is already in the dustbin
-
- if {$_del_dustbin ne "" && [\
+ # Check if undelete is installed and that the file being
+ # deleted is not already in the dustbin.
+ set dustbin 1
+ if {$_del_dustbin eq "" || [\
string first $_del_dustbin $file] > -1} {
- set dustbin ""
- } else {
- set dustbin $_del_dustbin
+ set dustbin 0
}
# Directory
if {[file isdirectory $file]} {
- if {$dustbin ne ""} {
- set ndir "[_del_bindir $file]/[file tail $file]"
+ if {$dustbin} {
+ set ndir "[_del_bindir $file $px]/[\
+ file tail $file]"
while {[file isdirectory $ndir]} {
append ndir "_"
}
@@ -56,8 +58,8 @@ if {![exists -proc _del_bindir]} {
# Check TS validity
if {![catch {$ts get file}]} {
- if {$dustbin ne ""} {
- $ts move [_del_bindir $file] 1 1
+ if {$dustbin} {
+ $ts move [_del_bindir $file $px] 1 1
} else {
if {[$ts delete]} {
return 1
@@ -71,8 +73,8 @@ if {![exists -proc _del_bindir]} {
# otherwise treat as normal file.
- if {$dustbin ne ""} {
- set nfile "[_del_bindir $file]/[file tail $file]"
+ if {$dustbin} {
+ set nfile "[_del_bindir $file $px]/[file tail $file]"
file rename $file $nfile
_del_touch $nfile
} else {
diff --git a/var/mongoose/lib/setup b/var/mongoose/lib/setup
index 70c913f..11c43ca 100644
--- a/var/mongoose/lib/setup
+++ b/var/mongoose/lib/setup
@@ -12,12 +12,12 @@ if {![exists -proc require]} {
proc httpheader {{type "text/html"} {cache 0} {extra ""}} {{done 0}} {
if {$done} return
if {!$cache} {
- puts -nonewline "Content-Type: $type; no-cache\r\n"
+ puts -nonewline "Content-Type: $type; charset=\"UTF-8\"; no-cache\r\n"
puts -nonewline "Expires: -1\r\n"
puts -nonewline "Pragma: no-cache\r\n"
puts -nonewline "Cache-Control: no-cache\r\n"
} else {
- puts "Content-Type: $type\r\n"
+ puts "Content-Type: $type; charset=\"UTF-8\"\r\n"
}
puts -nonewline $extra
puts -nonewline "\r\n"
diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class
index d6a39bb..3818711 100644
--- a/var/mongoose/lib/system.class
+++ b/var/mongoose/lib/system.class
@@ -69,9 +69,29 @@ proc {system pkgver} {{pkg webif}} {
return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
}
-proc {system pkginst} {pkg} {
- if {[exec opkg list-installed $pkg] ne ""} {
- return 1 } else { return 0 }
+proc {system pkginst} {pkg} {{cache {}} {ncache {}}} {
+ if {$pkg in $cache} { return 1 }
+ if {$pkg in $ncache} { return 0 }
+
+ # It may not be possible to get an opkg lock immediately so
+ # try several times and throw an error if not.
+ set status unknown
+ loop i 0 5 {
+ if {[catch {set status [exec opkg list-installed $pkg]}]} {
+ sleep 1
+ } else break
+ }
+ if {$status eq "unknown"} {
+ puts "Could not get opkg lock after 5 seconds."
+ exit
+ }
+
+ if {$status ne ""} {
+ lappend $cache $pkg
+ return 1
+ }
+ lappend $ncache $pkg
+ return 0
}
proc {system mediaroot} {} {
diff --git a/var/mongoose/lib/ts.class b/var/mongoose/lib/ts.class
index 491451e..cecdafc 100644
--- a/var/mongoose/lib/ts.class
+++ b/var/mongoose/lib/ts.class
@@ -48,6 +48,11 @@ ts method _parse {line} {
set flags [split [string range $flags_list 0 end-1] ,]
}
+ts method inuse {} {
+ if {[system inuse [file rootname $file]]} { return 1 }
+ return 0
+}
+
ts method bookmarks {} {
return [exec /mod/bin/hmt -bookmarks $file]
}
@@ -68,6 +73,18 @@ ts method lock {} {
return 1
}
+ts method set_shrunk {} {
+ set cmd [list /mod/bin/hmt +shrunk $file]
+ exec {*}$cmd
+ return 1
+}
+
+ts method set_deduped {} {
+ set cmd [list /mod/bin/hmt +dedup $file]
+ exec {*}$cmd
+ return 1
+}
+
ts method unenc {} {
set cmd [list /mod/bin/hmt -protect $file]
exec {*}$cmd