diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4d2a8..f7bb84c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v0.8.1 + +### Features + - Add two new options to schedule video by platform. You may now use youtubeAt and peertubeAt to prepare previews + ## v0.8.0 ### Breaking changes diff --git a/README.md b/README.md index 2c9accc..04aaa49 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,8 @@ Options: --publishAt=DATE Publish the video at the given DATE using local server timezone. DATE should be on the form YYYY-MM-DDThh:mm:ss eg: 2018-03-12T19:00:00 DATE should be in the future + --peertubeAt=DATE + --youtubeAt=DATE Override publishAt for the corresponding platform. Allow to create preview on specific platform --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 diff --git a/lib/pt_upload.py b/lib/pt_upload.py index 4701844..ee5f78c 100644 --- a/lib/pt_upload.py +++ b/lib/pt_upload.py @@ -230,8 +230,13 @@ def upload_video(oauth, secret, options): if options.get('--privacy'): privacy = options.get('--privacy').lower() - if options.get('--publishAt'): + # If peertubeAt exists, use instead of publishAt + if options.get('--peertubeAt'): + publishAt = options.get('--peertubeAt') + elif options.get('--publishAt'): publishAt = options.get('--publishAt') + + if 'publishAt' in locals(): publishAt = datetime.datetime.strptime(publishAt, '%Y-%m-%dT%H:%M:%S') tz = get_localzone() tz = pytz.timezone(str(tz)) diff --git a/lib/yt_upload.py b/lib/yt_upload.py index c618a6f..5c10b2f 100644 --- a/lib/yt_upload.py +++ b/lib/yt_upload.py @@ -124,9 +124,15 @@ def initialize_upload(youtube, options): } } - if options.get('--publishAt'): + # If peertubeAt exists, use instead of publishAt + if options.get('--youtubeAt'): + publishAt = options.get('--youtubeAt') + elif options.get('--publishAt'): + publishAt = options.get('--publishAt') + + if 'publishAt' in locals(): # Youtube needs microsecond and the local timezone from ISO 8601 - publishAt = options.get('--publishAt') + ".000001" + publishAt = publishAt + ".000001" publishAt = datetime.datetime.strptime(publishAt, '%Y-%m-%dT%H:%M:%S.%f') tz = get_localzone() tz = pytz.timezone(str(tz)) diff --git a/nfo_example.txt b/nfo_example.txt index 4564d8a..a6c537d 100644 --- a/nfo_example.txt +++ b/nfo_example.txt @@ -24,4 +24,7 @@ playlistCreate = True nsfw = False platform = youtube, peertube language = French -publishAt=2034-05-07T19:00:00 \ No newline at end of file +publishAt=2034-05-07T19:00:00 +# platformAt overrides the default publishAt for the corresponding platform +#peertubeAt = 2034-05-14T19:00:00 +#youtubeAt = 2034-05-21T19:00:00 \ No newline at end of file diff --git a/prismedia_upload.py b/prismedia_upload.py index 02b9bb8..d36b3ed 100755 --- a/prismedia_upload.py +++ b/prismedia_upload.py @@ -33,6 +33,8 @@ Options: --publishAt=DATE Publish the video at the given DATE using local server timezone. DATE should be on the form YYYY-MM-DDThh:mm:ss eg: 2018-03-12T19:00:00 DATE should be in the future + --peertubeAt=DATE + --youtubeAt=DATE Override publishAt for the corresponding platform. Allow to create preview on specific platform --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 @@ -208,6 +210,16 @@ if __name__ == '__main__': validatePublish, error="DATE should be the form YYYY-MM-DDThh:mm:ss and has to be in the future") ), + Optional('--peertubeAt'): Or(None, And( + str, + validatePublish, + error="DATE should be the form YYYY-MM-DDThh:mm:ss and has to be in the future") + ), + Optional('--youtubeAt'): Or(None, And( + str, + validatePublish, + error="DATE should be the form YYYY-MM-DDThh:mm:ss and has to be in the future") + ), Optional('--debug'): bool, Optional('--cca'): bool, Optional('--disable-comments'): bool,