Vue>> m>> 返回
项目作者: obfusk

项目描述 :
m - minimalistic media manager
高级语言: Python
项目地址: git://github.com/obfusk/m.git
创建时间: 2017-12-07T21:05:39Z
项目社区:https://github.com/obfusk/m

开源协议:GNU General Public License v3.0

下载


  1. File : README.md
  2. Maintainer : Felix C. Stegerman <flx@obfusk.net>
  3. Date : 2018-09-16
  4. Copyright : Copyright (C) 2018 Felix C. Stegerman
  5. Version : v0.4.2
  6. License : GPLv3+

PyPI Version
Build Status
GPLv3+

Description

m - minimalistic media manager

m keeps track of which files you’ve played (or are still playing) and
thus allows you to easily continue playing the next file (using vlc or
mpv).

  • Supports importing existing playing/watched data from Kodi.
  • Stores its data in JSON files (one per directory) in ~/.obfusk-m;
    you can put this directory in git if you want a changelog :)

NB: extracting the timestamp from the vlc config and mpv output is a
little hacky :(

NB: m uses $PWD to make sure it sees the current path the same as
the shell it is run from (i.e. it does not resolve the path by
following symlinks, allowing the link targets to be relocated);
unfortunately, this means that it does not see two directories as
identical if they are accessed using different paths, even if the
resolved path is the same. So you may want to avoid using different
paths to the same directory (and --dir).

Examples

  1. $ cd /some/media/dir
  2. $ m ls # list files ([*] = skip, [x] = done, [>] = playing, [ ] = new)
  3. [x] Something - 01.mkv
  4. [x] Something - 02.mkv
  5. [x] Something - 03.mkv
  6. [x] Something - 04.mkv
  7. [x] Something - 05.mkv
  8. [x] Something - 06.mkv
  9. [>] Something - 07.mkv 0:04:04
  10. [ ] Something - 08.mkv
  11. [ ] Something - 09.mkv
  12. $ m next # plays current/next episode (i.e. #7) w/ vlc
  1. $ m ld # list dirs (shows #playing, #new for indexed subdirectories)
  2. ( 2!) Dir A
  3. ( ) Dir B
  4. (1> 0!) Dir C
  5. ( 0!) Dir D

Commands include: list/ls, list-dirs/ld, list-all/la,
next, play FILE, mark FILE, unmark FILE, skip FILE, index,
playing, watched, skipped, todo.

See also the tests in the source code (also available as m examples)
for more examples.

Command-line

m is designed to work well with other command-line tools:

  1. $ m --colour ld | column
  2. $ m --colour ls | tail
  3. $ cat "$( m db-file )" | jq .dir

GUI

In situations where you prefer simple keybindings to typing on the
command-line, you can use the m-gui
wrapper.

Help

  1. $ m --help # global options & subcommands
  2. $ m ls --help # subcommand (ls in this case) options & argument(s)
  3. $ m examples # show some examples (from the tests)

Requirements

Python >= 3.5.

Installing

You can just put m.py somewhere on your $PATH (in e.g. ~/bin; I
suggest calling it m, but you’re free to choose another name).

You may want to clone the repository instead of just downloading
m.py to be able to get new versions easily.

Alternatively, you can install m using pip (the Python package
manager) or build and install a Debian package.

NB: the pip and Debian packages are called mmm instead of m.

Using git

  1. $ cd /some/convenient/dir
  2. $ git clone https://github.com/obfusk/m.git obfusk-m
  3. $ cd ~/bin # or some other dir on your $PATH
  4. $ ln -s /some/convenient/dir/obfusk-m/m.py m

Updating:

  1. $ cd /some/convenient/dir/obfusk-m
  2. $ git pull

Using pip

  1. $ pip3 install --user mmm # for Debian; on other OS's you may need
  2. # pip instead of pip3 and/or no --user

Building a Debian package

  1. $ sudo apt install debhelper dh-python pandoc # install build dependencies
  2. $ cd /some/convenient/dir
  3. $ git clone https://github.com/obfusk/m.git obfusk-m
  4. $ cd obfusk-m
  5. $ dpkg-buildpackage
  6. $ sudo dpkg -i ../mmm_*_all.deb

Configuration File

You can set/override some defaults in ~/.obfusk-m/config.json; for
example:

  1. {
  2. "add_exts": [".mp3", ".ogg"],
  3. "colour": true,
  4. "exts": [".avi", ".m4v", ".mkv", ".mp4", ".ogv", ".webm"],
  5. "ignorecase": true,
  6. "numbers": true,
  7. "numeric_sort": true,
  8. "only_indexed": true,
  9. "player": "mpv",
  10. "show_hidden": true
  11. }

TODO

  • update README + version (4x + dch) + package (deb + pip)!
  • ack TODO
  • debian Tag:?
  • use markdown for README now that pypi supports it
    • as soon as I have wheel >= 0.31.0 in Debian
    • no need to build README.rst
    • setup.py: with_name("README.md"),
      long_description_content_type = "text/markdown"
  • more file extensions!
  • document safe() vs --zero
  • _pty_run: also minimize output if not a tty?
  • fix m _test when run via wrapper (m.MError vs MError)?

Maybe

  • m --virtual foo/bar {ls,...} + m virt [--update] [--title]* [--url]* [--url-template] [--episodes] [--browser] +
    VIRTUAL:/foo/bar + virt__*.json + m {watching,...} --include-virtual?
  • test edge cases/failures?
  • --config-dir?
  • test END_SECS?
  • note usage of dyn vars?
  • bash completion?
  • m mv?
  • --tree for playing etc.?
  • --json?
  • kodi db export/sync?
  • sign pypi package?
  • fix .exist() race conditions?
  • use locale.strcoll vs --ignorecase?

CAVEATS

Because the alias command uses symlinks internally, you should
probably not create symlinks named dir__*.json in ~/.obfusk-m
unless you know what you are doing.

License

GPLv3+