Metadata-Version: 2.4
Name: ovos-skill-1001-nights
Version: 0.1.0
Summary: Tales from the Thousand and One Nights (Wikisource) provider for ovos-common-reading-pipeline-plugin. No standalone voice interface.
Author: Andreas Lorensen
License: Apache-2.0
Project-URL: Homepage, https://github.com/emkay-voice/ovos-skill-1001-nights
Project-URL: Issues, https://github.com/emkay-voice/ovos-skill-1001-nights/issues
Project-URL: Emkay, https://github.com/emkay-voice/emkay
Project-URL: Icon, https://raw.githubusercontent.com/emkay-voice/ovos-skill-1001-nights/main/story-512.png
Keywords: ovos,openvoiceos,skill,voice,assistant,fairytales,arabian-nights,1001-nights,wikisource,storytelling,emkay
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Intended Audience :: End Users/Desktop
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Topic :: Home Automation
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ovos-workshop<10.0.0,>=0.0.15
Requires-Dist: requests
Requires-Dist: beautifulsoup4
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# <img src='story-512.png' card_color='#40DBB0' width='50' height='50' style='vertical-align:bottom'/> 1001 Nights (provider)

A *provider* skill for [ovos-common-reading-pipeline-plugin](https://github.com/andlo/ovos-common-reading-pipeline-plugin),
delivering tales from the Thousand and One Nights – Ali Baba, Aladdin,
Sindbad the Sailor and the rest of Scheherazade's stories.

It is made for [Emkay](https://github.com/emkay-voice/emkay), OpenVoiceOS
in the browser, and works on any [OpenVoiceOS](https://openvoiceos.org).
It sits next to [Andersen](https://github.com/emkay-voice/ovos-skill-andersen-tales)
and [Grimm](https://github.com/emkay-voice/ovos-skill-grimm-tales), with
the same storybook icon.

[![Build](https://github.com/emkay-voice/ovos-skill-1001-nights/actions/workflows/publish.yml/badge.svg)](https://github.com/emkay-voice/ovos-skill-1001-nights/actions/workflows/publish.yml)
[![PyPI version](https://img.shields.io/pypi/v/ovos-skill-1001-nights.svg)](https://pypi.org/project/ovos-skill-1001-nights/)

> **This skill has no standalone voice interface.** It registers no
> intents and never speaks. It only answers
> [ovos.common_reading.* bus messages](https://github.com/andlo/ovos-common-reading-pipeline-plugin#the-ovoscommon_reading-bus-protocol),
> so you also need **ovos-common-reading-pipeline-plugin** installed and
> added to your pipeline config for it to be useful at all.

## Install
```bash
pip install ovos-skill-1001-nights ovos-common-reading-pipeline-plugin
```

## Where the stories come from

This provider publishes nothing itself: every tale is read from
**[Wikisource](https://wikisource.org)**, the free library of
public-domain texts, and says so. The `source` of each search answer is
"Wikisource", and the pipeline says it after the last sentence ("And
that's the end. It came from Wikisource.").

Wikisource allows other web pages to read it, so this provider works the
same on a device and in a browser (Emkay).

| Language | Wikisource edition | Tales |
|---|---|---|
| English | [Fairy tales from the Arabian nights](https://en.wikisource.org/wiki/Fairy_tales_from_the_Arabian_nights) and [Stories from the Arabian nights](https://en.wikisource.org/wiki/Stories_from_the_Arabian_nights_(Housman,_Dulac)) (Laurence Housman, illustrated by Edmund Dulac) | about 30 |
| French | Antoine Galland's [Les Mille et Une Nuits](https://fr.wikisource.org/wiki/Les_Mille_et_Une_Nuits) (1704–1717), the first European translation | about 90 |
| Italian | [Le Mille ed una Notti](https://it.wikisource.org/wiki/Le_Mille_ed_una_Notti) | about 150 |

Only editions fit to read aloud to anyone are used – Galland and the
books made from it for young readers – not the unexpurgated
translations (Burton, Mardrus). The texts on Wikisource are in the
public domain; see each page for its edition and translator.

Danish, German, Spanish, Dutch and Portuguese have no edition of the
Nights on Wikisource yet that can be used here. Det Kgl. Bibliotek has
digitised old public-domain Danish editions (e.g. *Tusinde og Een Nat*,
1852–54) – once one of them is proofread onto Danish Wikisource, adding
it here is one line in `WIKISOURCE_COLLECTIONS` and a `locale/da-dk`
folder.

## Languages

**This provider does not translate.** It loads only for the languages
the installation is configured for - the device's own `lang` plus
`secondary_langs` in `mycroft.conf` - that it has tales in (above). If
none of them is one of those, it **never loads at all**: `initialize()`
builds no index, registers no bus events, and logs a clear message
rather than silently serving English (or any other) content.

For each configured, supported language it builds its own index (kept
for a week), and each search is answered from the index of the language
it was made in: the pipeline plugin's `lang` field, else the language of
the session the search came from, else the device's own. A HiveMind hub
serving users in several languages lists them in `secondary_langs`:

```json
{
  "lang": "en-US",
  "secondary_langs": ["fr-FR", "it-IT"]
}
```

A search in a language the installation doesn't serve gets no answer at
all. A search with no title ("tell me a story") gets a random tale at
0.9, and titles match regardless of case.

The collection name and `collection_hint` aliases are per language:
`locale/<lang>/collection.voc` (e.g. "arabian nights", "one thousand
and one nights", "scheherazade"; "mille et une nuits"; "mille e una
notte") and `locale/<lang>/collection_meta.json`. The Nights have no
author, so none is announced.

## Content type

Identifies as `content_type: "story"` (or `"tale"`). A search with a
`content_type` hint for anything else (e.g. "article", "poem") gets no
response from this provider.

## How it fits together

- `wikisource.py` – finds a collection's tales and reads a tale's text
  through MediaWiki's action API (`origin=*`, so a web page may read the
  answer). Plain `requests` and BeautifulSoup, no OVOS. The same module
  is used by the Andersen and Grimm providers.
- `__init__.py` – the provider: the ovos.common_reading.* bus protocol,
  the per-language indexes and their cache.

```bash
pip install -e ".[test]"
pytest tests
```

The tests need no network: Wikisource is stood in for.

## Credits

Tales from [Wikisource](https://wikisource.org) and its volunteers, who
transcribe and proofread the public-domain editions.

## Category
**Entertainment**

## Tags
#stories #fairytales #arabiannights #1001nights #wikisource #provider
