diff --git a/README.md b/README.md index d4490194..e25346ae 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ turn almost any device into a file server with resumable uploads/downloads using * [self-destruct](#self-destruct) - uploads can be given a lifetime * [file manager](#file-manager) - cut/paste, rename, and delete files/folders (if you have permission) * [batch rename](#batch-rename) - select some files and press `F2` to bring up the rename UI + * [media player](#media-player) - plays almost every audio format there is + * [audio equalizer](#audio-equalizer) - bass boosted * [markdown viewer](#markdown-viewer) - and there are *two* editors * [other tricks](#other-tricks) * [searching](#searching) - search by size, date, path/name, mp3-tags, ... @@ -118,6 +120,8 @@ enable thumbnails (images/audio/video), media indexing, and audio transcoding by running copyparty without arguments (for example doubleclicking it on Windows) will give everyone read/write access to the current folder; you may want [accounts and volumes](#accounts-and-volumes) +or see [complete windows example](./docs/examples/windows.md) + some recommended options: * `-e2dsa` enables general [file indexing](#file-indexing) * `-e2ts` enables audio metadata indexing (needs either FFprobe or Mutagen) @@ -649,12 +653,61 @@ or a mix of both: the metadata keys you can use in the format field are the ones in the file-browser table header (whatever is collected with `-mte` and `-mtp`) +## media player + +plays almost every audio format there is (if the server has FFmpeg installed for on-demand transcoding) + +the following audio formats are usually always playable, even without FFmpeg: `aac|flac|m4a|mp3|ogg|opus|wav` + +some hilights: +* OS integration; control playback from your phone's lockscreen +* shows the audio waveform in the seekbar +* not perfectly gapless but can get really close (see settings below); good enough to enjoy gapless albums as intended + +click the `play` link next to an audio file, or copy the link target to [share it](https://a.ocv.me/pub/demo/music/Ubiktune%20-%20SOUNDSHOCK%202%20-%20FM%20FUNK%20TERRROR!!/#af-1fbfba61&t=18) (optionally with a timestamp to start playing from, like that example does) + +open the `[🎺]` media-player-settings tab to configure it, +* switches: + * `[preload]` starts loading the next track when it's about to end, reduces the silence between songs + * `[full]` does a full preload by downloading the entire next file; good for unreliable connections, bad for slow connections + * `[~s]` toggles the seekbar waveform display + * `[/np]` enables buttons to copy the now-playing info as an irc message + * `[os-ctl]` makes it possible to control audio playback from the lockscreen of your device (enables [mediasession](https://developer.mozilla.org/en-US/docs/Web/API/MediaSession)) + * `[seek]` allows seeking with lockscreen controls (buggy on some devices) + * `[art]` shows album art on the lockscreen + * `[🎯]` keeps the playing song scrolled into view (good when using the player as a taskbar dock) + * `[⟎]` shrinks the playback controls +* playback mode: + * `[loop]` keeps looping the folder + * `[next]` plays into the next folder +* transcode: + * `[flac]` convers `flac` and `wav` files into opus + * `[aac]` converts `aac` and `m4a` files into opus + * `[oth]` converts all other known formats into opus + * `aac|ac3|aif|aiff|alac|alaw|amr|ape|au|dfpwm|dts|flac|gsm|it|m4a|mo3|mod|mp2|mp3|mpc|mptm|mt2|mulaw|ogg|okt|opus|ra|s3m|tak|tta|ulaw|wav|wma|wv|xm|xpk` +* "tint" reduces the contrast of the playback bar + + +### audio equalizer + +bass boosted + +can also boost the volume in general, or increase/decrease stereo width (like [crossfeed](https://www.foobar2000.org/components/view/foo_dsp_meiercf) just worse) + + ## markdown viewer and there are *two* editors ![copyparty-md-read-fs8](https://user-images.githubusercontent.com/241032/115978057-66419080-a57d-11eb-8539-d2be843991aa.png) +there is a built-in extension for inline clickable thumbnails; +* enable it by adding `` somewhere in the doc +* add thumbnails with `!th[l](your.jpg)` where `l` means left-align (`r` = right-align) +* a single line with `---` clears the float / inlining +* in the case of README.md being displayed below a file listing, thumbnails will open in the gallery viewer + +other notes, * the document preview has a max-width which is the same as an A4 paper when printed diff --git a/bin/hooks/README.md b/bin/hooks/README.md index 637d9c71..ead331ae 100644 --- a/bin/hooks/README.md +++ b/bin/hooks/README.md @@ -10,6 +10,7 @@ run copyparty with `--help-hooks` for usage details / hook type explanations (xb # after upload * [notify.py](notify.py) shows a desktop notification ([example](https://user-images.githubusercontent.com/241032/215335767-9c91ed24-d36e-4b6b-9766-fb95d12d163f.png)) * [notify2.py](notify2.py) uses the json API to show more context +* [image-noexif.py](image-noexif.py) removes image exif by overwriting / directly editing the uploaded file * [discord-announce.py](discord-announce.py) announces new uploads on discord using webhooks ([example](https://user-images.githubusercontent.com/241032/215304439-1c1cb3c8-ec6f-4c17-9f27-81f969b1811a.png)) * [reject-mimetype.py](reject-mimetype.py) rejects uploads unless the mimetype is acceptable diff --git a/copyparty/tcpsrv.py b/copyparty/tcpsrv.py index e139d950..611098cc 100644 --- a/copyparty/tcpsrv.py +++ b/copyparty/tcpsrv.py @@ -322,7 +322,7 @@ class TcpSrv(object): if k not in netdevs: removed = "{} = {}".format(k, v) - t = "network change detected:\n added {}\nremoved {}" + t = "network change detected:\n added {}\033[0;33m\nremoved {}" self.log("tcpsrv", t.format(added, removed), 3) self.netdevs = netdevs self._distribute_netdevs() diff --git a/docs/examples/README.md b/docs/examples/README.md new file mode 100644 index 00000000..5adda0a9 --- /dev/null +++ b/docs/examples/README.md @@ -0,0 +1,4 @@ +copyparty server config examples + +[windows.md](windows.md) -- running copyparty as a service on windows + diff --git a/docs/examples/windows.md b/docs/examples/windows.md new file mode 100644 index 00000000..f009377f --- /dev/null +++ b/docs/examples/windows.md @@ -0,0 +1,115 @@ +# running copyparty on windows + +this is a complete example / quickstart for running copyparty on windows, optionally as a service (autostart on boot) + +you will definitely need either [copyparty.exe](https://github.com/9001/copyparty/releases/latest/download/copyparty.exe) (comfy, portable, more features) or [copyparty-sfx.py](https://github.com/9001/copyparty/releases/latest/download/copyparty-sfx.py) (smaller, safer) + +* if you decided to grab `copyparty-sfx.py` instead of the exe you will also need to install the ["Latest Python 3 Release"](https://www.python.org/downloads/windows/) + +then you probably want to download [FFmpeg](https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip) and put `ffmpeg.exe` and `ffprobe.exe` in your PATH (so for example `C:\Windows\System32\`) -- this enables thumbnails, audio transcoding, and making music metadata searchable + + +## the config file + +open up notepad and save the following as `c:\users\you\documents\party.conf` (for example) + +```yaml +[global] + lo: c:\users\you\logs\cpp-%Y-%m%d.xz # log to file + e2dsa, e2ts, no-dedup, z # this sets 4 different flags + p: 80, 443 # listen on ports 80 and 443 instead of 3923 + theme: 2 # default theme: protonmail-monokai + lang: nor # default language: viking + +[accounts] + kevin: shangalabangala # kevin's password + +[/] # create a volume available at / + c:\pub # sharing this filesystem location + accs: # and set permissions: + r: * # everyone can read/download files, + rwmd: kevin # kevin can read/write/move/delete + +[/inc] # create another volume at /inc + c:\pub\inc # sharing this filesystem location + accs: # permissions: + w: * # everyone can upload, but not browse + rwmd: kevin # kevin is admin here too + +[/music] # and a third volume at /music + ~/music # which shares c:\users\you\music + accs: + r: * + rwmd: kevin +``` + + +### config explained: [global] + +the `[global]` section accepts any config parameters you can see when running copyparty (either the exe or the sfx.py) with `--help`, so this is the same as running copyparty with arguments `--lo c:\users\you\logs\copyparty-%Y-%m%d.xz -e2dsa -e2ts --no-dedup -z -p 80,443 --theme 2 --lang nor` +* `lo: c:\users\you\logs\cpp-%Y-%m%d.xz` writes compressed logs (the compression will make them delayed) + * sorry that `~/logs/` doesn't work currently, good oversight +* `e2dsa` enables the upload deduplicator and file indexer, which enables searching +* `e2ts` enables music metadata indexing, making albums / titles etc. searchable too +* `no-dedup` writes full dupes to disk instead of symlinking, since lots of windows software doesn't handle symlinks well +* `z` enables zeroconf, making the server available at `http://HOSTNAME.local/` from any other machine in the LAN +* `p: 80,443` listens on the ports `80` and `443` instead of the default `3923` +* `lang: nor` sets default language to viking + + +### config explained: [accounts] + +the `[accounts]` section defines all the user accounts, which can then be referenced when granting people access to the different volumes + + +### config explained: volumes + +then we create three volumes, one at `/`, one at `/inc`, and one at `/music` +* `/` and `/music` are readable without requiring people to login (`r: *`) but you need to login as kevin to write/move/delete files (`rwmd: kevin`) +* anyone can upload to `/inc` but you must be logged in as kevin to see the files inside + + +## run copyparty + +to test your config it's best to just run copyparty in a console to watch the output: + +```batch +copyparty.exe -c party.conf +``` + +or if you wanna use `copyparty-sfx.py` instead of the exe (understandable), + +```batch +%localappdata%\programs\python\python311\python.exe copyparty-sfx.py -c party.conf +``` + +(please adjust `python311` to match the python version you installed, i'm not good enough at windows to make that bit generic) + + +## run it as a service + +to run this as a service you need [NSSM](https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip), so put the exe somewhere in your PATH + +then either do this for `copyparty.exe`: +```batch +nssm install cpp %homedrive%%homepath%\downloads\copyparty.exe -c %homedrive%%homepath%\documents\party.conf +``` + +or do this for `copyparty-sfx.py`: +```batch +nssm install cpp %localappdata%\programs\python\python311\python.exe %homedrive%%homepath%\downloads\copyparty-sfx.py -c %homedrive%%homepath%\documents\party.conf +``` + +then after creating the service, modify it so it runs with your own windows account (so file permissions don't get wonky and paths expand as expected): +```batch +nssm set cpp ObjectName .\yourAccoutName yourWindowsPassword +nssm start cpp +``` + +and that's it, all good + +if it doesn't start, enable stderr logging so you can see what went wrong: +```batch +nssm set cpp AppStderr %homedrive%%homepath%\logs\cppsvc.err +nssm set cpp AppStderrCreationDisposition 2 +```