mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-20 12:06:35 +00:00
UseMedia.metadata_published
It does the same operation, but has logging too.
This commit is contained in:
parent
3411bac78a
commit
b8503fd9e9
@ -1,5 +1,4 @@
|
||||
import os
|
||||
from datetime import timedelta
|
||||
from pathlib import Path
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from common.logger import log
|
||||
@ -56,11 +55,13 @@ class Command(BaseCommand):
|
||||
item.downloaded = True
|
||||
item.downloaded_filesize = Path(filepath).stat().st_size
|
||||
# set a reasonable download date
|
||||
date = item.posix_epoch + timedelta(seconds=Path(filepath).stat().st_mtime)
|
||||
date = item.metadata_published(Path(filepath).stat().st_mtime)
|
||||
if item.published and item.published > date:
|
||||
date = item.published
|
||||
if item.has_metadata:
|
||||
metadata_date = item.posix_epoch + timedelta(seconds=item.loaded_metadata.get('epoch', 0))
|
||||
# TODO: switch to the newer function when it is merged from PR 807
|
||||
# item.get_metadata_first_value('epoch', 0)
|
||||
metadata_date = item.metadata_published(item.loaded_metadata.get('epoch', 0))
|
||||
if metadata_date and metadata_date > date:
|
||||
date = metadata_date
|
||||
if item.download_date and item.download_date > date:
|
||||
|
Loading…
Reference in New Issue
Block a user