404 lines
11 KiB
Plaintext
Executable File
404 lines
11 KiB
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
package require cgi
|
|
source /mod/webif/lib/setup
|
|
require ts.class pretty_size system.class settings.class escape browse.class \
|
|
plugin epg.class classdump
|
|
|
|
|
|
set mroot [system mediaroot]
|
|
set dir [cgi_get topdir $mroot]
|
|
set model [system model]
|
|
set dustbin [system dustbin 1]
|
|
set nicesplice [system pkginst nicesplice]
|
|
set settings [settings]
|
|
set curconfig [$settings _tval_setting "fvConfig"]
|
|
set curconfig [cgi_get config $curconfig]
|
|
if {$curconfig == 0} {set curconfig "default"}
|
|
|
|
jqplugin contextMenu bar enadis blockui dialogue
|
|
|
|
header
|
|
|
|
jscss js/i18n/grid.locale-en.js
|
|
puts {
|
|
<script type="text/javascript">
|
|
jQuery.jgrid.no_legacy_api = true;
|
|
</script>
|
|
}
|
|
#jscss js/jquery.jqGrid.min.js css/ui.jqgrid.css
|
|
jscss js/jquery.jqGrid.js css/ui.jqgrid.css
|
|
jscss plugins/ui.multiselect.js plugins/ui.multiselect.css
|
|
|
|
jscss /browse/script.js /browse/style.css
|
|
jscss contextmenu.js
|
|
jscss script.js style.css
|
|
if {[system has tvdb]} { jscss /browse/tvdb/script.js /browse/tvdb/style.css }
|
|
|
|
set plugins { dmenu {} menu {} omenu {} buttons {} dircolumn {} flcolumn {} icons {} dmenuattr {} menuattr {} omenuattr {} }
|
|
eval_plugins browse
|
|
eval_plugins flexview
|
|
|
|
|
|
puts "
|
|
<script type=text/javascript>
|
|
var dir = '[string map {' {\'}} $dir]';
|
|
var mediaroot = '$mroot';
|
|
"
|
|
|
|
# Table column models & default config
|
|
puts {
|
|
|
|
var plugin = {};
|
|
|
|
// Default config
|
|
var fvConfig = {};
|
|
fvConfig.name = 'basic';
|
|
fvConfig.curdirsel = null;
|
|
fvConfig.tablewidth =0;
|
|
fvConfig.tabledepth =0;
|
|
fvConfig.dircolwidth =0;
|
|
fvConfig.flcolwidth =0
|
|
fvConfig.dircolhidden = false;
|
|
fvConfig.dirshrinktofit = false;
|
|
fvConfig.flshrinktofit = false;
|
|
fvConfig.datefmt = "d M y";
|
|
fvConfig.datetimefmt = "d M y H:i";
|
|
fvConfig.timefmt = "H:i:s";
|
|
fvConfig.dirColChg={};
|
|
fvConfig.flColChg={};
|
|
fvConfig.sel={};
|
|
fvConfig.excl={};
|
|
fvConfig.exp={};
|
|
fvConfig.exp['-media']=true;
|
|
fvConfig.exp['-media-My-Video']=true;
|
|
fvConfig.saveInt=15000;
|
|
fvConfig.reloadInt=60;
|
|
}
|
|
|
|
set fname "/mod/etc/fvConfig_$curconfig.json"
|
|
if {[catch {set fd [open $fname r]
|
|
set fvconfig [read $fd ]
|
|
#puts "Object.assign(fvConfig,$fvconfig);"
|
|
puts "\$.extend(fvConfig,$fvconfig);"
|
|
puts "fvConfig.name = '$curconfig';"
|
|
close $fd} msg opts]} {
|
|
puts "console.error('Config file error caught: $msg');"
|
|
}
|
|
|
|
puts {
|
|
// Icons
|
|
var icons = {};
|
|
}
|
|
|
|
set icon [_addicon "/img/compressr.png" "Recursive Auto-shrink"]
|
|
puts "icons.autoshrinkr = '$icon';"
|
|
set icon [_addicon "/img/compress.png" "Auto-shrink"]
|
|
puts "icons.autoshrink = '$icon';"
|
|
set icon [_addicon "/img/dedup.png" "Auto-dedup"]
|
|
puts "icons.autodedup = '$icon';"
|
|
set icon [_addicon "/img/decryptr.png" "Recursive Auto-decrypt"]
|
|
puts "icons.autodecryptr = '$icon';"
|
|
set icon [_addicon "/img/decrypt.png" "Auto-decrypt"]
|
|
puts "icons.autodecrypt = '$icon';"
|
|
set icon [_addicon "/img/mpg.png" "Auto-MPG Extract"]
|
|
puts "icons.autompg = '$icon';"
|
|
set icon [_addicon "/img/mp3.png" "Auto-Audio Extract"]
|
|
puts "icons.automp3 = '$icon';"
|
|
set icon [_addicon "/img/clock.png" "Auto-Expire"]
|
|
puts "icons.autoexpire = '$icon';"
|
|
set icon [_addicon "/img/tvdb-sm.png" "TheTVDB"]
|
|
puts "icons.tvdb = '$icon';"
|
|
set icon [_addicon "/images/175_1_11_Series_Record.png" "Series"]
|
|
puts "icons.series = '$icon';"
|
|
|
|
set icon [_addicon "/images/172_1_00_HD.png" "High Definition"]
|
|
puts "icons.HD = '$icon';"
|
|
set icon [_addicon "/images/172_1_26_SD.png" "Standard Definition"]
|
|
puts "icons.SD = '$icon';"
|
|
set icon [_addicon "/images/178_1_00_Icon_Lock.png" "Locked"]
|
|
puts "icons.Locked = '$icon';"
|
|
set icon [_addicon "/images/749_1_26_Video_Encryption.png" "Protected"]
|
|
puts "icons.ENC = '$icon';"
|
|
set icon [_addicon "/img/Decrypted.png" "Decrypted"]
|
|
puts "icons.DEC = '$icon';"
|
|
set icon [_addicon "/plugin/flexview/img/NotDecrypted.png" "On disk encrypted"]
|
|
puts "icons.ODE = '$icon';"
|
|
#set icon [_addicon "/img/Guidance_purple.png" "Guidance"]
|
|
set icon [_addicon "/img/Guidance_purple.png"]
|
|
puts "icons.guidance = '$icon';"
|
|
#set icon [_addicon "/img/Guidance_blue.png" "General Guidance"]
|
|
set icon [_addicon "/img/Guidance_blue.png"]
|
|
puts "icons.Gguidance = '$icon';"
|
|
set icon [_addicon "/img/compress.png" "Shrunk"]
|
|
puts "icons.Shrunk = '$icon';"
|
|
set icon [_addicon "/img/dedup.png" "De-duped"]
|
|
puts "icons.Deduped = '$icon';"
|
|
set icon [_addicon "/img/dlna.png" "Indexed by DLNA Server"]
|
|
puts "icons.DLNA = '$icon';"
|
|
set icon [_addicon "/images/743_1_10_Video_New.png" "New (unwatched)"]
|
|
puts "icons.new = '$icon';"
|
|
set icon [_addicon "/img/context/thumb.png" "Thumbnail"]
|
|
puts "icons.thumb = '$icon';"
|
|
set icon [_addicon "/img/context/bookmark.png" "Bookmark"]
|
|
puts "icons.bookmark = '$icon';"
|
|
set icon [_addicon "/img/inuse.png" "In Use"]
|
|
puts "icons.inuse = '$icon';"
|
|
set icon [_addicon "/img/radio.png" "Radio Programme"]
|
|
puts "icons.Radio = '$icon';"
|
|
|
|
foreach {icon image} $plugins(icons) {
|
|
# plugin icons
|
|
puts "icons.$icon = '$image';"
|
|
}
|
|
|
|
# opt+ menu attr values to table column mapping
|
|
# browse Opt+ menus use a set of addon keywords in HTML element to pass values to menu
|
|
# Define mapping with table rows to allow element to be built correctly
|
|
# plugins can extend the list
|
|
puts {var dirmenuattr = {
|
|
autoshrink: 'autoshrink',
|
|
autoshrinkR: 'autoshrinkR',
|
|
autodedup: 'autodedup',
|
|
autodecrypt: 'autodecrypt',
|
|
autodecryptR: 'autodecryptR',
|
|
autompg: 'autompg',
|
|
automp3: 'automp3',
|
|
autoexpire: 'autoexpire',
|
|
tvdbseriesid: 'tvdb'};
|
|
}
|
|
foreach {attr column} $plugins(dmenuattr) {
|
|
# plugin attribute
|
|
puts "dirmenuattr.$attr = '$column';"
|
|
}
|
|
|
|
|
|
puts {var optmenuattr = {
|
|
def: 'definition',
|
|
locked: 'Locked',
|
|
encd: 'Encrypted',
|
|
odencd: 'ODEncrypted',
|
|
shrunk: 'Shrunk',
|
|
bx: 'bookmarks',
|
|
type: 'ftype',
|
|
rsize: 'fsize',
|
|
dlna: 'dlna',
|
|
thmok: 'thmok',
|
|
new: 'New'};
|
|
}
|
|
foreach {attr column} $plugins(omenuattr) {
|
|
# plugin attribute
|
|
puts "optmenuattr.$attr = '$column';"
|
|
}
|
|
|
|
|
|
# Genre icon list
|
|
set glist [ts genrelist]
|
|
puts "var genrelist = {"
|
|
foreach {gcode genreval} $glist {
|
|
lassign $genreval txt img
|
|
if {$img eq "Unclassified"} {
|
|
set icon [_addicon "/images/173_3_26_G3_$img.png" $txt "fvICON va genre"]
|
|
} else {
|
|
set icon [_addicon "/images/173_3_00_G3_$img.png" $txt "fvICON va genre"]
|
|
}
|
|
puts "$gcode: '$icon $txt',"
|
|
}
|
|
puts "'':'- All'};"
|
|
|
|
puts {
|
|
|
|
// Table column models
|
|
var dirColModel= [
|
|
}
|
|
set fd [open "DirColModel.json" r] ; # std columns
|
|
set data [read $fd]
|
|
puts $data
|
|
close $fd
|
|
#puts "// $plugins "
|
|
foreach plugin $plugins(dircolumn) {
|
|
# plugin columns
|
|
puts $plugin
|
|
}
|
|
puts {
|
|
];
|
|
var flColModel= [
|
|
}
|
|
set fd [open "FlColModel.json" r] ; # std columns
|
|
set data [read $fd]
|
|
puts $data
|
|
close $fd
|
|
#puts "// $plugins "
|
|
foreach plugin $plugins(flcolumn) {
|
|
# plugin columns
|
|
puts $plugin
|
|
}
|
|
puts {
|
|
];
|
|
|
|
var flData = [];
|
|
var flLoaded = {};
|
|
var flLoadTime = {};
|
|
var dirstart;
|
|
|
|
</script>
|
|
}
|
|
|
|
|
|
source /mod/webif/html/browse/assets.jim
|
|
if {[system has tvdb]} { source /mod/webif/html/browse/tvdb/assets.jim }
|
|
puts "<button style=\"display:none\" id=tvdbsetseries>TVDB</button>"
|
|
|
|
puts "<span style=\"display:none\" id=dir>$dir</span>"
|
|
puts "<span style=\"display:none\" id=mediaroot>$mroot</span>"
|
|
|
|
# Top option buttons
|
|
puts "<div class=brow>"
|
|
puts {
|
|
<button id=reload><img src=/plugin/flexview/img/refresh02.png>Reload grids</button>
|
|
<button id=load>Load</button>
|
|
<button id=save>Save</button>
|
|
<div id="topspin" class=spinner style="float: right"><img border=0 src=/img/loading.gif>
|
|
Loading... Please wait...</div>
|
|
<div id="topmsg" class=blood style="float: right"></div>
|
|
</div>
|
|
|
|
<div id=configload title="Load configuration" style="display: none">
|
|
<select id=configllist class="ui-widget ui-corner-all">
|
|
}
|
|
source /mod/webif/plugin/flexview/configlist.jim
|
|
genConfigList
|
|
|
|
puts {
|
|
</select>
|
|
</div>
|
|
|
|
<div id=configsave title="Save configuration as" style="display: none">
|
|
<datalist id=configslist>
|
|
}
|
|
|
|
genConfigList
|
|
|
|
puts "
|
|
</datalist>
|
|
<input id=configname type=text list=configslist value=\"$curconfig\" size=50 class=\"ui-widget ui-corner-all\">
|
|
</div>
|
|
"
|
|
|
|
# Directory and filelist grids
|
|
puts {
|
|
<div style="clear: both" >
|
|
<table id="fvtable" border="1" class="ui-widget ui-corner-all">
|
|
<col id=dircol> <col id=flcol>
|
|
<thead border="1" class="ui-widget-header">
|
|
<tr>
|
|
<th id="dirhead" class="ui-widget ui-corner-all">Directory tree view
|
|
<div id="dirspin" class=spinner style="float: left"><img border=0 src=/img/loading.gif>
|
|
Loading... Please wait...</div>
|
|
<span style="float: right">
|
|
<button id=dircolumn>Columns</button>
|
|
<button id=hide>Hide Tree</button>
|
|
</span>
|
|
</th>
|
|
<th id="flhead" class="ui-widget ui-corner-all">File list view
|
|
<div id="flspin" class=spinner style="float: left"><img border=0 src=/img/loading.gif>
|
|
Loading... Please wait...</div>
|
|
<span style="float: right">
|
|
<button id=flcolumn>Columns</button>
|
|
<button id=show>Show Tree</button>
|
|
</span>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr id="dirrow">
|
|
<td id="dircell">
|
|
<!-- Add a <table> element where the tree should appear: -->
|
|
<table id="dirlist">
|
|
<tr> <td></td> </tr>
|
|
</table>
|
|
</td>
|
|
<td id="flcell">
|
|
<!-- Add a <table> element where the file list should appear: -->
|
|
<table id="filelist">
|
|
<tr> <td></td> </tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
}
|
|
|
|
# Bottom browse action buttons
|
|
puts "<div class=brow>"
|
|
puts {
|
|
<button id=copy class=onesel>Copy</button>
|
|
<button id=cut class=onesel>Cut</button>
|
|
<button id=delete class=onesel>Delete</button>
|
|
<div id=deletewait class=blood style="display: none">
|
|
<img src=/img/loading.gif>Deleting may take some time, please be patient...
|
|
</div>
|
|
}
|
|
|
|
# Join
|
|
if {$nicesplice} {
|
|
puts { <button id=join class=tstwosel>Join</button> }
|
|
}
|
|
|
|
# Queue
|
|
set queueactions(decrypt) "Decryption"
|
|
set queueactions(shrink) "Shrink"
|
|
set queueactions(mp2) "Audio-Extraction (mp2, fast)"
|
|
set queueactions(mp3) "Audio-Extraction (mp3, slow)"
|
|
set queueactions(mpg) "Conversion to MPG"
|
|
eval_plugins queueactions
|
|
|
|
puts {
|
|
<button id=so_queue class=tsonesel><img src=/img/queueps.png class=qb>
|
|
Queue for</button>
|
|
<select id=so_queueactions
|
|
class="tsonesel text ui-widget-content ui-corner-all">
|
|
}
|
|
set rqueueactions [lreverse $queueactions]
|
|
foreach v [lsort [dict keys $rqueueactions]] {
|
|
set k $rqueueactions($v)
|
|
puts "<option value=$k>$v</option>"
|
|
}
|
|
puts {
|
|
</select>
|
|
}
|
|
|
|
puts {
|
|
<button id=queue><img src=/img/queueps.png class=qb> View Queue</button>
|
|
}
|
|
|
|
# Plugin buttons
|
|
|
|
if {[llength $plugins(buttons)]} {
|
|
puts "</div><div class=buttonrow>"
|
|
foreach plugin $plugins(buttons) {
|
|
lassign $plugin tag options
|
|
puts "
|
|
<button class=plugin act=\"$options(link)\">$options(desc)</button>
|
|
"
|
|
}
|
|
}
|
|
|
|
puts "</div>"
|
|
|
|
|
|
# clipboard
|
|
puts {
|
|
<fieldset class=left style="margin: 0 1em 1em 1em; float: right">
|
|
<legend style="font-size: 1.5em; padding: 0 0.5em 0.5em 0.5em; color: #1e5bbd;">
|
|
File Clipboard
|
|
</legend>
|
|
<div id=clipboard>
|
|
<img src=/img/loading.gif> <i>Loading...</i>
|
|
</div>
|
|
</fieldset>
|
|
}
|
|
footer
|
|
|