Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
phoerious committed Sep 12, 2013
0 parents commit 99815c1
Show file tree
Hide file tree
Showing 14 changed files with 996 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# OS-specific files
.directory
Thumbs.db
desktop.ini
Desktop.ini
.DS_Store

# Temporary files
*.~swp
*.swp
*.tmp
*.bkp

# Python byte code
*.pyc
674 changes: 674 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<addon id="plugin.video.massengeschmack" name="Massengeschmack" version="0.1.0" provider-name="Manko10">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
</requires>
<extension point="xbmc.python.pluginsource" library="default.py">
<provides>video</provides>
</extension>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<language>en de</language>

<summary lang="en">Massengeschmack video portal</summary>
<summary lang="de">Massengeschmack-Video-Portal</summary>

<description lang="en">Massengeschmack is a German online video portal producing magazines like Fernsehkritik-TV, Pantoffel-TV and Pressesch(l)au.</description>
<description lang="de">Massengeschmack ist ein deutsches Online-Video-Portal, das Magazine wie Fernsehkritik-TV, Pantoffel-TV und Pressesch(l)au produziert.</description>

<disclaimer lang="en">This is not an official add-on and in no way affiliated with Massengeschmack</disclaimer>
<disclaimer lang="de">Dies ist kein offizielles Add-on und in keiner Weise an Massengeschmack angegliedert.</disclaimer>
</extension>
</addon>
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.1.0
- First testing release
46 changes: 46 additions & 0 deletions default.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
#
# Massengeschmack XBMC add-on
# Copyright (C) 2013 by Janek Bevendorff
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import xbmc
import xbmcgui
import xbmcaddon
import xbmcplugin
import urllib2

from globalvars import *
import resources.lib as lib

ok = True

# show warning and open settings if login data have not been configured or if the credentials are invalid
if '' == ADDON.getSetting('account.username').strip() or '' == ADDON.getSetting('account.password').strip():
dialog = xbmcgui.Dialog()
dialog.ok(ADDON.getLocalizedString(30100), ADDON.getLocalizedString(30101))
ok = False
elif not lib.probeLoginCrendentials(ADDON.getSetting('account.username'), ADDON.getSetting('account.password')):
dialog = xbmcgui.Dialog()
dialog.ok(ADDON.getLocalizedString(30102), ADDON.getLocalizedString(30103))
ok = False

if not ok:
ADDON.openSettings()
else:
xbmcplugin.endOfDirectory(ADDON_HANDLE)
xbmcplugin.setContent(ADDON_HANDLE, 'movies')
xbmc.executebuiltin('Container.SetViewMode(503)')

30 changes: 30 additions & 0 deletions globalvars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
#
# Massengeschmack XBMC add-on
# Copyright (C) 2013 by Janek Bevendorff
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import xbmcaddon
import sys

# globals
ADDON = xbmcaddon.Addon(id='plugin.video.massengeschmack')
ADDON_NAME = ADDON.getAddonInfo('name')
ADDON_ICON = ADDON.getAddonInfo('icon')
ADDON_VERSION = ADDON.getAddonInfo('version')
ADDON_HANDLE = int(sys.argv[1])

HTTP_USER_AGENT = 'Massengeschmack XBMC add-on v' + ADDON_VERSION
HTTP_BASE_URI = 'https://massengeschmack.tv/'
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions resources/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-

__all__ = [

]
20 changes: 20 additions & 0 deletions resources/language/English/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<!-- settings -->
<string id="30001">Account</string>
<string id="30002">Warning: Login credentials will not be saved in encrypted form!</string>
<string id="30003">Username</string>
<string id="30004">Password</string>

<string id="30050">Contents</string>
<string id="30051">Image Quality</string>
<string id="30052">HD (MP4/MOV)</string>
<string id="30053">Mobile (MP4)</string>
<string id="30054">Use audio version</string>

<string id="30100">No login data found!</string>
<string id="30101">You need to configure your login credentials[CR]before you can use this add-on.</string>
<string id="30102">Login failed!</string>
<string id="30103">Could not log into your Massengeschmack account,[CR]please check your login credentials!</string>
<string id="30104">Probing login data…</string>
</strings>
14 changes: 14 additions & 0 deletions resources/language/German/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings>
<!-- settings -->
<string id="30001">Konto</string>
<string id="30002">Warnung: Login-Daten werden nicht in verschlüsselter Form gespeichert!</string>
<string id="30003">Benutzername</string>
<string id="30004">Passwort</string>

<string id="30050">Inhalte</string>
<string id="30051">Bild-Qualität</string>
<string id="30052">HD (MP4/MOV)</string>
<string id="30053">Mobil (MP4)</string>
<string id="30054">Verwende Audio-Version</string>
</strings>
73 changes: 73 additions & 0 deletions resources/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
#
# Massengeschmack XBMC add-on
# Copyright (C) 2013 by Janek Bevendorff
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import xbmcgui
import urllib2

from globalvars import *
from resources.lib.listing import Listing
from resources.lib.datasource import DataSource

# helper functions

def openHTTPConnection(uri):
"""
Open an HTTP connection and return the connection handle.
@type uri: str
@param uri: the request URI
@return: urllib2 request handle
"""
request = urllib2.Request(uri)
request.add_header('User-Agent', HTTP_USER_AGENT)
return urllib2.urlopen(request)

def probeLoginCrendentials(username, password):
"""
Test if the given login credentials are correct by sending a test request
and install HTTP authentication handler.
@type username: str
@type password: str
@return: true if login was successful
"""

dialog = xbmcgui.DialogProgress()
dialog.create(ADDON.getLocalizedString(30104))

ok = False
passwordManager = urllib2.HTTPPasswordMgrWithDefaultRealm()
passwordManager.add_password(None, HTTP_BASE_URI, username, password)
authHandler = urllib2.HTTPBasicAuthHandler(passwordManager)
opener = urllib2.build_opener(authHandler)
urllib2.install_opener(opener)

dialog.update(50)

try:
handle = openHTTPConnection(HTTP_BASE_URI + 'feed/all/hd.xml')
except IOError, e:
print e
else:
handle.close()
ok = True

dialog.update(100)
del dialog

return ok
37 changes: 37 additions & 0 deletions resources/lib/datasource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
#
# Massengeschmack XBMC add-on
# Copyright (C) 2013 by Janek Bevendorff
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class DataSource:
def getListItems():
"""
Generate a list of ListeItem objects for the current data source.
@abstract
"""
raise NotImplementedError()


def createDataSource(magazine=''):
"""
Create a data source object based on the magazine name.
If left empty, an overview data source will be generated.
@type magazine: str
@keyword magazine: the magazine name (fktv, ptv, pschlau, mgtv, ...)
@return: DataSource instance
"""
return DataSource()
45 changes: 45 additions & 0 deletions resources/lib/listing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
#
# Massengeschmack XBMC add-on
# Copyright (C) 2013 by Janek Bevendorff
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class Listing:
def generate(self, source):
"""
Generate listing from data source.
@type source: DataSource
@param source: the data source object
"""
pass

def show():
"""
Show the listing after it has been generated.
"""
pass

def setViewMode(self, id):
"""
Set the view mode of the current listing.
@type id: int
@param id: the view mode ID from the current skin
"""
pass

def __addDir(self, name, url):
pass
13 changes: 13 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30001">
<setting label="30003" type="text" id="account.username" default="" />
<setting label="30004" type="text" id="account.password" option="hidden" default="" />
<setting label="30002" type="text" id="account.warning" default="" enable="false" />
</category>

<category label="30050">
<setting label="30051" type="enum" id="content.quality" lvalues="30052|30053" enable="eq(1,false)" default="0" />
<setting label="30054" type="bool" id="content.audioOnly" default="false" />
</category>
</settings>

0 comments on commit 99815c1

Please sign in to comment.