Merge branch 'jellyfin:master' into master

This commit is contained in:
GregoireDruant 2023-12-16 15:17:26 +01:00 committed by GitHub
commit 68b3e8d75b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 32 deletions

View file

@ -474,14 +474,14 @@ def split_list(itemlist, size):
return [itemlist[i:i + size] for i in range(0, len(itemlist), size)]
def convert_to_local(date):
def convert_to_local(date, timezone=tz.tzlocal()):
''' Convert the local datetime to local.
'''
try:
date = parser.parse(date) if isinstance(date, string_types) else date
date = date.replace(tzinfo=tz.tzutc())
date = date.astimezone(tz.tzlocal())
date = date.astimezone(timezone)
# Bad metadata defaults to date 1-1-1. Catch it and don't throw errors
if date.year < 1900:
# FIXME(py2): strftime don't like dates below 1900