Skip to content

Commit

Permalink
Fix empty space when no timezone is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelarnauts committed Jan 25, 2021
1 parent 0b8f4e2 commit d2accdc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions resources/lib/modules/iptvsimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def write_epg(cls, epg):
def _construct_epg_program_xml(cls, item, channel):
""" Generate the XML for the EPG of a program. """
try:
start = dateutil.parser.parse(item.get('start')).strftime('%Y%m%d%H%M%S %z')
stop = dateutil.parser.parse(item.get('stop')).strftime('%Y%m%d%H%M%S %z')
start = dateutil.parser.parse(item.get('start')).strftime('%Y%m%d%H%M%S %z').rstrip()
stop = dateutil.parser.parse(item.get('stop')).strftime('%Y%m%d%H%M%S %z').rstrip()
title = item.get('title', '')

# Add an icon ourselves in Kodi 18
Expand Down
2 changes: 0 additions & 2 deletions tests/home/addons/plugin.video.example.two/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

import logging
import os
import sys
import tempfile

import xbmc
import xbmcplugin
Expand Down
13 changes: 7 additions & 6 deletions tests/home/addons/plugin.video.example/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def send_channels(): # pylint: disable=no-method-argument
def send_epg(): # pylint: disable=no-method-argument
"""Return JSON-EPG formatted information to IPTV Manager"""
now = datetime.datetime.now(tz=dateutil.tz.gettz('CET'))
now_notz = datetime.datetime.now()

epg = {
'channel1.com': [
Expand All @@ -107,17 +108,17 @@ def send_epg(): # pylint: disable=no-method-argument
],
'channel2.com': [
dict(
start=now.isoformat(),
stop=(now + datetime.timedelta(seconds=1800)).isoformat(),
title='This is a show 3',
start=now_notz.isoformat(),
stop=(now_notz + datetime.timedelta(seconds=1800)).isoformat(),
title='This is a show 3 (no timezone info)',
description='This is the description of the show 3',
image=None,
stream='plugin://plugin.video.example/play/something',
),
dict(
start=(now + datetime.timedelta(seconds=1800)).isoformat(),
stop=(now + datetime.timedelta(seconds=3600)).isoformat(),
title='This is a show 4',
start=(now_notz + datetime.timedelta(seconds=1800)).isoformat(),
stop=(now_notz + datetime.timedelta(seconds=3600)).isoformat(),
title='This is a show 4 (no timezone info)',
description='This is the description of the show 4',
image=None,
stream='plugin://plugin.video.example/play/something',
Expand Down

0 comments on commit d2accdc

Please sign in to comment.