mpbroker


Namempbroker JSON
Version 0.20.0 PyPI version JSON
download
home_pagehttps://gitlab.com/drad/mpbroker
SummaryMedia Player Broker
upload_time2024-04-05 10:50:03
maintainerdrad
docs_urlNone
authordrad
requires_python<4.0,>=3.8
licenseGPL-3.0-only
keywords media player broker player video smplayer vlc couchdb cli mpv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # README

Media Player Broker (mpb) is an application that helps you play and track media you have watched over disparet locations. mpb keeps track of what you have played at Location A so when you are at Location B you can see what you have watched from either location to avoid digging through history command output over SSH.

mpb is not a player itself but it can be configured to launch your player of choice to view media.


## Latest Changes

- upgraded packages: pydantic, rich, typer
- changed --version to use importlib.metadata
- turned off pretty_exceptions (typer/rich)
- fixed error in 'info' if Library Sources key is empty

### NOTICE

- __Next Release Will Require Python 3.11 or Newer__ as we would like to move away from tomllib to address the following:
  + this app uses tomli for toml parsing, python 3.11 has tomllib included which we will move to at some point in the near future. We realize this could be a large burden on users so we have delayed this task until python 3.11 is more widely used.
- BREAKING: version 0.14.0 corrected the spelling error (injest ─⏵ ingest) which requires a change to your `user_config.toml` file (change `[injest]` to `[ingest]`)


### The Need

Rather than living in the cloud I have my videos duplicated at various locations. I needed something that remembers what episode of MacGyver I had watched in one location so when I was in another location I could continue watching the next episode without digging through `history` output or keeping track of what was played where.

mpb consists of a CLI application (the client) and a database (couchdb). From the client you `ingest` your media metadata. This extracts the file names from file paths and stores the data in the database. After ingesting, you can `list` your media which shows you the media Item, whether it has been watched or not along with a Rating, Notes, and the Sources the item is available at. You can then use the `play` command along with the Item to watch the Item. After playback is completed you are prompted to mark the item as played/watched, Rate it and add Notes - all of which are used in the `list` command to show what you have already watched and what is new.

mpb can also be used by multiple 'users' - you can share a 'user' so your wife can see what you have watched or you can keep separate users so your wife sees what she has watched and you know what you have watched.


### Install

We recommend using [pipx](https://github.com/pypa/pipx) to install mpbroker: `pipx install mpbroker`. You can also install via pip: `pip install --user mpbroker`.

mpbroker uses a config file to store your setup. This file contains information such as your media player, the database url, and types of data to ingest. You can grab the sample config file from  [mpbroker/example/user_config.toml](https://gitlab.com/drad/mpbroker/-/blob/master/mpbroker/example/user_config.toml) and place it in a config location. mpbroker searches the following locations for the config file (in order of precedence):

- $MPB_CONFIG_HOME: set this environment variable to any path you like and place the mpbroker `user_config.toml` file in this location
- $XDG_CONFIG_HOME/mpbroker
- $APPDATA/mpbroker
- $HOME/.config/mpbroker


### Configure

#### Notices

- an example `user_config.toml` file can be found in the [project example directory](https://gitlab.com/drad/mpbroker/-/tree/master/mpbroker/example)
- if you do not want to use the standard locations and do not want to set a `MPB_CONFIG_HOME` envvar you can set `MPB_CONFIG_HOME` on the command line before calling mpb such as `MPB_CONFIG_HOME=/opt/tmp mpb list 'The_Matrix'`

To set up MPB you need to:
- create your `user_config.toml` file (see above for locations of this file)
- configure your user_config.toml file (at a minimum you will need to set/change the `database.db_uri` value)
- ensure your mpb database is available
  + use the `db-init` command to initialize your db if it is a new instance!

If you are testing mpb or do not have a database you can use docker-compose to start a local database with `docker-compose up` from the [project's docker-compose.yml file](https://gitlab.com/drad/mpbroker). If you use the local database your `database.db_uri` would be: `http://localhost:5984` (add your username and password if needed).


### Using MPB

mpb has built in help (`mpb --help`) which should give you enough info to get going.

A Quick Start:

- you will likely want to `ingest` some media
- next you can use `list` to view/find an item to play
- finally you can `play` an item

#### Paging Output

mpb has pager support, to enable it set the 'use_pager' config option in the user_config.toml file. By default this is not enabled as most pagers drop color support. If you would like pager support and want color to remain in the output you can set the following in your `~/.bashrc` (or equivalent) file:

```
export LESS='--quit-if-one-screen --ignore-case --status-column --LONG-PROMPT --RAW-CONTROL-CHARS --HILITE-UNREAD --tabs=4 --no-init --window=-4'
```

Tip: using a pager allows showing one 'page' (screen) of results at a time; however, most pagers (less) also allow searching within the results easily and quickly. We recommend setting the `--RAW-CONTROL-CHARS` and using `less` with mpbroker.


### Ingestion

Ingestion is the process of loading media metadata into your mpbroker database.

#### Extract Metadata

Extracting metadata on ingestion increases the ingestion time but adds the following data to each ingested media item:

    file_size: # filesize in human readable format (569 MiB, 1.1 GiB)
    file_type: # file type (video/H265)
    file_format: # file format (Matroska)
    encoding: # encoding (x265)
    duration: # duration in human readable format (1 h 52 min, 2 h 48 min)
    resolution: # resulution in width x height format (720 x 480)
    aspect_ratio: # display aspect ratio (16:9)
    audio_format:  audio format (AAC)
    audio_sampling: audio sample rate (48000)

To extract metadata you will need to install [MediaInfo](https://mediaarea.net/en/MediaInfo) which should be available in the repo of most distributions:

- arch: `mediainfo`
- debian: `mediainfo`

#### Ingestion Time Details

- ~500 videos
    + with metadata extraction: 6.05s
    + without metadata extraction: 99.05s
- 2785 videos
    + with metadata extraction: 596.53s
    + without metadata extraction: 72.75s

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/drad/mpbroker",
    "name": "mpbroker",
    "maintainer": "drad",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "sa@adercon.com",
    "keywords": "media player, broker, player, video, smplayer, vlc, couchdb, cli, mpv",
    "author": "drad",
    "author_email": "sa@adercon.com",
    "download_url": "https://files.pythonhosted.org/packages/5f/82/67105c63e7f8e4e98509328833a18665b99c1ae46d24e299aea4878d9db9/mpbroker-0.20.0.tar.gz",
    "platform": null,
    "description": "# README\n\nMedia Player Broker (mpb) is an application that helps you play and track media you have watched over disparet locations. mpb keeps track of what you have played at Location A so when you are at Location B you can see what you have watched from either location to avoid digging through history command output over SSH.\n\nmpb is not a player itself but it can be configured to launch your player of choice to view media.\n\n\n## Latest Changes\n\n- upgraded packages: pydantic, rich, typer\n- changed --version to use importlib.metadata\n- turned off pretty_exceptions (typer/rich)\n- fixed error in 'info' if Library Sources key is empty\n\n### NOTICE\n\n- __Next Release Will Require Python 3.11 or Newer__ as we would like to move away from tomllib to address the following:\n  + this app uses tomli for toml parsing, python 3.11 has tomllib included which we will move to at some point in the near future. We realize this could be a large burden on users so we have delayed this task until python 3.11 is more widely used.\n- BREAKING: version 0.14.0 corrected the spelling error (injest \u2500\u23f5 ingest) which requires a change to your `user_config.toml` file (change `[injest]` to `[ingest]`)\n\n\n### The Need\n\nRather than living in the cloud I have my videos duplicated at various locations. I needed something that remembers what episode of MacGyver I had watched in one location so when I was in another location I could continue watching the next episode without digging through `history` output or keeping track of what was played where.\n\nmpb consists of a CLI application (the client) and a database (couchdb). From the client you `ingest` your media metadata. This extracts the file names from file paths and stores the data in the database. After ingesting, you can `list` your media which shows you the media Item, whether it has been watched or not along with a Rating, Notes, and the Sources the item is available at. You can then use the `play` command along with the Item to watch the Item. After playback is completed you are prompted to mark the item as played/watched, Rate it and add Notes - all of which are used in the `list` command to show what you have already watched and what is new.\n\nmpb can also be used by multiple 'users' - you can share a 'user' so your wife can see what you have watched or you can keep separate users so your wife sees what she has watched and you know what you have watched.\n\n\n### Install\n\nWe recommend using [pipx](https://github.com/pypa/pipx) to install mpbroker: `pipx install mpbroker`. You can also install via pip: `pip install --user mpbroker`.\n\nmpbroker uses a config file to store your setup. This file contains information such as your media player, the database url, and types of data to ingest. You can grab the sample config file from  [mpbroker/example/user_config.toml](https://gitlab.com/drad/mpbroker/-/blob/master/mpbroker/example/user_config.toml) and place it in a config location. mpbroker searches the following locations for the config file (in order of precedence):\n\n- $MPB_CONFIG_HOME: set this environment variable to any path you like and place the mpbroker `user_config.toml` file in this location\n- $XDG_CONFIG_HOME/mpbroker\n- $APPDATA/mpbroker\n- $HOME/.config/mpbroker\n\n\n### Configure\n\n#### Notices\n\n- an example `user_config.toml` file can be found in the [project example directory](https://gitlab.com/drad/mpbroker/-/tree/master/mpbroker/example)\n- if you do not want to use the standard locations and do not want to set a `MPB_CONFIG_HOME` envvar you can set `MPB_CONFIG_HOME` on the command line before calling mpb such as `MPB_CONFIG_HOME=/opt/tmp mpb list 'The_Matrix'`\n\nTo set up MPB you need to:\n- create your `user_config.toml` file (see above for locations of this file)\n- configure your user_config.toml file (at a minimum you will need to set/change the `database.db_uri` value)\n- ensure your mpb database is available\n  + use the `db-init` command to initialize your db if it is a new instance!\n\nIf you are testing mpb or do not have a database you can use docker-compose to start a local database with `docker-compose up` from the [project's docker-compose.yml file](https://gitlab.com/drad/mpbroker). If you use the local database your `database.db_uri` would be: `http://localhost:5984` (add your username and password if needed).\n\n\n### Using MPB\n\nmpb has built in help (`mpb --help`) which should give you enough info to get going.\n\nA Quick Start:\n\n- you will likely want to `ingest` some media\n- next you can use `list` to view/find an item to play\n- finally you can `play` an item\n\n#### Paging Output\n\nmpb has pager support, to enable it set the 'use_pager' config option in the user_config.toml file. By default this is not enabled as most pagers drop color support. If you would like pager support and want color to remain in the output you can set the following in your `~/.bashrc` (or equivalent) file:\n\n```\nexport LESS='--quit-if-one-screen --ignore-case --status-column --LONG-PROMPT --RAW-CONTROL-CHARS --HILITE-UNREAD --tabs=4 --no-init --window=-4'\n```\n\nTip: using a pager allows showing one 'page' (screen) of results at a time; however, most pagers (less) also allow searching within the results easily and quickly. We recommend setting the `--RAW-CONTROL-CHARS` and using `less` with mpbroker.\n\n\n### Ingestion\n\nIngestion is the process of loading media metadata into your mpbroker database.\n\n#### Extract Metadata\n\nExtracting metadata on ingestion increases the ingestion time but adds the following data to each ingested media item:\n\n    file_size: # filesize in human readable format (569 MiB, 1.1 GiB)\n    file_type: # file type (video/H265)\n    file_format: # file format (Matroska)\n    encoding: # encoding (x265)\n    duration: # duration in human readable format (1 h 52 min, 2 h 48 min)\n    resolution: # resulution in width x height format (720 x 480)\n    aspect_ratio: # display aspect ratio (16:9)\n    audio_format:  audio format (AAC)\n    audio_sampling: audio sample rate (48000)\n\nTo extract metadata you will need to install [MediaInfo](https://mediaarea.net/en/MediaInfo) which should be available in the repo of most distributions:\n\n- arch: `mediainfo`\n- debian: `mediainfo`\n\n#### Ingestion Time Details\n\n- ~500 videos\n    + with metadata extraction: 6.05s\n    + without metadata extraction: 99.05s\n- 2785 videos\n    + with metadata extraction: 596.53s\n    + without metadata extraction: 72.75s\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "Media Player Broker",
    "version": "0.20.0",
    "project_urls": {
        "Homepage": "https://gitlab.com/drad/mpbroker",
        "Repository": "https://gitlab.com/drad/mpbroker"
    },
    "split_keywords": [
        "media player",
        " broker",
        " player",
        " video",
        " smplayer",
        " vlc",
        " couchdb",
        " cli",
        " mpv"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8315d3c5ecc5ff4ffb2bec70a7b4e535d564f15f6839f3f2c98a20f32f0a1935",
                "md5": "e4cf9b1c298a1baa54fe29b4a1c2caed",
                "sha256": "20cb292e69f4154029b6f2c44aa53dc416b7591a49ad6ec456e3a28cc355ff08"
            },
            "downloads": -1,
            "filename": "mpbroker-0.20.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4cf9b1c298a1baa54fe29b4a1c2caed",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 33504,
            "upload_time": "2024-04-05T10:50:02",
            "upload_time_iso_8601": "2024-04-05T10:50:02.526547Z",
            "url": "https://files.pythonhosted.org/packages/83/15/d3c5ecc5ff4ffb2bec70a7b4e535d564f15f6839f3f2c98a20f32f0a1935/mpbroker-0.20.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f8267105c63e7f8e4e98509328833a18665b99c1ae46d24e299aea4878d9db9",
                "md5": "e2e1d65f8979e75091417681dd76a745",
                "sha256": "b774cd39a56523f95438a415c80942a58d541dfb8c45999f0a80cf96320d00dc"
            },
            "downloads": -1,
            "filename": "mpbroker-0.20.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e2e1d65f8979e75091417681dd76a745",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 31523,
            "upload_time": "2024-04-05T10:50:03",
            "upload_time_iso_8601": "2024-04-05T10:50:03.988354Z",
            "url": "https://files.pythonhosted.org/packages/5f/82/67105c63e7f8e4e98509328833a18665b99c1ae46d24e299aea4878d9db9/mpbroker-0.20.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-05 10:50:03",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "drad",
    "gitlab_project": "mpbroker",
    "lcname": "mpbroker"
}
        
Elapsed time: 0.22320s