Update documentation and setup

This commit is contained in:
Nguyễn Gia Phong 2017-04-04 11:37:29 +07:00 committed by Nguyễn Gia Phong
parent 5abe0b2ebc
commit 23fc9ae49b
6 changed files with 121 additions and 20 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
MANIFEST
build
dist
__pycache__

View File

@ -1,2 +1,2 @@
# Include the license file
include LICENSE
include LICENSE README.rst

View File

@ -1,5 +1,96 @@
====
comp
====
=================================
comp - Curses Online Media Player
=================================
Curses Online Media Player
This program is a curses front-end for mpv and youtube-dl.
Installation
------------
Dependencies
^^^^^^^^^^^^
This program currently only runs on Python 3.5+ on operating systems that the
``curses`` module is supported (i.e. Unix-like OS, e.g. GNU/Linux, macOS and
the BSDs).
It also depends on ``youtube-dl`` and ``libmpv``. Both of those should be
available in your operating system's repository.
Installing comp
^^^^^^^^^^^^^^^
I will try to upload the program to PyPI when it's more completed but as of
this moment, I'd suggest you to use ``git`` to get the software::
git clone https://github.com/McSinyx/comp.git
cd comp
./setup.py install --user
Usage
-----
Command line arguments::
$ comp -h
usage: comp [-h] [-j JSON_PLAYLIST]
console/curses online media mp
optional arguments:
-h, --help show this help message and exit
-j JSON_PLAYLIST, --json-playlist JSON_PLAYLIST
path to playlist in JSON format
Keyboard control
^^^^^^^^^^^^^^^^
+--------------+-------------------------------+
| Key | Action |
+==============+===============================+
| ``h``, Up | Move a single line up |
+--------------+-------------------------------+
| ``j``, Down | Move a single line down |
+--------------+-------------------------------+
| Page Up | Move a single page up |
+--------------+-------------------------------+
| Page Down | Move a single page down |
+--------------+-------------------------------+
| Home | Move to the begin of the list |
+--------------+-------------------------------+
| End | Move to the end of the list |
+--------------+-------------------------------+
| ``c`` | Select the current track |
+--------------+-------------------------------+
| ``p`` | Start playing |
+--------------+-------------------------------+
| Space | Toggle pause |
+--------------+-------------------------------+
| ``m``, ``M`` | Cycle through playing modes |
+--------------+-------------------------------+
| ``A`` | Toggle mute |
+--------------+-------------------------------+
| ``V`` | Toggle video |
+--------------+-------------------------------+
Configurations
--------------
``comp`` uses INI format for its config file, placed in
``~/.config/comp/settings.ini``::
[comp]
# Supported 8 modes: play-current, play-all, play-selected, repeat-current,
# repeat-all, repeat-selected, shuffle-all and shuffle-selected
play-mode = shuffle-selected
[mpv]
# Set if video should be download and play, I only know 2 possible values:
# auto and no. This can be changed later interactively.
video = no
# Read more on VIDEO OUTPUT DRIVERS section in mpv man page
video-output = xv
[youtube-dl]
# Read more on youtube-dl man page
format = best

View File

@ -226,10 +226,10 @@ while c != 113: # letter q
start += y - 1
y = 1
reprint(stdscr, data[start : start+curses.LINES-3])
elif c in (106, curses.KEY_DOWN): # letter j or down arrow
y = move(stdscr, data, y, 1)
elif c in (107, curses.KEY_UP): # letter k or up arrow
y = move(stdscr, data, y, -1)
elif c in (106, curses.KEY_DOWN): # letter j or down arrow
y = move(stdscr, data, y, 1)
elif c == curses.KEY_PPAGE: # page up
y = move(stdscr, data, y, 4 - curses.LINES)
elif c == curses.KEY_NPAGE: # page down
@ -238,12 +238,9 @@ while c != 113: # letter q
y = move(stdscr, data, y, -len(data))
elif c == curses.KEY_END: # end
y = move(stdscr, data, y, len(data))
elif c == 109: # letter m
mode = MODES[(MODES.index(mode) + 1) % 8]
update_status_line(stdscr, mp)
elif c == 77: # letter M
mode = MODES[(MODES.index(mode) - 1) % 8]
update_status_line(stdscr, mp)
elif c == 99: # letter c
data[start + y - 1]['selected'] = not data[start + y - 1]['selected']
y = move(stdscr, data, y, 1)
elif c == 112: # letter p
mp._set_property('pause', False, bool)
play_thread = Thread(target=play)
@ -251,12 +248,15 @@ while c != 113: # letter q
play_thread.start()
elif c == 32: # space
mp._set_property('pause', not mp._get_property('pause', bool), bool)
elif c == 99: # letter c
data[start + y - 1]['selected'] = not data[start + y - 1]['selected']
y = move(stdscr, data, y, 1)
elif c == 97: # letter a
elif c == 109: # letter m
mode = MODES[(MODES.index(mode) + 1) % 8]
update_status_line(stdscr, mp)
elif c == 77: # letter M
mode = MODES[(MODES.index(mode) - 1) % 8]
update_status_line(stdscr, mp)
elif c == 65: # letter A
mp._set_property('mute', not mp._get_property('mute', bool), bool)
elif c == 118: # letter v
elif c == 86: # letter V
mp._set_property('vid', 'auto' if mp._get_property('vid') == 'no' else 'no')
c = stdscr.getch()

View File

@ -1,9 +1,15 @@
[comp]
# Supported 8 modes: play-current, play-all, play-selected, repeat-current,
# repeat-all, repeat-selected, shuffle-all and shuffle-selected
play-mode = shuffle-selected
[mpv]
# Set if video should be download and play, I only know 2 possible values:
# auto and no. This can be changed later interactively.
video = no
# Read more on VIDEO OUTPUT DRIVERS section in mpv man page
video-output = xv
[youtube-dl]
# Read more on youtube-dl man page
format = best

View File

@ -1,16 +1,18 @@
#!/usr/bin/env python3
from distutils.core import setup
from os.path import expanduser
with open('README.rst') as f:
long_description = f.read()
setup(name = 'comp', version = '0.1.0a3',
setup(name = 'comp', version = '0.1.1a1',
url = 'https://github.com/McSinyx/comp',
description = ('Curses Online Media Player'),
long_description=long_description,
author = 'McSinyx', author_email = 'vn.mcsinyx@gmail.com',
py_modules = ['mpv'], scripts=['comp.py'],
py_modules = ['mpv'], scripts=['comp'],
data_files=[(expanduser('~/.config/comp'), ['settings.ini'])],
classifiers = [
'Development Status :: 3 - Alpha',
'Environment :: Console :: Curses',