From 85315846332427176c36eb370f1024c56cd1ca11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Thu, 25 Jan 2018 18:39:26 +0700 Subject: [PATCH] Update keybindings documentation --- README.rst | 220 ++++++++++++++++++++++++++++++++++++++------------ comp | 10 ++- doc/comp.1 | 229 ++++++++++++++++++++++++++++++++++++++++------------- setup.py | 2 +- 4 files changed, 349 insertions(+), 112 deletions(-) diff --git a/README.rst b/README.rst index 5646175..d3c4bfa 100644 --- a/README.rst +++ b/README.rst @@ -73,75 +73,191 @@ Open a Youtube playlist with video height lower than 720:: Keyboard control ---------------- +Bindings inherited from mpv +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For convenience purpose, I try to mimic **mpv** default keybindings, but many +are slightly different from **mpv** exact behaviour (mainly because of the lack +of keys which are unsupported by ``curses``). So I will list all of them here +for you to `compare `_: + +Left and Right + Seek backward/forward 5 seconds. Shifted arrow does a 1 second seek. + +Up and Down + Seek backward/forward 1 minute. + +``[`` and ``]`` + Decrease/increase current playback speed by 10%. + +``{`` and ``}`` + Halve/double current playback speed. + +Backspace + Reset playback speed to normal. + +``<`` and ``>`` + Go backward/forward in the playlist. + Return Start playing. -Space, ``p`` - Toggle pause. +Space / ``p`` + Pause (pressing again unpauses). -``/``, ``?`` - Search forward/backward for a pattern. +``.`` + Step forward. Pressing once will pause, every consecutive press will play + one frame and then go into pause mode again. -``<``, ``>`` - Go backward/forward in the playlist. +``,`` + Step backward. Pressing once will pause, every consecutive press will play + one frame in reverse and then go into pause mode again. -``A`` - Toggle mute. +``q`` + Stop playing and quit. -``D`` - Delete the current entry. +``/`` / ``9`` and ``*`` / ``0`` + Decrease/increase volume. -``N`` - Repeat previous search in reverse direction. +``m`` + Mute sound. + +``_`` + Cycle through the available video tracks. + +``#`` + Cycle through the available audio tracks. + +``f`` + Toggle fullscreen. + +``T`` + Toggle stay-on-top. + +``w`` and ``e`` + Decrease/increase pan-and-scan range. + +``o`` / ``P`` + Show progression bar, elapsed time and total duration on the OSD. + +``O`` + Toggle OSD states between normal and playback time/duration. + +``v`` + Toggle subtitle visibility. + +``j`` and ``J`` + Cycle through the available subtitles. + +``x`` and ``z`` + Adjust subtitle delay by +/- 0.1 seconds. + +``l`` + Set/clear A-B loop points. + +``L`` + Toggle infinite looping. + +Ctrl-``+`` and Ctrl-``-`` + Adjust audio delay (A/V sync) by +/- 0.1 seconds. + +``u`` + Switch between applying no style overrides to SSA/ASS subtitles, and + overriding them almost completely with the normal subtitle style. ``V`` - Toggle video. + Toggle subtitle VSFilter aspect compatibility mode. + +``r`` and ``t`` + Move subtitles up/down. + +``s`` + Take a screenshot. + +``S`` + Take a screenshot, without subtitles. + +Alt-``s`` + Take a screenshot each frame. + +Page Up and Page Down + Seek to the beginning of the previous/next chapter. + +``d`` + Activate/deactivate deinterlacer. + +``A`` + Cycle aspect ratio override. + +``1`` and ``2`` + Adjust contrast. + +``3`` and ``4`` + Adjust brightness. + +``5`` and ``6`` + Adjust gamma. + +``7`` and ``8`` + Adjust saturation. + +Alt-``0`` + Resize video window to half its original size. + +Alt-``1`` + Resize video window to its original size. + +Alt-``2`` + Resize video window to double its original size. + +``E`` + Cycle through editions. + +Movements and selections +^^^^^^^^^^^^^^^^^^^^^^^^ + +The following keybindings are Emacs-like since most characters are taken by +**mpv**. + +Ctrl-``p`` and Ctrl-``n`` + Move a single line up/down. + +Alt-``v`` and Ctrl-``v`` + Move a single page up/down. + +Home / Ctrl-``<`` and End / Ctrl-``>`` + Move to the beginning/end of the playlist. + +Ctrl-Space + Deselect/reselect the current entry and move down a line. + +Playlist manipulation +^^^^^^^^^^^^^^^^^^^^^ + +Ctrl-``o`` + Open playlist. + +Ctrl-``i`` + Insert playlist. + +Ctrl-``f`` and Alt-``f`` + Search forward/backward for a pattern. + +Alt-``m`` + Cycle through playing modes. + +Delete + Delete the current entry. ``W`` Save the current playlist under JSON format. -``d`` - Deselect/reselect the current entry. - -``i`` - Insert playlist. - -``m``, ``M`` - Cycle forward/backward through playing modes. - -``n`` - Repeat previous search. - -``o`` - Open playlist. - -Up, ``k`` - Move a single line up. - -Down, ``j`` - Move a single line down. - -Left, ``h`` - Seek backward 5 seconds. - -Right, ``l`` - Seek forward 5 seconds. - -Home - Move to the beginning of the playlist. - -End - Move to the end of the playlist. - -Page Up - Move a single page up. - -Page Down - Move a single page down. - F5 Redraw the screen content. +``:`` + Execute a **mpv** command. + Configuration files ------------------- diff --git a/comp b/comp index 350fc15..dd3a42a 100755 --- a/comp +++ b/comp @@ -517,11 +517,8 @@ with Comp(entries, json_file, mode, vo, ytdlf) as comp: comp.search() elif c == alt('f'): comp.search(backward=True) - elif c == ctrl('m'): - comp.mode = MODES[(MODES.index(comp.mode) + 1) % 8] - comp.update_status() elif c == alt('m'): - comp.mode = MODES[(MODES.index(comp.mode) - 1) % 8] + comp.mode = MODES[(MODES.index(comp.mode) + 1) % 8] comp.update_status() elif c == curses.KEY_DC: comp.entries.pop(comp.idx()) @@ -534,4 +531,9 @@ with Comp(entries, json_file, mode, vo, ytdlf) as comp: comp.dump_json() elif c in (curses.KEY_F5, curses.KEY_RESIZE): comp.resize() + elif c == ':': + try: + comp.mp.command(*comp.read_input(':').split()) + except: + comp.print_msg(_("Failed to execute command"), error=True) c = comp.scr.get_wch() diff --git a/doc/comp.1 b/doc/comp.1 index 7efba5e..8bb42e5 100644 --- a/doc/comp.1 +++ b/doc/comp.1 @@ -1,7 +1,7 @@ .\" Process this file with .\" groff -man -Tutf8 comp.1 .\" -.TH COMP 1 2017-06-17 comp +.TH COMP 1 2018-01-25 comp .SH NAME comp \- Curses Omni Media Player .SH SYNOPSIS @@ -11,8 +11,10 @@ comp \- Curses Omni Media Player .SH DESCRIPTION \fBcomp\fR is a .BR mpv (1) -front-end using curses. It has basic media player functions and can to extract -playlists from multiple sources such as media sites supported by +front-end using +.BR curses (3). +It has basic media player functions and can to extract playlists from multiple +sources such as media sites supported by .BR youtube-dl (1), local and direct URL to video/audio and its own JSON playlist format. .SH OPTIONS @@ -47,75 +49,192 @@ for details and descriptions of available drivers .B -f \fIYTDL_FORMAT\fR, \fB--format \fIYTDL_FORMAT video format/quality to be passed to youtube-dl .SH KEYBOARD CONTROL +.SS Bindings inherited from mpv +For convenience purpose, I try to mimic +.BR mpv (1) +default keybindings, but many are slightly different from +.BR mpv (1) +exact behaviour (mainly because of the lack of keys which are unsupported by +.BR curses (3)). +So I will list all of them here for you to compare: +.TP +.B Left and Right +Seek backward/forward 5 seconds. Shifted arrow does a 1 second seek. +.TP +.B Up and Down +Seek backward/forward 1 minute. +.TP +.B [ and ] +Decrease/increase current playback speed by 10%. +.TP +.B { and } +Halve/double current playback speed. +.TP +.B Backspace +Reset playback speed to normal. +.TP +.B < and > +Go backward/forward in the playlist. .TP .B Return Start playing. .TP -.B Space, p -Toggle pause. +.B Space / p +Pause (pressing again unpauses). .TP -.B /, ? -Search forward/backward for a pattern. +.B . +Step forward. Pressing once will pause, every consecutive press will play +one frame and then go into pause mode again. .TP -.B <, > -Go backward/forward in the playlist. +.B , +Step backward. Pressing once will pause, every consecutive press will play +one frame in reverse and then go into pause mode again. .TP -.B A -Toggle mute. +.B q +Stop playing and quit. .TP -.B D -Delete the current entry. +.B / and * +Decrease/increase volume. .TP -.B N -Repeat previous search in reverse direction. +.B 9 and 0 +Decrease/increase volume. +.TP +.B m +Mute sound. +.TP +.B _ +Cycle through the available video tracks. +.TP +.B # +Cycle through the available audio tracks. +.TP +.B f +Toggle fullscreen. +.TP +.B T +Toggle stay-on-top. +.TP +.B w and e +Decrease/increase pan-and-scan range. +.TP +.B o or P +Show progression bar, elapsed time and total duration on the OSD. +.TP +.B O +Toggle OSD states between normal and playback time/duration. +.TP +.B v +Toggle subtitle visibility. +.TP +.B j and J +Cycle through the available subtitles. +.TP +.B x and z +Adjust subtitle delay by +/- 0.1 seconds. +.TP +.B l +Set/clear A-B loop points. +.TP +.B L +Toggle infinite looping. +.TP +.B Ctrl-+ and Ctrl-- +Adjust audio delay (A/V sync) by +/- 0.1 seconds. +.TP +.B u +Switch between applying no style overrides to SSA/ASS subtitles, and +overriding them almost completely with the normal subtitle style. .TP .B V -Toggle video. +Toggle subtitle VSFilter aspect compatibility mode. +.TP +.B r and t +Move subtitles up/down. +.TP +.B s +Take a screenshot. +.TP +.B S +Take a screenshot, without subtitles. +.TP +.B Alt-s +Take a screenshot each frame. +.TP +.B Page Up and Page Down +Seek to the beginning of the previous/next chapter. +.TP +.B d +Activate/deactivate deinterlacer. +.TP +.B A +Cycle aspect ratio override. +.TP +.B 1 and 2 +Adjust contrast. +.TP +.B 3 and 4 +Adjust brightness. +.TP +.B 5 and 6 +Adjust gamma. +.TP +.B 7 and 8 +Adjust saturation. +.TP +.B Alt-0 +Resize video window to half its original size. +.TP +.B Alt-1 +Resize video window to its original size. +.TP +.B Alt-2 +Resize video window to double its original size. +.TP +.B E +Cycle through editions. +.SS Movements and selections +The following keybindings are Emacs-like since most characters are taken by +.BR mpv (1). +.TP +.B Ctrl-p and Ctrl-n +Move a single line up/down. +.TP +.B Alt-v and Ctrl-v +Move a single page up/down. +.TP +.B Ctrl-< and Ctrl-> +Move to the beginning/end of the playlist. +.TP +.B Home and End +Move to the beginning/end of the playlist. +.TP +.B Ctrl-Space +Deselect/reselect the current entry and move down a line. +.SS Playlist manipulation +.TP +.B Ctrl-o +Open playlist. +.TP +.B Ctrl-i +Insert playlist. +.TP +.B Ctrl-f and Alt-f +Search forward/backward for a pattern. +.TP +.B Alt-m +Cycle through playing modes. +.TP +.B Delete +Delete the current entry. .TP .B W Save the current playlist under JSON format. .TP -.B d -Deselect/reselect the current entry. -.TP -.B i -Insert playlist. -.TP -.B m, M -Cycle forward/backward through playing modes. -.TP -.B n -Repeat previous search. -.TP -.B o -Open playlist. -.TP -.B Up, k -Move a single line up. -.TP -.B Down, j -Move a single line down. -.TP -.B Left, h -Seek backward 5 seconds. -.TP -.B Right, l -Seek forward 5 seconds. -.TP -.B Home -Move to the beginning of the playlist. -.TP -.B End -Move to the end of the playlist. -.TP -.B Page Up -Move a single page up. -.TP -.B Page Down -Move a single page down. -.TP .B F5 Redraw the screen content. +.TP +.B : +Execute a mpv command. .SH FILES .TP .I ~/.config/comp/settings.ini diff --git a/setup.py b/setup.py index 8c0fdbf..80e1cbb 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open('README.rst') as f: setup( name='comp', - version='0.4.1', + version='0.4.2', description=('Curses Omni Media Player'), long_description=long_description, url='https://github.com/McSinyx/comp',