Get rid of Python arrow; hopefully fix many Python import errors (also occuring in other add-ons!)
This commit is contained in:
parent
7787a47026
commit
8d2b3ac1af
3 changed files with 30 additions and 30 deletions
|
@ -7,7 +7,6 @@
|
||||||
<import addon="plugin.video.plexkodiconnect.movies" version="3.0.0" />
|
<import addon="plugin.video.plexkodiconnect.movies" version="3.0.0" />
|
||||||
<import addon="plugin.video.plexkodiconnect.tvshows" version="3.0.0" />
|
<import addon="plugin.video.plexkodiconnect.tvshows" version="3.0.0" />
|
||||||
<import addon="metadata.themoviedb.org.python" version="1.3.1+matrix.1" />
|
<import addon="metadata.themoviedb.org.python" version="1.3.1+matrix.1" />
|
||||||
<import addon="script.module.arrow" version="0.15.5"/>
|
|
||||||
</requires>
|
</requires>
|
||||||
<extension point="xbmc.python.pluginsource" library="default.py">
|
<extension point="xbmc.python.pluginsource" library="default.py">
|
||||||
<provides>video audio image</provides>
|
<provides>video audio image</provides>
|
||||||
|
|
|
@ -9,7 +9,6 @@ from datetime import datetime
|
||||||
from unicodedata import normalize
|
from unicodedata import normalize
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
import urllib
|
import urllib
|
||||||
import arrow
|
|
||||||
# Originally tried faster cElementTree, but does NOT work reliably with Kodi
|
# Originally tried faster cElementTree, but does NOT work reliably with Kodi
|
||||||
# etree parse unsafe; make sure we're always receiving unicode
|
# etree parse unsafe; make sure we're always receiving unicode
|
||||||
from . import defused_etree as etree
|
from . import defused_etree as etree
|
||||||
|
@ -632,19 +631,22 @@ def indent(elem, level=0):
|
||||||
LOG.info('Indentation failed with: %s', err)
|
LOG.info('Indentation failed with: %s', err)
|
||||||
|
|
||||||
|
|
||||||
def localdate_from_utc_string(timestring):
|
# Python's arrow library is broken for Kodi
|
||||||
"""helper to convert internal utc time (used in pvr) to local timezone"""
|
# Importing from several Python instances is faulty :-(
|
||||||
utc_datetime = arrow.get(timestring)
|
|
||||||
local_datetime = utc_datetime.to('local')
|
# def localdate_from_utc_string(timestring):
|
||||||
return local_datetime.format("YYYY-MM-DD HH:mm:ss")
|
# """helper to convert internal utc time (used in pvr) to local timezone"""
|
||||||
|
# utc_datetime = arrow.get(timestring)
|
||||||
|
# local_datetime = utc_datetime.to('local')
|
||||||
|
# return local_datetime.format("YYYY-MM-DD HH:mm:ss")
|
||||||
|
|
||||||
|
|
||||||
def localized_date_time(timestring):
|
# def localized_date_time(timestring):
|
||||||
"""returns localized version of the timestring (used in pvr)"""
|
# """returns localized version of the timestring (used in pvr)"""
|
||||||
date_time = arrow.get(timestring)
|
# date_time = arrow.get(timestring)
|
||||||
local_date = date_time.strftime(xbmc.getRegion("dateshort"))
|
# local_date = date_time.strftime(xbmc.getRegion("dateshort"))
|
||||||
local_time = date_time.strftime(xbmc.getRegion("time").replace(":%S", ""))
|
# local_time = date_time.strftime(xbmc.getRegion("time").replace(":%S", ""))
|
||||||
return local_date, local_time
|
# return local_date, local_time
|
||||||
|
|
||||||
|
|
||||||
class XmlKodiSetting(object):
|
class XmlKodiSetting(object):
|
||||||
|
|
|
@ -7,7 +7,6 @@ Loads of different functions called in SEPARATE Python instances through
|
||||||
e.g. plugin://... calls. Hence be careful to only rely on window variables.
|
e.g. plugin://... calls. Hence be careful to only rely on window variables.
|
||||||
"""
|
"""
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
import arrow
|
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
|
@ -387,22 +386,22 @@ def prepare_listitem(item):
|
||||||
properties["Album_Description"] = item.get('album_description')
|
properties["Album_Description"] = item.get('album_description')
|
||||||
|
|
||||||
# pvr properties
|
# pvr properties
|
||||||
if "starttime" in item:
|
# if "starttime" in item:
|
||||||
# convert utc time to local time
|
# # convert utc time to local time
|
||||||
item["starttime"] = utils.localdate_from_utc_string(item["starttime"])
|
# item["starttime"] = utils.localdate_from_utc_string(item["starttime"])
|
||||||
item["endtime"] = utils.localdate_from_utc_string(item["endtime"])
|
# item["endtime"] = utils.localdate_from_utc_string(item["endtime"])
|
||||||
# set localized versions of the time and date as additional props
|
# # set localized versions of the time and date as additional props
|
||||||
startdate, starttime = utils.localized_date_time(item['starttime'])
|
# startdate, starttime = utils.localized_date_time(item['starttime'])
|
||||||
enddate, endtime = utils.localized_date_time(item['endtime'])
|
# enddate, endtime = utils.localized_date_time(item['endtime'])
|
||||||
properties["StartTime"] = starttime
|
# properties["StartTime"] = starttime
|
||||||
properties["StartDate"] = startdate
|
# properties["StartDate"] = startdate
|
||||||
properties["EndTime"] = endtime
|
# properties["EndTime"] = endtime
|
||||||
properties["EndDate"] = enddate
|
# properties["EndDate"] = enddate
|
||||||
properties["Date"] = "%s %s-%s" % (startdate, starttime, endtime)
|
# properties["Date"] = "%s %s-%s" % (startdate, starttime, endtime)
|
||||||
properties["StartDateTime"] = "%s %s" % (startdate, starttime)
|
# properties["StartDateTime"] = "%s %s" % (startdate, starttime)
|
||||||
properties["EndDateTime"] = "%s %s" % (enddate, endtime)
|
# properties["EndDateTime"] = "%s %s" % (enddate, endtime)
|
||||||
# set date to startdate
|
# # set date to startdate
|
||||||
item["date"] = arrow.get(item["starttime"]).format("DD.MM.YYYY")
|
# item["date"] = arrow.get(item["starttime"]).format("DD.MM.YYYY")
|
||||||
if "channellogo" in item:
|
if "channellogo" in item:
|
||||||
properties["channellogo"] = item["channellogo"]
|
properties["channellogo"] = item["channellogo"]
|
||||||
properties["channelicon"] = item["channellogo"]
|
properties["channelicon"] = item["channellogo"]
|
||||||
|
|
Loading…
Reference in a new issue