Package: lunii
LumiiosLumiios 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.InstallationUsageDevice-level methodsStory-level methodsPlaying storiesContributingInstallationLumiios is available under PyPi! You can install it by:pipinstallluniiOr alternatively you can:pipinstallgit+https://github.com/bastien8060/LumiiosUsageDevice-level methodsTo 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.fromluniiimportDevicedevice=Device('/media/lunii')# get the serial number of the Lunii StoryTellersnu=device.snu# get the major and minor firmware version of the Lunii StoryTellerfw_vers_major=device.fw_vers_majorfw_vers_minor=device.fw_vers_minorprint(f'Lunii StoryTeller SNU:{snu}')print(f'Lunii StoryTeller Firmware Version:{fw_vers_major}.{fw_vers_minor}')Story-level methodsYou 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 storiesdevice.parse_stories()story=device.stories[0]version=story.versiontitle=story.titleauthorized=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 compatibleifauthorized: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 StoryTellerstory_uuid=device.story_list[0]# parse a single storystory=device.parse_story(story_uuid)Lumiios also allows you to read the cover audio of a story.# get the cover audio of a storycover_audio=story.cover_audioprint(f'Cover audio content type:{cover_audio.audio_type}')print('Playing cover audio...')cover_audio.play()whilecover_audio.is_playing():time.sleep(0.1)cover_audio.release()# saving itwithopen('cover_audio.mp3','wb')asf:f.write(cover_audio.content)Playing storiesLumiios 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.fromluniiimportStoryPlayerstory_player=StoryPlayer(story)# this will block until the story is finished playingstory_player.play()print("Player History:{}".format(story_player.node_history))Or you can interact with the story programmatically by passing interactive=False and callbacks to the StoryPlayer constructor.defdisplay_cb(image:ImageAsset):withopen('image.png','wb')asf:f.write(image.content)# or display the image in a terminal: image.show()defaudio_cb(audio:AudioAsset):withopen('audio.mp3','wb')asf:f.write(audio.content)# or play the audio with vlc: audio.play()story_player=StoryPlayer(story,interactive=False,display_cb=display_cb,audio_cb=audio_cb)story_player.play()# blocks until the story is finished playingyou can run the play() method in a separate thread to allow the story to play in the background. These are the methods you can use to interact with the story:fromlunii.utilsimportButtonsstory_player.play()# starts playing the storystory_player.walk_back()# goes back to the previous nodereset_to_node(0)# resets the story to the node #0 so the start of the storystory_player.playing# returns True if the story is playing and False if it has finishedbuttons=[Buttons.PLUS,Buttons.MINUS,Buttons.HOME,buttons.OK]story_player.feed_input(buttons[0])# feeds the story with the buttons pressedNote: The StoryPlayer class is still in development and is not fully functional yet.ContributingPull 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.