Skip to content

Commit

Permalink
supports for funding info
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Jan 10, 2022
1 parent 383e575 commit 5eb7310
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 50 deletions.
50 changes: 0 additions & 50 deletions packages/com.limelight.webos.py

This file was deleted.

32 changes: 32 additions & 0 deletions packages/com.limelight.webos.yml
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 2 additions & 0 deletions repogen/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions repogen/funding.py
Original file line number Diff line number Diff line change
@@ -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()))))
2 changes: 2 additions & 0 deletions repogen/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions theme/templates/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,15 @@ <h1 class="app-title">{{ page.title }}</h1>
<p>Last Updated: {{ page.modified.strftime('%Y/%m/%d %H:%M:%S %Z') }}</p>
{% endif %}
{% endblock %}

{% block sidebar %}
{% if page.metadata.sponsor_links %}
<h3>Sponsor</h3>
<ul class="links">
{% for link in page.metadata.sponsor_links %}
<li><a href="{{link.href}}" target="_blank">{{link.text}}</a></li>
{% endfor %}
</ul>
{% endif %}
{{ super() }}
{% endblock %}

0 comments on commit 5eb7310

Please sign in to comment.