mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 13:36:35 +00:00
Merge pull request #769 from tcely/patch-3
Access `posix_epoch` correctly
This commit is contained in:
commit
8738e65bce
@ -1018,7 +1018,7 @@ class Media(models.Model):
|
||||
data = json.loads(self.metadata or "{}")
|
||||
if '_reduce_data_ran_at' in data.keys():
|
||||
total_seconds = data['_reduce_data_ran_at']
|
||||
ran_at = posix_epoch + timedelta(seconds=total_seconds)
|
||||
ran_at = self.posix_epoch + timedelta(seconds=total_seconds)
|
||||
if (timezone.now() - ran_at) < timedelta(hours=1):
|
||||
return data
|
||||
|
||||
@ -1132,7 +1132,7 @@ class Media(models.Model):
|
||||
if timestamp is not None:
|
||||
try:
|
||||
timestamp_float = float(timestamp)
|
||||
published_dt = posix_epoch + timedelta(seconds=timestamp_float)
|
||||
published_dt = self.posix_epoch + timedelta(seconds=timestamp_float)
|
||||
except Exception as e:
|
||||
log.warn(f'Could not compute published from timestamp for: {self.source} / {self} with "{e}"')
|
||||
return published_dt
|
||||
|
Loading…
Reference in New Issue
Block a user