add -mth (deafult-hidden columns)
This commit is contained in:
		
							parent
							
								
									0ae574ec2c
								
							
						
					
					
						commit
						3993605324
					
				| @ -451,6 +451,8 @@ note: | ||||
| 
 | ||||
| if you add/remove a tag from `mte` you will need to run with `-e2tsr` once to rebuild the database, otherwise only new files will be affected | ||||
| 
 | ||||
| but instead of using `-mte`, `-mth` is a better way to hide tags in the browser: these tags will not be displayed by default, but they still get indexed and become searchable, and users can choose to unhide them in the settings pane | ||||
| 
 | ||||
| `-mtm` can be used to add or redefine a metadata mapping, say you have media files with `foo` and `bar` tags and you want them to display as `qux` in the browser (preferring `foo` if both are present), then do `-mtm qux=foo,bar` and now you can `-mte artist,title,qux` | ||||
| 
 | ||||
| tags that start with a `.` such as `.bpm` and `.dur`(ation) indicate numeric value | ||||
|  | ||||
| @ -341,7 +341,9 @@ def run_argparse(argv, formatter): | ||||
|     ap2.add_argument("--no-mtag-ff", action="store_true", help="never use FFprobe as tag reader") | ||||
|     ap2.add_argument("-mtm", metavar="M=t,t,t", type=u, action="append", help="add/replace metadata mapping") | ||||
|     ap2.add_argument("-mte", metavar="M,M,M", type=u, help="tags to index/display (comma-sep.)", | ||||
|         default="circle,album,.tn,artist,title,.bpm,key,.dur,.q,.vq,.aq,ac,vc,res,.fps") | ||||
|         default="circle,album,.tn,artist,title,.bpm,key,.dur,.q,.vq,.aq,vc,ac,res,.fps") | ||||
|     ap2.add_argument("-mth", metavar="M,M,M", type=u, help="tags to hide by default (comma-sep.)", | ||||
|         default=".vq,.aq,vc,ac,res,.fps") | ||||
|     ap2.add_argument("-mtp", metavar="M=[f,]bin", type=u, action="append", help="read tag M using bin") | ||||
| 
 | ||||
|     ap2 = ap.add_argument_group('appearance options') | ||||
|  | ||||
| @ -624,9 +624,11 @@ class AuthSrv(object): | ||||
|                 if k1 in vol.flags: | ||||
|                     vol.flags[k2] = True | ||||
| 
 | ||||
|             # default tag-list if unset | ||||
|             # default tag cfgs if unset | ||||
|             if "mte" not in vol.flags: | ||||
|                 vol.flags["mte"] = self.args.mte | ||||
|             if "mth" not in vol.flags: | ||||
|                 vol.flags["mth"] = self.args.mth | ||||
| 
 | ||||
|             # append parsers from argv to volume-flags | ||||
|             self._read_volflag(vol.flags, "mtp", self.args.mtp, True) | ||||
|  | ||||
| @ -1755,7 +1755,7 @@ class HttpCli(object): | ||||
|             "acct": self.uname, | ||||
|             "perms": json.dumps(perms), | ||||
|             "taglist": [], | ||||
|             "tag_order": [], | ||||
|             "def_hcols": [], | ||||
|             "have_up2k_idx": ("e2d" in vn.flags), | ||||
|             "have_tags_idx": ("e2t" in vn.flags), | ||||
|             "have_mv": (not self.args.no_mv), | ||||
| @ -1952,8 +1952,8 @@ class HttpCli(object): | ||||
|         j2a["logues"] = logues | ||||
|         j2a["taglist"] = taglist | ||||
| 
 | ||||
|         if "mte" in vn.flags: | ||||
|             j2a["tag_order"] = json.dumps(vn.flags["mte"].split(",")) | ||||
|         if "mth" in vn.flags: | ||||
|             j2a["def_hcols"] = vn.flags["mth"].split(",") | ||||
| 
 | ||||
|         if self.args.css_browser: | ||||
|             j2a["css"] = self.args.css_browser | ||||
|  | ||||
| @ -125,7 +125,7 @@ | ||||
| 	<script> | ||||
| 		var acct = "{{ acct }}", | ||||
| 			perms = {{ perms }}, | ||||
| 			tag_order_cfg = {{ tag_order }}, | ||||
| 			def_hcols = {{ def_hcols|tojson }}, | ||||
| 			have_up2k_idx = {{ have_up2k_idx|tojson }}, | ||||
| 			have_tags_idx = {{ have_tags_idx|tojson }}, | ||||
| 			have_mv = {{ have_mv|tojson }}, | ||||
|  | ||||
| @ -3040,6 +3040,21 @@ var filecols = (function () { | ||||
| 			"hz": "sample rate" | ||||
| 		}; | ||||
| 
 | ||||
| 	if (JSON.stringify(def_hcols) != sread('hfilecols')) { | ||||
| 		console.log("applying default hidden-cols"); | ||||
| 		jwrite('hfilecols', def_hcols); | ||||
| 		for (var a = 0; a < def_hcols.length; a++) { | ||||
| 			var t = def_hcols[a]; | ||||
| 			t = t.slice(0, 1).toUpperCase() + t.slice(1); | ||||
| 			if (t.startsWith(".")) | ||||
| 				t = t.slice(1); | ||||
| 
 | ||||
| 			if (hidden.indexOf(t) == -1) | ||||
| 				hidden.push(t); | ||||
| 		} | ||||
| 		jwrite("filecols", hidden); | ||||
| 	} | ||||
| 
 | ||||
| 	var add_btns = function () { | ||||
| 		var ths = QSA('#files th>span'); | ||||
| 		for (var a = 0, aa = ths.length; a < aa; a++) { | ||||
|  | ||||
| @ -43,6 +43,7 @@ class Cfg(Namespace): | ||||
|             nih=True, | ||||
|             mtp=[], | ||||
|             mte="a", | ||||
|             mth="", | ||||
|             hist=None, | ||||
|             no_hash=False, | ||||
|             css_browser=None, | ||||
|  | ||||
| @ -21,6 +21,7 @@ class Cfg(Namespace): | ||||
|         ex2 = { | ||||
|             "mtp": [], | ||||
|             "mte": "a", | ||||
|             "mth": "", | ||||
|             "hist": None, | ||||
|             "no_hash": False, | ||||
|             "css_browser": None, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 ed
						ed