Skip to content

Commit

Permalink
redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
lekma committed May 19, 2020
1 parent 1fa495c commit 8bc7521
Show file tree
Hide file tree
Showing 13 changed files with 551 additions and 552 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# plugin.video.dlive
DLive Livestreaming Addon for Kodi.
[DLive](https://dlive.tv/) Livestreaming Addon for Kodi.

Download the latest version from [here](https://github.com/lekma/plugin.video.dlive/releases/)
([script.module.iapc](https://github.com/lekma/script.module.iapc/) is available
[here](https://github.com/lekma/script.module.iapc/releases/)).

Alternatively you can install [this repository](https://github.com/lekma/repository.lekma/)
and install DLive from [Kodi](https://kodi.wiki/view/Add-on_manager#How_to_install_add-ons_from_a_repository).

Download the latest version from [here](https://github.com/lekma/plugin.video.dlive/releases/).
13 changes: 0 additions & 13 deletions addon.py

This file was deleted.

19 changes: 12 additions & 7 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.dlive"
name="DLive"
version="0.1.2"
version="0.2.0"
provider-name="lekma">

<requires>
<import addon="xbmc.python" version="2.26.0" />
<import addon="script.module.six" version="1.11.0" />
<import addon="script.module.kodi-six" version="0.1.2" />
<import addon="script.module.requests" version="2.22.0" />
<import addon="script.module.m3u8" version="0.3.7" />
<import addon="script.module.inputstreamhelper" version="0.4.3" />
<import addon="script.module.iapc" version="0.1.0" />
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">

<extension point="xbmc.python.pluginsource" library="lib/plugin.py">
<provides>video</provides>
</extension>

<extension point="xbmc.service" library="lib/service.py" />

<extension point="xbmc.addon.metadata">
<reuselanguageinvoker>true</reuselanguageinvoker>
<summary lang="en_GB">DLive Livestreaming Addon</summary>
<description lang="en_GB">DLive Livestreaming Addon</description>
<language>en</language>
<license>GPL-3.0-only</license>
<platform>all</platform>
<source>https://github.com/lekma/plugin.video.dlive</source>
<assets>
<icon>resources/media/icon.png</icon>
<fanart>resources/media/fanart.png</fanart>
</assets>
<summary lang="en_GB">DLive Livestreaming Addon</summary>
<description lang="en_GB">DLive Livestreaming Addon</description>
</extension>

</addon>
51 changes: 0 additions & 51 deletions lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,3 @@

from __future__ import absolute_import, division, unicode_literals


_folders_schema_ = {
"livestreams": {
"": {
"id": 30004,
"action": "livestreams"
},
"featured": {
"id": 30007,
"action": "featured"
}
},
"categories": {
"": {
"id": 30006,
"action": "categories"
},
"search": {
"id": 30006,
"action": "search_categories"
}
},
"users": {
"recommended": {
"id": 30009,
"action": "recommended"
},
"search": {
"id": 30003,
"action": "search_users"
}
},
"search": {
"": {
"id": 30002
}
}
}


_home_folders_ = (
{"type": "livestreams", "style": "featured"},
{"type": "users", "style": "recommended"},
{"type": "livestreams"},
{"type": "categories"},
{"type": "search"}
)


_subfolders_defaults_ = ("users", "categories")

86 changes: 86 additions & 0 deletions lib/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# -*- coding: utf-8 -*-


from __future__ import absolute_import, division, unicode_literals


import objects
from utils import notify
from iapc import Client


# ------------------------------------------------------------------------------
# Client
# ------------------------------------------------------------------------------

class DLiveClient(object):

_live_url_ = "https://live.prd.dlive.tv/hls/live/{username}.m3u8"

_classes_ = {
"stream": objects.User,
"user": objects.User,
"category": objects.Category,
"featured": objects.Livestreams,
"recommended": objects.Users,
"streams": objects.Livestreams,
"categories": objects.Categories,
"search_users": objects.Users,
"search_categories": objects.Categories
}

def __init__(self):
self.client = Client()

def query(self, key, _list_=False, **kwargs):
cls, data = self._classes_[key], getattr(self.client, key)(**kwargs)
if _list_:
return cls(data["list"], **data["pageInfo"])
return cls(data)

# --------------------------------------------------------------------------

def query_streams(self, **kwargs):
return self.query("streams", _list_=True, **kwargs)

# --------------------------------------------------------------------------

def stream(self, **kwargs):
user = self.query("stream", **kwargs)
if not user.livestream:
return notify(30016, user.displayname) # Offline
return user.livestream._item(self._live_url_.format(**kwargs))

def user(self, **kwargs):
after = kwargs.get("after", "-1")
user = self.query("user", **kwargs)
return (user.livestream if after == "-1" else None, user.pastBroadcasts)

def category(self, **kwargs):
streams = self.query_streams(**kwargs)
streams.category = self.query("category", **kwargs).title
return streams

# --------------------------------------------------------------------------

def featured(self, **kwargs):
return self.query("featured", **kwargs)

def recommended(self, **kwargs):
return self.query("recommended", **kwargs)

def streams(self, **kwargs):
return self.query_streams(**kwargs)

def categories(self, **kwargs):
return self.query("categories", _list_=True, **kwargs)

def search_users(self, **kwargs):
return self.query("search_users", _list_=True, **kwargs)

def search_categories(self, **kwargs):
return self.query("search_categories", _list_=True, **kwargs)


client = DLiveClient()

Loading

0 comments on commit 8bc7521

Please sign in to comment.