Browse Source

Add new feature to schedule different publication date depending of the platform. Target v0.9.0, Fix #43

pull/46/head
LecygneNoir 4 years ago
parent
commit
429ea2333e
6 changed files with 37 additions and 4 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +2
    -0
      README.md
  3. +6
    -1
      lib/pt_upload.py
  4. +8
    -2
      lib/yt_upload.py
  5. +4
    -1
      nfo_example.txt
  6. +12
    -0
      prismedia_upload.py

+ 5
- 0
CHANGELOG.md View File

@ -1,5 +1,10 @@
# Changelog # 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 ## v0.8.0
### Breaking changes ### Breaking changes

+ 2
- 0
README.md View File

@ -112,6 +112,8 @@ Options:
--publishAt=DATE Publish the video at the given DATE using local server timezone. --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 on the form YYYY-MM-DDThh:mm:ss eg: 2018-03-12T19:00:00
DATE should be in the future 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. --thumbnail=STRING Path to a file to use as a thumbnail for the video.
Supported types are jpg and jpeg. Supported types are jpg and jpeg.
By default, prismedia search for an image based on video name followed by .jpg or .jpeg By default, prismedia search for an image based on video name followed by .jpg or .jpeg

+ 6
- 1
lib/pt_upload.py View File

@ -230,8 +230,13 @@ def upload_video(oauth, secret, options):
if options.get('--privacy'): if options.get('--privacy'):
privacy = options.get('--privacy').lower() 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') publishAt = options.get('--publishAt')
if 'publishAt' in locals():
publishAt = datetime.datetime.strptime(publishAt, '%Y-%m-%dT%H:%M:%S') publishAt = datetime.datetime.strptime(publishAt, '%Y-%m-%dT%H:%M:%S')
tz = get_localzone() tz = get_localzone()
tz = pytz.timezone(str(tz)) tz = pytz.timezone(str(tz))

+ 8
- 2
lib/yt_upload.py View File

@ -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 # 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') publishAt = datetime.datetime.strptime(publishAt, '%Y-%m-%dT%H:%M:%S.%f')
tz = get_localzone() tz = get_localzone()
tz = pytz.timezone(str(tz)) tz = pytz.timezone(str(tz))

+ 4
- 1
nfo_example.txt View File

@ -24,4 +24,7 @@ playlistCreate = True
nsfw = False nsfw = False
platform = youtube, peertube platform = youtube, peertube
language = French language = French
publishAt=2034-05-07T19:00:00
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

+ 12
- 0
prismedia_upload.py View File

@ -33,6 +33,8 @@ Options:
--publishAt=DATE Publish the video at the given DATE using local server timezone. --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 on the form YYYY-MM-DDThh:mm:ss eg: 2018-03-12T19:00:00
DATE should be in the future 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. --thumbnail=STRING Path to a file to use as a thumbnail for the video.
Supported types are jpg and jpeg. Supported types are jpg and jpeg.
By default, prismedia search for an image based on video name followed by .jpg or .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, validatePublish,
error="DATE should be the form YYYY-MM-DDThh:mm:ss and has to be in the future") 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('--debug'): bool,
Optional('--cca'): bool, Optional('--cca'): bool,
Optional('--disable-comments'): bool, Optional('--disable-comments'): bool,

Loading…
Cancel
Save