Skip to content

Commit ad371cd

Browse files
committed
initial sync
1 parent a26adb6 commit ad371cd

File tree

11 files changed

+2196
-88
lines changed

11 files changed

+2196
-88
lines changed

.gitignore

+6-87
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,8 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
1+
# Test Cache files
2+
cache/
53

6-
# C extensions
7-
*.so
4+
# Test xmltv files
5+
xmltv.xml
86

9-
# Distribution / packaging
10-
.Python
11-
env/
12-
build/
13-
develop-eggs/
14-
dist/
15-
downloads/
16-
eggs/
17-
.eggs/
18-
lib/
19-
lib64/
20-
parts/
21-
sdist/
22-
var/
23-
*.egg-info/
24-
.installed.cfg
25-
*.egg
26-
27-
# PyInstaller
28-
# Usually these files are written by a python script from a template
29-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30-
*.manifest
31-
*.spec
32-
33-
# Installer logs
34-
pip-log.txt
35-
pip-delete-this-directory.txt
36-
37-
# Unit test / coverage reports
38-
htmlcov/
39-
.tox/
40-
.coverage
41-
.coverage.*
42-
.cache
43-
nosetests.xml
44-
coverage.xml
45-
*,cover
46-
.hypothesis/
47-
48-
# Translations
49-
*.mo
50-
*.pot
51-
52-
# Django stuff:
53-
*.log
54-
local_settings.py
55-
56-
# Flask stuff:
57-
instance/
58-
.webassets-cache
59-
60-
# Scrapy stuff:
61-
.scrapy
62-
63-
# Sphinx documentation
64-
docs/_build/
65-
66-
# PyBuilder
67-
target/
68-
69-
# IPython Notebook
70-
.ipynb_checkpoints
71-
72-
# pyenv
73-
.python-version
74-
75-
# celery beat schedule file
76-
celerybeat-schedule
77-
78-
# dotenv
79-
.env
80-
81-
# virtualenv
82-
venv/
83-
ENV/
84-
85-
# Spyder project settings
86-
.spyderproject
87-
88-
# Rope project settings
89-
.ropeproject
7+
# Test log
8+
zap2xml.log

.zap2xmlrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
pass=password
3+
#proxy=127.0.0.1:80
4+
stuff=stuff #ignored

LICENSE renamed to LICENSE.txt

File renamed without changes.

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
# script.module.zap2xml
1+
# script.module.zap2xml
2+
3+
Zap2xml is an epg grabber which creates an xmltv file from data scraped from Zap2it or TVguide listings.
4+
5+
This addon is designed for use as a replacement for the perl xmltv apps that are dificult/impossible to use on a LibreELEC/OpenELEC distro since perl is not available.
6+
7+
It has been tested using LibreELEC and OpenELEC running Tvheadend for the backend.
8+
9+
10+
### Installing the addon manually:
11+
12+
1. Download and move the script.module.zap2xml.zip to your LibreELEC/OpenELEC machine using whatever method you are the most comfortable with.
13+
2. Navigate to SYSTEM->Addons->Install from zip
14+
== use the file browser to navigate to the file and select it.
15+
3. Navigate to SYSTEM->Addons->My Addons->Program Addons->zap2xml
16+
4. Select Configure and set your username, password and options.
17+
5. Reboot
18+
6. Configure your tv backend to use tv_grab_zap2xml
19+
20+
Notes:
21+
This addon is derived from the work of [FastEddyCurrent] (https://github.com/FastEddyCurrent/zap2xml)who ported the original perl based http://zap2xml.awardspace.info/ to Python.
22+

addon.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<addon id="script.module.zap2xml"
3+
name="zap2xml"
4+
version="0.4"
5+
provider-name="edit4ever">
6+
<requires>
7+
<import addon="xbmc.python" version="2.1.0"/>
8+
<import addon="script.module.mechanize" version="0.2.6"/>
9+
</requires>
10+
<extension point="xbmc.python.script" library="default.py">
11+
<provides></provides>
12+
</extension>
13+
<extension point="xbmc.addon.metadata">
14+
<summary>Zap2It xmltv grabber</summary>
15+
<description>zap2xml is an epg grabber which creates an xmltv file from data scraped from Zap2it or TVguide listings.</description>
16+
<disclaimer>
17+
</disclaimer>
18+
<platform>all</platform>
19+
<license>GNU GENERAL PUBLIC LICENSE. Version 3, June 2007</license>
20+
</extension>
21+
</addon>

bin/tv_grab_zap2xml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/sh
2+
3+
################################################################################
4+
# This file is part of OpenELEC - http://www.openelec.tv
5+
# Copyright (C) 2009-2014 Stephan Raue ([email protected])
6+
#
7+
# OpenELEC is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 2 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# OpenELEC is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License$
18+
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
19+
################################################################################
20+
21+
. /etc/profile
22+
23+
ADDON_HOME="$HOME/.kodi/userdata/addon_data/tools.module.zap2xml"
24+
ADDON_DIR="$HOME/.kodi/addons/tools.module.zap2xml"
25+
ADDON_SETTINGS="$ADDON_HOME/settings.xml"
26+
XMLTV_OUTPUT="$ADDON_HOME/xmltv.xml"
27+
if [ $# -lt 1 ]
28+
then
29+
CD=`pwd`
30+
cd $ADDON_HOME
31+
USERID=`grep id=\"User\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"`
32+
PASSWORD=`grep id=\"Pass\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"`
33+
NUMDAYS=`grep id=\"days\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value,-d," -e "s,=, ," -e "s,\",,g"`
34+
EPGSOURCE=`grep id=\"source\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,1,-z," -e "s,0,," -e "s,\",,g"`
35+
CHFIRST=`grep id=\"cfirst\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,true,-F," -e "s,false,," -e "s,\",,g"`
36+
CHANNELICONS=`grep id=\"cicons\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,true,-i\ icons," -e "s,false,," -e "s,\",,g"`
37+
ALLCHANNELS=`grep id=\"allc\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,true,-a," -e "s,false,," -e"s,\",,g"`
38+
PROGRAMICONS=`grep id=\"picons\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,true,-I," -e "s,false,," -e "s,\",,g"`
39+
EXTRADETAILS=`grep id=\"xdetails\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,true,-D," -e "s,false,," -e "s,\",,g"`
40+
EXTRADESCRIPTION=`grep id=\"xdesc\" $ADDON_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,true,-X," -e "s,false,," -e "s,\",,g"`
41+
python $ADDON_DIR/zap2xml.py -u $USERID -p $PASSWORD -o $XMLTV_OUTPUT $EPGSOURCE $NUMDAYS $CHFIRST $ALLCHANNELS $CHANNELICONS $PROGRAMICONS $EXTRADETAILS $EXTRADESCRIPTION > zap2xml.log 2>&1
42+
cat $XMLTV_OUTPUT
43+
cd $CD
44+
exit 0
45+
fi
46+
47+
while [ $# -gt 0 ]
48+
do case "$1" in
49+
-d | --description )
50+
printf "tv_grab_zap2xml is a simple wrapper for zap2xml.py\n"
51+
;;
52+
53+
-v | --version )
54+
printf "0.1\n"
55+
;;
56+
57+
-c | --capabilities )
58+
printf "baseline\n"
59+
;;
60+
61+
-* )
62+
printf "unknown option: %s\n" "$1"
63+
printf "Usage: %s: [--description] [--version] [--capabilities]\n" ${0##*/}
64+
exit 2
65+
;;
66+
67+
esac; shift
68+
done
69+
70+
exit 0s

default.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
################################################################################
2+
# This file is part of OpenELEC - http://www.openelec.tv
3+
# Copyright (C) 2009-2012 Stephan Raue ([email protected])
4+
#
5+
# This Program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 2, or (at your option)
8+
# any later version.
9+
#
10+
# This Program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with OpenELEC.tv; see the file COPYING. If not, write to
17+
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
18+
# http://www.gnu.org/copyleft/gpl.html
19+
################################################################################
20+
import xbmcgui
21+
22+
dialog = xbmcgui.Dialog()
23+
dialog.ok('', 'This is a console-only addon')

icon.png

67.2 KB
Loading
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2+
<strings>
3+
<!--zap2xml-->
4+
<string id="32000">User Information</string>
5+
<string id="32030">EPG Source</string>
6+
<string id="32031">Zap2It</string>
7+
<string id="32032">TV Guide</string>
8+
<string id="32010">Username</string>
9+
<string id="32020">Password</string>
10+
<string id="32100">Options</string>
11+
<string id="32110">Number of Days to Cache</string>
12+
<string id="32120">Channel Name First (before channel number)</string>
13+
<string id="32130">Download Channel Icons</string>
14+
<string id="32140">Include All Channels (not just favorites)</string>
15+
<string id="32170">Append Extra Details to Program Description</string>
16+
<string id="32149">Each Item Below Will Add an Additional Download per Program</string>
17+
<string id="32150">Download Program Icons</string>
18+
<string id="32160">Download Extra Program Details</string>
19+
<string id="32169">Add Delay If Extra Downloads Cause Failure</string>
20+
<string id="32170">Delay Between http Requests</string>
21+
</strings>
22+

resources/settings.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
2+
<settings>
3+
<category label="32000">
4+
<setting id="source" type="select" label="32030" lvalues="32031|32032"/>
5+
<setting label="32010" type="text" id="User" default="username"/>
6+
<setting label="32020" type="text" id="Pass" default="password"/>
7+
</category>
8+
<category label="32100">
9+
<setting label="32110" type="slider" id="days" default="3" range="1,1,14" option="int"/>
10+
<setting label="32120" type="bool" id="cfirst" default="false"/>
11+
<setting label="32130" type="bool" id="cicons" default="false"/>
12+
<setting label="32140" type="bool" id="allc" default="false"/>
13+
<setting label="32170" type="bool" id="xdesc" default="false"/>
14+
<setting type="sep"/>
15+
<setting label="32149" type="lsep" />
16+
<setting type="sep"/>
17+
<setting label="32150" type="bool" id="picons" default="false"/>
18+
<setting label="32160" type="bool" id="xdetails" default="false"/>
19+
<setting label="32169" type="lsep" />
20+
<setting label="32170" type="slider" id="delay" default="0" range="0,.25,3" option="float"/>
21+
</category>
22+
</settings>

0 commit comments

Comments
 (0)