diff --git a/copyparty/__main__.py b/copyparty/__main__.py index c83cd482..161068d5 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1281,6 +1281,7 @@ def add_ui(ap, retry): ap2.add_argument("--lang", metavar="LANG", type=u, default="eng", help="language; one of the following: \033[32meng nor\033[0m") ap2.add_argument("--theme", metavar="NUM", type=int, default=0, help="default theme to use (0..7)") ap2.add_argument("--themes", metavar="NUM", type=int, default=8, help="number of themes installed") + ap2.add_argument("--volume", metavar="NUM", type=int, default=50, help="default audio/video volume; 100=max") ap2.add_argument("--sort", metavar="C,C,C", type=u, default="href", help="default sort order, comma-separated column IDs (see header tooltips), prefix with '-' for descending. Examples: \033[32mhref -href ext sz ts tags/Album tags/.tn\033[0m (volflag=sort)") ap2.add_argument("--unlist", metavar="REGEX", type=u, default="", help="don't show files matching \033[33mREGEX\033[0m in file list. Purely cosmetic! Does not affect API calls, just the browser. Example: [\033[32m\\.(js|css)$\033[0m] (volflag=unlist)") ap2.add_argument("--favico", metavar="TXT", type=u, default="c 000 none" if retry else "🎉 000 none", help="\033[33mfavicon-text\033[0m [ \033[33mforeground\033[0m [ \033[33mbackground\033[0m ] ], set blank to disable") diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 11d31b47..8ef96b69 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -4406,6 +4406,7 @@ class HttpCli(object): "dsort": vf["sort"], "dcrop": vf["crop"], "dth3x": vf["th3x"], + "dvol": self.args.volume, "themes": self.args.themes, "turbolvl": self.args.turbo, "u2j": self.args.u2j, diff --git a/copyparty/web/baguettebox.js b/copyparty/web/baguettebox.js index 3a6e9880..9acb15b6 100644 --- a/copyparty/web/baguettebox.js +++ b/copyparty/web/baguettebox.js @@ -740,6 +740,7 @@ window.baguetteBox = (function () { }); image.setAttribute('src', imageSrc); if (is_vid) { + image.volume = clamp(fcfg_get('vol', dvol / 100), 0, 1); image.setAttribute('controls', 'controls'); image.onended = vidEnd; } diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 30a67dd9..a5ea28ba 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1730,7 +1730,7 @@ function MPlayer() { } } - r.vol = clamp(fcfg_get('vol', IPHONE ? 1 : 0.5), 0, 1); + r.vol = clamp(fcfg_get('vol', IPHONE ? 1 : dvol / 100), 0, 1); r.expvol = function (v) { return 0.5 * v + 0.5 * v * v;