Skip to content

Commit

Permalink
[script.areace] 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
pustovitDmytro committed Oct 16, 2023
1 parent 5291cb5 commit 97202d0
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 0 deletions.
21 changes: 21 additions & 0 deletions script.areace/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Dmytro Pustovit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions script.areace/addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.areace" version="1.0.3" name="Are Ace" provider-name="pustovit">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="script.module.requests" version="2.27.1"/>
</requires>
<extension point="xbmc.python.script" library="script.py">
<provides>executable</provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en_GB">scrapes live sport event links from Telegram and seamlessly opens them in the Acestream player</summary>
<description lang="en_GB">Tired of the endless hunt for live sports event streams? "Are Ace" simplifies the process by scanning Telegram channels and groups known for sharing sports event links, collecting them for you. With an easy integration to the Acestream media player, it ensures you have quick access to high-quality, buffer-free sports event streams. Stay updated effortlessly, and enjoy a user-friendly interface for a seamless sports viewing experience. Say goodbye to the hassle of link searching, and say hello to the convenience of "Are Ace".</description>
<license>MIT</license>
<platform>android</platform>
<source>https://github.com/pustovitDmytro/areace</source>
<email>[email protected]</email>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
</assets>
</extension>
</addon>
18 changes: 18 additions & 0 deletions script.areace/resources/data_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import xbmcaddon
from resources.telegram import fetch

ADDON = xbmcaddon.Addon()

def load_telegram(settings):
enabled = settings.getBool('telegram.isEnabled')
if (not enabled): return []
opts = {
'token': settings.getString('telegram.token'),
'offset': settings.getInt('telegram.offset')
}
return fetch(opts)


def load_data():
settings = ADDON.getSettings()
return load_telegram(settings)
Binary file added script.areace/resources/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.areace/resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions script.areace/resources/main_dialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import xbmc, xbmcgui
from resources.data_loader import load_data

def main_dialog():
dialog = xbmcgui.Dialog()
items = load_data()
selected=dialog.select("Streams", list([x['text'] for x in items]))
if selected>=0:
item = items[selected]
cmd = 'StartAndroidActivity("","org.acestream.action.start_content","","acestream:?content_id=%s")' % item['acestream_id']
xbmc.executebuiltin(cmd)
8 changes: 8 additions & 0 deletions script.areace/resources/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="Telegram">
<setting id="telegram.isEnabled" type="bool" label="Enable" default="false"/>
<setting id="telegram.token" type="text" label="Bot Token" option="hidden" enable="!eq(-1,)" default=""/>
<setting label="Limit" type="slider" id="telegram.offset" default="10" range="0,5,100" option="int" enable="!eq(-1,)"/>
</category>
</settings>
26 changes: 26 additions & 0 deletions script.areace/resources/telegram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import requests
import re
import datetime as dtm

host="https://api.telegram.org/"

def fetch(config):
results=[]
params = dict(offset=config['offset'])
url=host+'bot'+config['token']+'/getUpdates'
res = requests.get(url, params)
json=res.json()
for update in json['result']:
if(not 'channel_post' in update): continue
if(not 'text' in update['channel_post']): continue
text = update['channel_post']['text']
timestamp = update['channel_post']['date']
date = dtm.datetime.fromtimestamp(timestamp)
obj={'text':text,'date':date}
match = re.search(r'[0-9a-f]{40}', text)
if match:
id = match.group()
if (id):
obj['acestream_id'] = id
results.append(obj)
return results
7 changes: 7 additions & 0 deletions script.areace/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from resources.main_dialog import main_dialog

def main():
main_dialog()

if (__name__ == '__main__'):
main()

0 comments on commit 97202d0

Please sign in to comment.