Skip to content

Commit

Permalink
initial commit:
Browse files Browse the repository at this point in the history
- list channels
- play the streams
- couple of settings
  • Loading branch information
= committed Sep 9, 2023
1 parent 1fe5cfc commit b9f9dc7
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# plugin.video.fritz-dvbc
Kodi-Addon to list and play DVB-C streams supplied by AVM FRITZ! hardware

This project is in no way, shape or form affiliated with or endorsed by AVM!
47 changes: 47 additions & 0 deletions addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import sys
import urllib.error

import m3u8
import xbmcplugin as plugin
from xbmcgui import ListItem, Dialog


# filter out #EXTVLCOPT lines in the M3U files to circumvent a bug in m3u8 < 3.6.0
def drop_extvlcopt(line, lineno, data, state):
if line.startswith('#EXTVLCOPT'):
return True
else:
return False


def get_available_channels():
hostname = plugin.getSetting(addon_handle, 'host')
sources = []

if plugin.getSetting(addon_handle, 'tvsd') == 'true':
sources.append(f"http://{hostname}/dvb/m3u/tvsd.m3u")

if plugin.getSetting(addon_handle, 'tvhd') == 'true':
sources.append(f"http://{hostname}/dvb/m3u/tvhd.m3u")

channels = []
try:
for source in sources:
for stream in m3u8.load(source, custom_tags_parser=drop_extvlcopt).segments:
channels.append(dict(title=stream.title, uri=stream.uri))
except urllib.error.URLError as e:
Dialog().ok("Error", str(e))

return channels


addon_handle = int(sys.argv[1])
plugin.setContent(addon_handle, 'videos')

for available_channel in get_available_channels():
channel = ListItem(label=available_channel['title'])
channel.setInfo('video', {'title': available_channel['title']})
plugin.addDirectoryItem(handle=addon_handle, url=available_channel['uri'], listitem=channel)

plugin.addSortMethod(addon_handle, plugin.SORT_METHOD_TITLE)
plugin.endOfDirectory(addon_handle)
24 changes: 24 additions & 0 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon
id="plugin.video.fritz-dvbc"
name="FRITZ!DVB-C"
version="0.0.1"
provider-name="MrChick">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="script.module.m3u8" version="3.5.0"/>
</requires>
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>video</provides>
</extension>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<summary lang="en">List and watch DVB-C streams supplied by your FRITZ! hardware</summary>
<description lang="en">Watch the live tv DVB-C streams supplied by your AVM FRITZ!Box/FRITZ!Repeater

This project is in no way, shape or form affiliated with or endorsed by AVM!
</description>
<license>GPL-3.0-or-later</license>
<source>https://github.com/mrchick/plugin.video.fritz-dvbc</source>
</extension>
</addon>
24 changes: 24 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Kodi language file
# Addon id: plugin.video.fritz-dvbc
# Addon Provider: MrChick
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"

msgctxt "#30000"
msgid "Device address (hostname or IP)"
msgstr ""

msgctxt "#30001"
msgid "Include SD channels"
msgstr ""

msgctxt "#30002"
msgid "Include HD channels"
msgstr ""

msgctxt "#30010"
msgid "TV formats"
msgstr ""
7 changes: 7 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<setting type="text" label="30000" default="fritz.box" id="host"/>
<setting label="30010" type="lsep"/>
<setting type="bool" label="30001" default="true" id="tvsd"/>
<setting type="bool" label="30002" default="true" id="tvhd"/>
</settings>

0 comments on commit b9f9dc7

Please sign in to comment.