|
|
@ -37,8 +37,7 @@ Options: |
|
|
|
--originalDate=DATE Configure the video as initially recorded at DATE |
|
|
|
DATE should be on the form YYYY-MM-DDThh:mm:ss eg: 2018-03-12T19:00:00 |
|
|
|
DATE should be in the past |
|
|
|
Default use the last modification date of the file. |
|
|
|
--no-originalDate Do not set the initial record field when uploading |
|
|
|
--auto-originalDate Automatically use the file modification time as original date |
|
|
|
--thumbnail=STRING Path to a file to use as a thumbnail for the video. |
|
|
|
Supported types are jpg and jpeg. |
|
|
|
By default, prismedia search for an image based on video name followed by .jpg or .jpeg |
|
|
@ -76,6 +75,7 @@ Strict options: |
|
|
|
--withTags Prevent the upload without tags |
|
|
|
--withPlaylist Prevent the upload if no playlist |
|
|
|
--withPublishAt Prevent the upload if no schedule |
|
|
|
--withOriginalDate Prevent the upload if no original date configured |
|
|
|
--withPlatform Prevent the upload if at least one platform is not specified |
|
|
|
--withCategory Prevent the upload if no category |
|
|
|
--withLanguage Prevent upload if no language |
|
|
@ -208,7 +208,7 @@ def validatePublishDate(publishDate): |
|
|
|
|
|
|
|
|
|
|
|
def validateOriginalDate(originalDate): |
|
|
|
# Check date format and if date is future |
|
|
|
# Check date format and if date is past |
|
|
|
try: |
|
|
|
now = datetime.datetime.now() |
|
|
|
originalDate = datetime.datetime.strptime(originalDate, '%Y-%m-%dT%H:%M:%S') |
|
|
@ -234,6 +234,7 @@ def validateLogLevel(loglevel): |
|
|
|
return False |
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
def _optionnalOrStrict(key, scope, error): |
|
|
|
option = key.replace('-', '') |
|
|
|
option = option[0].upper() + option[1:] |
|
|
@ -297,6 +298,7 @@ def main(): |
|
|
|
Optional('--withTags', default=False): bool, |
|
|
|
Optional('--withPlaylist', default=False): bool, |
|
|
|
Optional('--withPublishAt', default=False): bool, |
|
|
|
Optional('--withOriginalDate', default=False): bool, |
|
|
|
Optional('--withPlatform', default=False): bool, |
|
|
|
Optional('--withCategory', default=False): bool, |
|
|
|
Optional('--withLanguage', default=False): bool, |
|
|
@ -315,6 +317,7 @@ def main(): |
|
|
|
Hook('--language', handler=_optionnalOrStrict): object, |
|
|
|
Hook('--platform', handler=_optionnalOrStrict): object, |
|
|
|
Hook('--publishAt', handler=_optionnalOrStrict): object, |
|
|
|
Hook('--originalDate', handler=_optionnalOrStrict): object, |
|
|
|
Hook('--thumbnail', handler=_optionnalOrStrict): object, |
|
|
|
Hook('--channel', handler=_optionnalOrStrict): object, |
|
|
|
Hook('--playlist', handler=_optionnalOrStrict): object, |
|
|
@ -371,7 +374,7 @@ def main(): |
|
|
|
validateOriginalDate, |
|
|
|
error="Original date should be the form YYYY-MM-DDThh:mm:ss and has to be in the past") |
|
|
|
), |
|
|
|
Optional('--no-originalDate'): bool, |
|
|
|
Optional('--auto-originalDate'): bool, |
|
|
|
Optional('--cca'): bool, |
|
|
|
Optional('--disable-comments'): bool, |
|
|
|
Optional('--nsfw'): bool, |
|
|
@ -400,6 +403,12 @@ def main(): |
|
|
|
|
|
|
|
options = utils.parseNFO(options) |
|
|
|
|
|
|
|
# If after loading NFO we still has no original date and --auto-originalDate is enabled, |
|
|
|
# then we need to search from the file |
|
|
|
# We need to do that before the strict validation in case --withOriginalDate is enabled |
|
|
|
if not options.get('--originalDate') and options.get('--auto-originalDate'): |
|
|
|
options['--originalDate'] = utils.searchOriginalDate(options) |
|
|
|
|
|
|
|
# Once NFO are loaded, we need to revalidate strict options in case some were in NFO |
|
|
|
try: |
|
|
|
options = earlyoptionSchema.validate(options) |
|
|
@ -410,11 +419,6 @@ def main(): |
|
|
|
if not options.get('--thumbnail'): |
|
|
|
options = utils.searchThumbnail(options) |
|
|
|
|
|
|
|
# If after loading NFO we still has no original date and --no-originalDate is not enabled, |
|
|
|
# then we need to search from the file |
|
|
|
if not options.get('--originalDate') and not options.get('--no-originalDate'): |
|
|
|
options['--originalDate'] = utils.searchOriginalDate(options) |
|
|
|
|
|
|
|
try: |
|
|
|
options = schema.validate(options) |
|
|
|
except SchemaError as e: |
|
|
|