Skip to content

Commit

Permalink
Merge pull request #2580 from pustovitDmytro/script.areace
Browse files Browse the repository at this point in the history
script.areace 1.1.0
  • Loading branch information
pkscout authored Jan 26, 2024
2 parents 9b7c1cd + 8139d30 commit 47f1028
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 17 deletions.
7 changes: 6 additions & 1 deletion script.areace/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.areace" version="1.0.3" name="Are Ace" provider-name="pustovit">
<addon id="script.areace" version="1.1.0" name="Are Ace" provider-name="pustovit">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="script.module.requests" version="2.27.1"/>
Expand All @@ -17,6 +17,11 @@
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
<screenshot>resources/screenshots/settings.jpg</screenshot>
<screenshot>resources/screenshots/telegram_channel.png</screenshot>
<screenshot>resources/screenshots/select_stream.jpg</screenshot>
<screenshot>resources/screenshots/chose_app.jpg</screenshot>
<screenshot>resources/screenshots/acestream_buffering.jpg</screenshot>
</assets>
</extension>
</addon>
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/screenshots/chose_app.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/screenshots/settings.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 21 additions & 16 deletions script.areace/resources/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@

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

def fetch(config):
def handleMessage(post, results):
if(not 'text' in post): return
text = post['text']
timestamp = post['date']
date = dtm.datetime.fromtimestamp(timestamp)
obj={'text':' '.join(text.split()),'date':date}
match = re.findall(r'[0-9a-f]{40}', text)
for id in match:
o = obj.copy()
o['acestream_id'] = id
results.append(o)

def handleTelegramResponse(json):
if(not json['ok']): return []
results=[]
for update in json['result']:
if('channel_post' in update): handleMessage(update['channel_post'], results)
if('message' in update): handleMessage(update['message'], results)
return results

def fetch(config):
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
return handleTelegramResponse(res.json())

0 comments on commit 47f1028

Please sign in to comment.