Skip to main content

Provides bookmarks functionalities to mopidy.

Project description

Latest PyPI version CircleCI build status Test coverage

Provides bookmarks functionalities to mopidy.

Bookmarks are playlist that can be synced with the current playback state, so that you can easily stop listening to some tracklist, listen to something else, and later resume at the position where you stopped. This is most usefull when listening to audiobooks.

This extension can only be used with a compatible mopidy client. For now, only mopidy-mowecl is compatible.

Usage

Bookmarks are playlists saved in a sqlite database. When synchronising between a bookmark and playback state, the current track and current time will be saved periodically (every 0.5 second by default). As soon as the tracklist changes, or the stop_sync command is received, synchronisation will stop. A bookmark can then be resumed with the resume command, replacing the tracklist with the bookmark tracks, and resuming playback from the saved state.

To create a bookmark, use the Mopidy API, providing bookmark: as a uri_scheme. All the functions from the Playlist controller API are available.

Access to the bookmarks API is provided by a websocket server, which works in exactly the same way as the mopidy websocket server. It can thus be used with the Mopidy-js client by connecting to the address mopidy-host:port/bookmarks/ws.

The bookmarks API provides the following commands:

  • start_sync : Start synchronising a given bookmark with the current tracklist.

  • resume : Resumes playback from the given bookmark, and start syncing.

  • stop_sync : Stop synchronisation between the current bookmark and playback status.

  • get_current_bookmark : Get the current synchronising bookmark, if any.

See the API section for the API specification.

Moreover, the following event will be broadcasted to the connected websocket clients:

  • sync_status_update: When sync status changes.

    The event payload is an object of the form {bookmark: data}, where data is the name of the bookmark being synchronised, or null if synchronisation has stopped.

API

start_sync(uri): Starts syncing the given bookmark with the playback state.

The tracklist must correspond to the tracks of the bookmark.

Parameters

uristr

The uri of the bookmark to resume

Returns

bool

True if syncing started, else False

resume(uri): Resumes playback from a bookmark.

Populates the tracklist with the tracks of the bookmark, resumes playback from the saved position and sync the bookmark with the current playback state (track and time).

Parameters

uristr

The uri of the bookmark to resume

Returns

bool

True if a bookmark was found for the given uri, else False

get_current_bookmark(): Get the current synced bookmark if any.

Returns

mopidy.models.Ref or None

A ref to the current bookmark if any, else None

stop_sync(): Stop syncing the current bookmark.

Installation

Install by running:

python3 -m pip install Mopidy-Bookmarks

Note that this extension is a dependency of mopidy-mowecl, so it will already be installed if you are using this client.

Configuration

Mopidy-Bookmarks provides the following configuration keys (and their default values).

[bookmarks]
enabled = true

# sync period, in milliseconds
sync_period = 500

# set this to false to enable limits defined below
# (usefull if mopidy listens on a public network e.g.
disable_limits = true
# max number of bookmarks
max_bookmarks = 100
# max size of data for one bookmark
max_bookmark_length = 100000

# max number of items in store
max_store_items = 10
# max store item length
max_store_item_length = 1000

Project resources

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Mopidy-Bookmarks-0.1.4.tar.gz (17.8 kB view details)

Uploaded Source

File details

Details for the file Mopidy-Bookmarks-0.1.4.tar.gz.

File metadata

  • Download URL: Mopidy-Bookmarks-0.1.4.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for Mopidy-Bookmarks-0.1.4.tar.gz
Algorithm Hash digest
SHA256 854985b95400f25bd0435e1a0c00597093a20a5f5bbcc7cef46f062555e61b37
MD5 6ee9c32ed2acba3190a22d30228de30b
BLAKE2b-256 29e2ef0c8c180146aad290abd24d379a3d247df002ed8918bfdb0e8936f95400

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page