Browse Source

Add nsfw option for Peertube only, YT api does not support it at the moment

develop
LecygneNoir 6 years ago
parent
commit
7c12bcbc31
3 changed files with 12 additions and 9 deletions
  1. +3
    -2
      README.md
  2. +1
    -1
      lib/pt_upload.py
  3. +8
    -6
      prismedia_upload.py

+ 3
- 2
README.md View File

@ -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

+ 1
- 1
lib/pt_upload.py View File

@ -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))
]

+ 8
- 6
prismedia_upload.py View File

@ -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)

Loading…
Cancel
Save