diff --git a/README.md b/README.md index d485118..14f3ea1 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Options: --cca License should be CreativeCommon Attribution (affects Youtube upload only) -p, --privacy=STRING Choose between public, unlisted or private. [default: private] --disable-comments Disable comments (Peertube only) [default: comments are enabled] + --nsfw Set the video as NSFW (Peertube only as YT API does not support) [default: video is not restricted] -h --help Show this help. --version Show version. @@ -58,8 +59,8 @@ Categories: - [x] categories - [x] license: cca or not, affect only Youtube as Peertube uses Attribution by design - [x] privacy (between public, unlisted or private) - - [x] enabling/disabling comment (Peertube only as Youtube API has no option for that) - - [ ] nsfw + - [x] enabling/disabling comment (Peertube only as Youtube API does not support it) + - [x] nsfw (Peertube only as Youtube API does not support it) - [ ] thumbnail/preview - [ ] Use a config file (NFO) file to retrieve videos arguments - [ ] Record and forget: put the video in a directory, and the script uploads it for you diff --git a/lib/pt_upload.py b/lib/pt_upload.py index 1829fd8..383671e 100644 --- a/lib/pt_upload.py +++ b/lib/pt_upload.py @@ -64,7 +64,7 @@ def upload_video(oauth, config, options): ("licence", "1"), ("description", options.get('--description') or "default description"), # look at the list numbers at /videos/privacies - ("nsfw", "0"), + ("nsfw", str(int(options.get('--nsfw')) or "0")), ("channelId", get_userinfo()), ("videofile", get_videofile(path)) ] diff --git a/prismedia_upload.py b/prismedia_upload.py index 4f1d5ab..5c50f46 100755 --- a/prismedia_upload.py +++ b/prismedia_upload.py @@ -10,13 +10,14 @@ Usage: prismedia_upload.py --version Options: - --name=NAME Name of the video to upload. [default: video filename] + --name=NAME Name of the video to upload. (default to video filename) -d, --description=STRING Description of the video. [default: default description] -t, --tags=STRING Tags for the video. comma separated - -c, --category=STRING Category for the videos, see below. [ default: Films] + -c, --category=STRING Category for the videos, see below. [default: Films] --cca License should be CreativeCommon Attribution (affects Youtube upload only) -p, --privacy=STRING Choose between public, unlisted or private. [default: private] - --disable-comments Disable comments (Peertube only) [default: comments are enabled] + --disable-comments Disable comments (Peertube only as YT API does not support) [default: comments are enabled] + --nsfw Set the video as NSFW (Peertube only as YT API does not support) [default: video is not restricted] -h --help Show this help. --version Show version. @@ -44,13 +45,13 @@ import pt_upload try: from schema import Schema, And, Or, Optional, SchemaError except ImportError: - exit('This program requires that the `schema` data-validation library' + e('This program requires that the `schema` data-validation library' ' is installed: \n' 'see https://github.com/halst/schema\n') try: import magic except ImportError: - exit('This program requires that the `python-magic` library' + e('This program requires that the `python-magic` library' ' is installed, NOT the Python bindings to libmagic API \n' 'see https://github.com/ahupp/python-magic\n') @@ -97,6 +98,7 @@ if __name__ == '__main__': Optional('--privacy'): Or(None, And(str, validatePrivacy, error="Please use recognized privacy between public, unlisted or private")), Optional('--cca'): bool, Optional('--disable-comments'): bool, + Optional('--nsfw'): bool, '--help': bool, '--version': bool }) @@ -104,7 +106,7 @@ if __name__ == '__main__': try: options = schema.validate(options) except SchemaError as e: - exit(e) + e(e) # yt_upload.run(options) pt_upload.run(options)