diff --git a/packages/com.limelight.webos.py b/packages/com.limelight.webos.py deleted file mode 100644 index 0c7ac8a..0000000 --- a/packages/com.limelight.webos.py +++ /dev/null @@ -1,50 +0,0 @@ -import requests - -title = 'Moonlight' -iconUri = 'https://raw.githubusercontent.com/mariotaku/moonlight-tv/main/deploy/webos/icon_large.png' -detailIconUri = 'https://raw.githubusercontent.com/mariotaku/moonlight-tv/main/res/moonlight_320.png' -manifestUrl = 'https://github.com/mariotaku/moonlight-tv/releases/latest/download/com.limelight.webos.manifest.json' -category = 'games' -description = ''' -Moonlight TV is a community version of [Moonlight GameStream Client](https://moonlight-stream.org/), made for large -screens. - -![Download Stats](https://img.shields.io/github/downloads/mariotaku/moonlight-tv/total) -![GitHub Stars](https://img.shields.io/github/stars/mariotaku/moonlight-tv?style=social) - -## Features - -* High performance streaming for webOS -* UI optimized for large screen and remote controller -* Supports up to 4 controllers -* Easy to port to other OSes (Now runs on macOS, Arch, Debian, Raspbian and Windows) - -## Screenshots - -![Launcher](https://user-images.githubusercontent.com/830358/141690137-529d3b94-b56a-4f24-a3c5-00a56eb30952.png) - -![Settings](https://user-images.githubusercontent.com/830358/147389849-6907f614-dbd4-4c24-987e-1a214a9680d0.png) - -![In-game Overlay](https://user-images.githubusercontent.com/830358/141690146-27ee2564-0cc8-43ef-a5b0-54b8487dda1e.png) -_Screenshot performed on TV has lower picture quality. Actual picture quality is better._ - -## [Documentations](https://github.com/mariotaku/moonlight-tv/wiki) -''' - - -def load(): - content = { - 'title': title, - 'iconUri': iconUri, - 'detailIconUri': detailIconUri, - 'category': category, - 'description': description, - 'manifestUrl': manifestUrl - } - with requests.get('https://api.github.com/repos/mariotaku/moonlight-tv/releases', {'per_page': 1}) as resp: - latest = resp.json()[0] - if latest['prerelease']: - for asset in filter(lambda x: x['name'] == 'com.limelight.webos.manifest.json', latest['assets']): - content['manifestUrlBeta'] = asset['browser_download_url'] - break - return content diff --git a/packages/com.limelight.webos.yml b/packages/com.limelight.webos.yml new file mode 100644 index 0000000..ff7580f --- /dev/null +++ b/packages/com.limelight.webos.yml @@ -0,0 +1,32 @@ +title: Moonlight +iconUri: https://raw.githubusercontent.com/mariotaku/moonlight-tv/main/deploy/webos/icon_large.png +detailIconUri: https://raw.githubusercontent.com/mariotaku/moonlight-tv/main/res/moonlight_320.png +manifestUrl: https://github.com/mariotaku/moonlight-tv/releases/latest/download/com.limelight.webos.manifest.json +category: games +description: | + Moonlight TV is a community version of [Moonlight GameStream Client](https://moonlight-stream.org/), made for large + screens. + + ![Download Stats](https://img.shields.io/github/downloads/mariotaku/moonlight-tv/total) + ![GitHub Stars](https://img.shields.io/github/stars/mariotaku/moonlight-tv?style=social) + + ## Features + + * High performance streaming for webOS + * UI optimized for large screen and remote controller + * Supports up to 4 controllers + * Easy to port to other OSes (Now runs on macOS, Arch, Debian, Raspbian and Windows) + + ## Screenshots + + ![Launcher](https://user-images.githubusercontent.com/830358/141690137-529d3b94-b56a-4f24-a3c5-00a56eb30952.png) + + ![Settings](https://user-images.githubusercontent.com/830358/147389849-6907f614-dbd4-4c24-987e-1a214a9680d0.png) + + ![In-game Overlay](https://user-images.githubusercontent.com/830358/141690146-27ee2564-0cc8-43ef-a5b0-54b8487dda1e.png) + _Screenshot performed on TV has lower picture quality. Actual picture quality is better._ + + ## [Documentations](https://github.com/mariotaku/moonlight-tv/wiki) + +funding: + github: [mariotaku] \ No newline at end of file diff --git a/repogen/common.py b/repogen/common.py index ba2acdf..68932cf 100644 --- a/repogen/common.py +++ b/repogen/common.py @@ -89,6 +89,8 @@ def parse_package_info(path: str, offline=False): } if 'detailIconUri' in content: pkginfo['detailIconUri'] = content['detailIconUri'] + if 'funding' in content: + pkginfo['funding'] = content['funding'] manifest, lastmodified_r = obtain_manifest(pkgid, 'release', manifest_url, offline) if manifest: pkginfo['manifest'] = manifest diff --git a/repogen/funding.py b/repogen/funding.py new file mode 100644 index 0000000..0228674 --- /dev/null +++ b/repogen/funding.py @@ -0,0 +1,32 @@ +from urllib.parse import urlsplit, SplitResult, urlunsplit + +from more_itertools import flatten + + +def parse_links(funding: dict): + if not funding: + return None + + def parse_element(platform: str, element: str): + if platform == 'github': + return {'href': f'https://github.com/sponsors/{element}', 'text': f'{element} on Github'} + elif platform == 'patreon': + return {'href': f'https://www.patreon.com/{element}', 'text': f'{element} on Patreon'} + elif platform == 'ko_fi': + return {'href': f'https://ko-fi.com/{element}', 'text': f'{element} on Ko-fi'} + elif platform == 'custom': + comps = urlsplit(element) + if not comps.scheme: + netloc, path = (comps.path.split('/', 1) + [''])[:2] + comps = SplitResult(scheme='https', netloc=netloc, path=path, query=comps.query, + fragment=comps.fragment) + return {'href': urlunsplit(comps), 'text': f'{comps.netloc}/{comps.path}'.rstrip('/')} + else: + return None + + def parse_item(platform, value): + if value is str: + return [parse_element(platform, value)] + return map(lambda e: parse_element(platform, e), value) + + return list(filter(lambda x: x, flatten(map(lambda item: parse_item(item[0], item[1]), funding.items())))) diff --git a/repogen/plugin.py b/repogen/plugin.py index 2f7bb35..bdc358e 100644 --- a/repogen/plugin.py +++ b/repogen/plugin.py @@ -9,6 +9,7 @@ from pelican.readers import BaseReader from pelican.themes.webosbrew import pagination_data +from repogen import funding from repogen.common import parse_package_info log = logging.getLogger(__name__) @@ -33,6 +34,7 @@ def read(self, filename): 'modified': info['lastmodified'], 'manifest': info['manifest'], 'detailIcon': info.get('detailIconUri', info['iconUri']), + 'sponsor_links': funding.parse_links(info.get('funding', None)), 'package_info': info } return self._md.convert(info['description']), metadata diff --git a/theme/templates/app.html b/theme/templates/app.html index 0a36348..4741512 100644 --- a/theme/templates/app.html +++ b/theme/templates/app.html @@ -49,3 +49,15 @@
Last Updated: {{ page.modified.strftime('%Y/%m/%d %H:%M:%S %Z') }}
{% endif %} {% endblock %} + +{% block sidebar %} +{% if page.metadata.sponsor_links %} +