Skip to main content

A Python package for working with Lunii devices, and emulating them

Project description

Lumiios

Lumiios is a Python program that allows you to manage and emulate the Lunii StoryTeller. With Lumiios, you can easily parse every story in your device and get details about each one.

Installation

Lumiios is available under PyPi! You can install it by:

pip install lunii

Or alternatively you can:

pip install git+https://github.com/bastien8060/Lumiios

Usage

Device-level methods

To use Lumiios, you need to create an instance of the Device class by passing in the folder mountpoint or dump location of your Lunii StoryTeller. Once you have a Device instance, you can call its methods to get information about the stories on your device.

from lunii import Device

device = Device('/media/lunii')

# get the serial number of the Lunii StoryTeller
snu = device.snu

# get the major and minor firmware version of the Lunii StoryTeller
fw_vers_major = device.fw_vers_major
fw_vers_minor = device.fw_vers_minor

print(f'Lunii StoryTeller SNU: {snu}')
print(f'Lunii StoryTeller Firmware Version: {fw_vers_major}.{fw_vers_minor}')

Story-level methods

You can also parse the stories on your device and get information about each one, as well as read them fully in the next release.

# parse all stories
device.parse_stories()

story = device.stories[0]

version = story.version
title = story.title
authorized = story.authorized # True if story is authorized by the Lunii StoryTeller (checksum is valid)
night_mode = story.night_mode # True if the story is Night Mode compatible

if authorized:
    print(f'Version: {version}')
    print(f'Title: {title}')
    print(f'Night Mode: {night_mode}')
else:
    print(f'Story {title} is not authorized')

You can also parse a single story by passing in the UUID of the story. This is useful if you have a lot of stories on your device.

# get the list of stories installed on the Lunii StoryTeller
story_uuid = device.story_list[0]

# parse a single story
story = device.parse_story(story_uuid)

Lumiios also allows you to read the cover audio of a story.

# get the cover audio of a story
cover_audio = story.cover_audio

print(f'Cover audio content type: {cover_audio.audio_type}')

print('Playing cover audio...')
cover_audio.play()
while cover_audio.is_playing():
    time.sleep(0.1)
cover_audio.release()


# saving it
with open('cover_audio.mp3', 'wb') as f:
    f.write(cover_audio.content)

Playing stories

Lumiios also allows you to play stories on your Lunii StoryTeller. This is done by creating a StoryPlayer instance with a Story instance. You can then play the story by calling the play() method.

from lunii import StoryPlayer

story_player = StoryPlayer(story)
# this will block until the story is finished playing
story_player.play()

print("Player History: {}".format(story_player.node_history))

Note: The StoryPlayer class is still in development and is not fully functional yet. As of this release, the StoryPlayer is only interactive and does not support interacting with stories programmatically.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

If you find a bug or have a feature request, please open an issue on GitHub.

If you want to contribute to Lumiios, please open a pull request on GitHub.

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

lunii-0.2.0a1.tar.gz (34.4 kB view details)

Uploaded Source

File details

Details for the file lunii-0.2.0a1.tar.gz.

File metadata

  • Download URL: lunii-0.2.0a1.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for lunii-0.2.0a1.tar.gz
Algorithm Hash digest
SHA256 e4803c5c489588ea4a23ad25c7c29464645b4b80289204cec057a01c38787d8d
MD5 44d4d7d25b3ff0c8ad78a1a25c47245a
BLAKE2b-256 4aa8e6fc945a055b426a49da8e963992cc2bbad91c1445f8913b4d4ec67b26d5

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