Skip to content

Bookmark

Joshua Haas edited this page Jan 30, 2017 · 6 revisions

Sibyl can remember your position in playlists created via the audios or videos commands from the xbmc.py plug-in. This is incredibly useful when watching a TV series or a podcast. This plug-in requires the xbmc and library plug-ins.

Config

  • bookmark.file - file in which to store bookmarks (default 'data/bookmarks.txt')
  • bookmark.resume_next - always skip to the next episode when resuming (default False)

Commands

  • bookmark: manage bookmarks - bookmarks [show|set|remove] [name]
  • resume: resume playing a playlist - resume [name] [next]

bookmark

sibyl bookmark [show|set|remove|update] [name]

This command interfaces with the bookmark store. The set option only works if there is an active audios or videos playlist. The update command only works if you're watching something via the resume command.

  • show - responds with a list of all saved bookmarks
  • show name - returns all bookmarks that contain name
  • set - save your position and time in the current playlist as the full path of the directory
  • set name - same as above but save it as name (you should always use this syntax)
  • remove name - deletes any bookmarks containing name
  • remove * - deletes all bookmarks
  • update - update the current bookmark (only works if watching via resume)

resume

sibyl resume [name] [next]

Resume playing from the location denoted in a bookmark. Its behavior is as follows:

  • resume - start playing from the most recently added bookmark
  • resume name - start playing from the bookmark that matches name
  • resume [name] next - as above, but start at the beginning of the next playlist item

Creating a Bookmark

This is done using the bookmark set command. Executing sibyl bookmark set will create a new bookmark for the file you are currently playing. The bookmark will remember the directory used to create the playlist, your position in the playlist, your current time in the file, and the creation time of the bookmark.

It is a good idea to name your bookmarks, since the default name is the full path of the playlist directory. For example, if I was listening to the Night Vale podcast and wanted to remember my place, I might say sibyl bookmark set nightvale. If you have multiple users, I highly recommend adding your name to the front of the bookmark name. For example, Josh and Jon could have the bookmarks josh-nightvale and jon-nightvale stored in the same sibyl instance.

Resuming from a Bookmark

This is done using the resume command. Executing sibyl resume will look for the most recently created bookmark, load its saved directory as a playlist, and start playing at the saved playlist position and current time. I could also say sibyl resume nightvale for a specific bookmark.

This command has one additional option. You can add next to the end of the command to start playing at the very beginning of the next file. So if you always call bookmark set at the end of any episode, you can say sibyl resume next to start the next file right away. Of course, this works with names too, so you could do sibyl resume nightvale next as well.

Updating a Bookmark

If you start watching something again with sibyl resume nightvale but don't finish the playlist, you can update the bookmark's playlist position with sibyl bookmark update. Doing sibyl bookmark set nightvale would also work.

Managing Bookmarks

This is also done using the bookmark command. Executing sibyl bookmark or sibyl bookmark show will display a list of all currently saved bookmarks. You can also call this command with a name parameter to only display matching bookmarks. This is especially handy if you have multiple users and put your name in your bookmarks. So Josh could find all his bookmarks with sibyl bookmark show josh- and Jon could find all his with sibyl bookmark show jon-.

You can also delete bookmarks using this command. Just do sibyl bookmark remove nightvale for example. You can also delete all bookmarks by executing sibyl bookmark remove *. Note that removed bookmarks are unrecoverable.

Advanced Info

Sibyl stores bookmarks internally in the bm_store variable. Additionally, because the audios and videos commands are mostly based in Sibyl and not XBMC, Sibyl also maintains the last_played variable that is updated any time a new file is played. Users are unlikely to have very many bookmarks, so Sibyl stores bookmarks in a plaintext, tab-delineated file. Each row is one bookmark, with fields in the order: name, path, pid, pos, file, time, add. It looks like below, except it uses tabs not spaces, and the first two lines are not present in the actual file:

name              path                               pid  pos   file                  time     added
----------------------------------------------------------------------------------------------------------------
josh-avatar       /media/video/avatar/book1          1    5     avatar-bk1-ep6.avi    20:29    1438111905.751899
josh-nightvale    /media/audio/podcasts/nightvale    0    12    nv-13.mp3             10:23    1438129708.286851
jon-nightvale     /media/audio/podcasts/nightvale    0    23    nv-24.mp3             0:01     1438122600.944166

The pid (playlist id) is necessary because in XBMC each file type has its own playlist id: audio is 0, video is 1, and picture is 2. The playlist item number is stored 0-indexed, whereas user-facing sibyl commands all assume 1-indexing. The name of the current file is stored as well for additional info and in case a directory contains badly formed file names that don't sort correctly. The current time must be [hh:m]m:ss. The timestamp is created using python's time.time() function. On UNIX-like platforms, this is the number of seconds since January 1, 1970. The file should always end in a blank newline. If you follow all these restrictions, you can directly edit the bookmark file if you want to. Any manual edits to the file will not be seen until a restart of Sibyl. Modifying bookmarks with the bookmark command before restarting will erase any manual edits done to the file.

Clone this wiki locally