mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Prep convert to local time
This commit is contained in:
parent
47f7d99954
commit
358a029700
2 changed files with 18 additions and 0 deletions
|
@ -16,6 +16,7 @@ from utils import write_xml
|
||||||
from utils import compare_version
|
from utils import compare_version
|
||||||
from utils import unzip
|
from utils import unzip
|
||||||
from utils import create_id
|
from utils import create_id
|
||||||
|
from utils import convert_to_local as Local
|
||||||
|
|
||||||
from wrapper import progress
|
from wrapper import progress
|
||||||
from wrapper import catch
|
from wrapper import catch
|
||||||
|
|
|
@ -17,6 +17,7 @@ import xbmcgui
|
||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
|
|
||||||
from . import _
|
from . import _
|
||||||
|
from libraries.dateutil import tz, parser
|
||||||
|
|
||||||
#################################################################################################
|
#################################################################################################
|
||||||
|
|
||||||
|
@ -444,3 +445,19 @@ def split_list(itemlist, size):
|
||||||
''' Split up list in pieces of size. Will generate a list of lists
|
''' Split up list in pieces of size. Will generate a list of lists
|
||||||
'''
|
'''
|
||||||
return [itemlist[i:i+size] for i in range(0, len(itemlist), size)]
|
return [itemlist[i:i+size] for i in range(0, len(itemlist), size)]
|
||||||
|
|
||||||
|
def convert_to_local(date):
|
||||||
|
|
||||||
|
''' Convert the local datetime to local.
|
||||||
|
'''
|
||||||
|
date = convert_str_to_date(date) if type(date) in (unicode, str) else date
|
||||||
|
date = date.replace(tzinfo=tz.tzutc())
|
||||||
|
date = date.astimezone(tz.tzlocal())
|
||||||
|
|
||||||
|
return date.strftime('%Y-%m-%dT%H:%M:%S')
|
||||||
|
|
||||||
|
def convert_str_to_date(date):
|
||||||
|
|
||||||
|
''' Convert string to date.
|
||||||
|
'''
|
||||||
|
return parser.parse(date)
|
||||||
|
|
Loading…
Reference in a new issue