Skip to content

Commit

Permalink
script.wikipedia 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jurialmunkey committed Jul 14, 2023
1 parent 04fc368 commit 7804301
Show file tree
Hide file tree
Showing 10 changed files with 1,351 additions and 0 deletions.
674 changes: 674 additions & 0 deletions script.wikipedia/LICENSE.txt

Large diffs are not rendered by default.

72 changes: 72 additions & 0 deletions script.wikipedia/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
## Wikipedia Scripted Window
Create the following xml dialog in your skin

```
script-wikipedia.xml
```

```xml
<?xml version="1.0" encoding="UTF-8"?>
<window type="dialog">
<defaultcontrol always="true">9902</defaultcontrol>
<controls>
<!-- CONTENT GOES HERE -->
</controls>
</window>
```

## Required Controls

| ID | Type | Description |
| :--- | :--- | :--- |
| 9901 | label | Title of the Wikipedia article |
| 9902 | list | List of sections containing the table of contents. Scrolling the list changes text loaded in the section textbox 9903. Clicking a listitem opens a select dialog for page links in the section |
| 9903 | textbox | Textbox with the text of the section focused in 9902 |
| 9904 | label | Creative commons attribution label. REQUIRED! You MUST display this text as per Wikipedia licensing requirements |
| 9905 | image | Creative commons licence logo. The license logo is optional as long as you display the attribution label |
| 61 | scrollbar | Page control for section textbox. Clicking the scrollbar will pop-up select dialog for page links in the section |

## Window Properties

| Property | Description |
| :--- | :--- |
| Window.Property(Backdrop) | First result found on wikimedia commons for search term with landscape aspect. Not always accurate but can be useful to use in place of background fanart. This image is aliased to Window(Home).Property(Wikipedia.Backdrop) if you need to use it in a window underneath the dialog. |
| Window.Property(Image) | If the current section has an image, the first image will be added to this property. Otherwise it gets the first image for the page |
| Window.Property(ImageText) | The alt text for the image which is displayed on wikipedia for vision impaired users or when the image does not load |


## Changing Tag Formatting

HTML tag text formatting can be modified using a skin string.

Example: Change all `<a href=>` hyperlinks to red
`Skin.SetString(Wikipedia.Format.Link,[COLOR=red]{}[/COLOR])`

The `{}` curly braces will be replaced with the text between the HTML tags

| Skin String | Affected HTML Tags |
| :--- | :--- |
| Wikipedia.Format.Link | `<a href=>` |
| Wikipedia.Format.Bold | `<hx> <b> <th> and class:mw-headline` |
| Wikipedia.Format.Emphasis | `<em> <i>` |
| Wikipedia.Format.Superscript | `<sup>` |

## Opening / Searching

```
RunScript(script.wikipedia,wikipedia=SEARCHTERM)
```

Searches wikipedia for the search term and provides a select dialog for user to select from results.

Optionally can add a `tmdb_type=TYPE` param to tailor the search for more relevant results
Optionally can add a `xml_file=FILENAME` param to use alternate skin template
Optionally can add a `language=CODE` param to set language with two letter ISO 639-1 code

Supported language codes: `it` `de` `fr` `es` `en`

```
RunScript(script.wikipedia,wikipedia=Alien,tmdb_type=movie,language=en)
RunScript(script.wikipedia,wikipedia=Chernobyl,tmdb_type=tv,language=en)
RunScript(script.wikipedia,wikipedia=Matt Smith,tmdb_type=person,language=en)
```
21 changes: 21 additions & 0 deletions script.wikipedia/addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="script.wikipedia"
version="0.0.5"
name="Wikipedia"
provider-name="jurialmunkey">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.beautifulsoup4" version="4.9.3" />
<import addon="script.module.jurialmunkey" version="0.1.1" />
</requires>
<extension point="xbmc.python.script" library="resources/script.py" />
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">Access Wikipedia via Kodi</summary>
<description lang="en_GB">Access Wikipedia via Kodi</description>
<license>GPL-3.0-or-later</license>
<assets>
<icon>icon.png</icon>
<fanart>fanart.jpg</fanart>
</assets>
</extension>
</addon>
Binary file added script.wikipedia/fanart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added script.wikipedia/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# XBMC Media Center language file
# Addon Name: Skin Variables
# Addon id: script.skinvariables
# Addon Provider: jurialmunkey
msgid ""
msgstr ""
"Project-Id-Version: XBMC-Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2014-10-26 17:05+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

#: /resources/lib/api.py
msgctxt "#32001"
msgid "Text from Wikipedia under CC BY-SA 3.0 license."
msgstr ""

#: /resources/lib/api.py
msgctxt "#32000"
msgid "Unable to parse information in this section"
msgstr ""
Loading

0 comments on commit 7804301

Please sign in to comment.