1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

Added broadcast/publishing datetime to metadata extraction and NFO file creation.

This commit is contained in:
Harald Gustafsson 2018-08-10 13:09:47 +02:00 committed by Johan Andersson
parent 4388e57112
commit 073f26e618
3 changed files with 8 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class Service(object):
"id": None, "service": self.__class__.__name__.lower(),
"tvshow": None, "title_nice": None, "showdescription": None,
"episodedescription": None, "showthumbnailurl": None,
"episodethumbnailurl": None}
"episodethumbnailurl": None, "publishing_datetime": None}
if not http:
self.http = HTTP(config)
else:

View File

@ -271,6 +271,10 @@ class Svtplay(Service, MetadataThumbMixin):
def extrametadata(self, data):
self.output["tvshow"] = (self.output["season"] is not None and
self.output["episode"] is not None)
try:
self.output["publishing_datetime"] = data["video"]["broadcastDate"] / 1000
except KeyError:
pass
try:
title = data["video"]["programTitle"]
self.output["title_nice"] = title

View File

@ -3,6 +3,7 @@ import logging
import xml.etree.ElementTree as ET
from svtplay_dl.utils.output import formatname
from svtplay_dl.utils.parser import Options
from datetime import datetime
def write_nfo_episode(output, config):
@ -12,6 +13,8 @@ def write_nfo_episode(output, config):
ET.SubElement(root, "season").text = output["season"]
ET.SubElement(root, "episode").text = output["episode"]
ET.SubElement(root, "plot").text = output["showdescription"]
if output["publishing_datetime"] is not None:
ET.SubElement(root, "aired").text = datetime.fromtimestamp(output["publishing_datetime"]).isoformat()
if not config.get("thumbnail"):
# Set the thumbnail path to download link if not thumbnail downloaded
ET.SubElement(root, "thumb").text = output["showthumbnailurl"]