Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typing docstrings #85

Merged
merged 2 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ disable=
duplicate-code,
fixme,
import-error,
import-outside-toplevel,
invalid-name,
line-too-long,
missing-docstring,
Expand Down
2 changes: 0 additions & 2 deletions resources/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, unicode_literals

YOUTUBE = [
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/kodilogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def flush(self):
pass


def getLogger(name=None):
def get_logger(name=None):
logger = logging.getLogger(name)
logger.addHandler(KodiLogHandler())
logger.setLevel(log_levels.get(get_setting('max_log_level', 'Info'), logging.NOTSET))
Expand Down
33 changes: 19 additions & 14 deletions resources/lib/plugin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, unicode_literals

import routing
import xbmcplugin
from xbmc import Keyboard
from xbmc import Keyboard, getRegion
from xbmcgui import Dialog, ListItem

from resources.lib import kodilogging
from resources.lib.kodiutils import (get_cond_visibility, get_max_bandwidth, get_setting,
get_setting_as_bool, get_global_setting, localize,
notification, show_ok_dialog, show_settings)
Expand All @@ -15,6 +15,7 @@
from resources.lib.vtmgostream import VtmGoStream

plugin = routing.Plugin()
logger = kodilogging.get_logger()


@plugin.route('/kids')
Expand Down Expand Up @@ -218,13 +219,15 @@ def show_tvguide():
def show_tvguide_channel(channel):
listing = []

for day in VtmGoEpg.get_dates():
if day['highlight']:
title = '[B]%s[/B]'
date_format = getRegion('datelong')

for day in VtmGoEpg.get_dates(date_format):
if day.get('highlight'):
title = '[B]%s[/B]' % day.get('title')
else:
title = '%s'
title = day.get('title')

listitem = ListItem(title % day.get('title'), offscreen=True)
listitem = ListItem(title, offscreen=True)
listitem.setArt({
'icon': 'DefaultYear.png',
})
Expand All @@ -245,18 +248,20 @@ def show_tvguide_channel(channel):

@plugin.route('/tvguide/<channel>/<date>')
def show_tvguide_detail(channel=None, date=None):
""" Shows the programs of a specific date in the tv guide.
:type channel: string
:type date: string
"""
try:
_vtmGoEpg = VtmGoEpg()
epg = _vtmGoEpg.get_epg(date=date)
epg = _vtmGoEpg.get_epg(channel=channel, date=date)
except Exception as ex:
notification(message=str(ex))
raise

# The epg contains the data for all channels. We only need the data of the requested channel.
epg_json = epg.get(channel)

listing = []
for broadcast in epg_json.broadcasts:
for broadcast in epg.broadcasts:
title = '{time} - {title}'.format(
time=broadcast.time.strftime('%H:%M'),
title=broadcast.title
Expand Down Expand Up @@ -406,7 +411,7 @@ def show_program(program, season=None):
notification(message=str(ex))
raise

seasons = program_obj.seasons.values()
seasons = program_obj.seasons

listing = []

Expand All @@ -429,7 +434,7 @@ def show_program(program, season=None):
})
listing.append((plugin.url_for(show_program, program=program, season='all'), listitem, True))

for s in program_obj.seasons.values():
for s in program_obj.seasons:
listitem = ListItem(localize(30205, season=s.number), offscreen=True) # Season X
listitem.setArt({
'thumb': s.cover,
Expand Down Expand Up @@ -458,7 +463,7 @@ def show_program(program, season=None):
seasons = [program_obj.seasons[int(season)]]

for s in seasons:
for episode in s.episodes.values():
for episode in s.episodes:
listitem = ListItem(episode.name, offscreen=True)
listitem.setArt({
'banner': program_obj.cover,
Expand Down
Loading