|
@ -23,6 +23,7 @@ Options: |
|
|
See nfo_example.txt for more details |
|
|
See nfo_example.txt for more details |
|
|
--platform=STRING List of platform(s) to upload to, comma separated. |
|
|
--platform=STRING List of platform(s) to upload to, comma separated. |
|
|
Supported platforms are youtube and peertube (default is both) |
|
|
Supported platforms are youtube and peertube (default is both) |
|
|
|
|
|
--language=STRING Specify the default language for video. See below for supported language. (default is English) |
|
|
-h --help Show this help. |
|
|
-h --help Show this help. |
|
|
--version Show version. |
|
|
--version Show version. |
|
|
|
|
|
|
|
@ -34,6 +35,13 @@ Categories: |
|
|
comedy, entertainment, news, |
|
|
comedy, entertainment, news, |
|
|
how to, education, activism, science & technology, |
|
|
how to, education, activism, science & technology, |
|
|
science, technology, animals |
|
|
science, technology, animals |
|
|
|
|
|
|
|
|
|
|
|
Languages: |
|
|
|
|
|
Language of the video (audio track), choose one. Default is English |
|
|
|
|
|
Here are available languages from Peertube and Youtube: |
|
|
|
|
|
Arabic, English, French, German, Hindi, Italian, |
|
|
|
|
|
Japanese, Korean, Mandarin, Portuguese, Punjabi, Russian, Spanish |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
from os.path import dirname, realpath |
|
|
from os.path import dirname, realpath |
|
|
import sys |
|
|
import sys |
|
@ -64,6 +72,7 @@ except ImportError: |
|
|
'see https://github.com/ahupp/python-magic\n') |
|
|
'see https://github.com/ahupp/python-magic\n') |
|
|
|
|
|
|
|
|
VERSION = "prismedia v0.3" |
|
|
VERSION = "prismedia v0.3" |
|
|
|
|
|
|
|
|
VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted') |
|
|
VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted') |
|
|
VALID_CATEGORIES = ( |
|
|
VALID_CATEGORIES = ( |
|
|
"music", "films", "vehicles", |
|
|
"music", "films", "vehicles", |
|
@ -73,6 +82,10 @@ VALID_CATEGORIES = ( |
|
|
"science", "technology", "animals" |
|
|
"science", "technology", "animals" |
|
|
) |
|
|
) |
|
|
VALID_PLATFORM = ('youtube', 'peertube') |
|
|
VALID_PLATFORM = ('youtube', 'peertube') |
|
|
|
|
|
VALID_LANGUAGES = ('arabic', 'english', 'french', |
|
|
|
|
|
'german', 'hindi', 'italian', |
|
|
|
|
|
'japanese', 'korean', 'mandarin', |
|
|
|
|
|
'portuguese', 'punjabi', 'russian', 'spanish') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def validateVideo(path): |
|
|
def validateVideo(path): |
|
@ -99,12 +112,19 @@ def validatePrivacy(privacy): |
|
|
|
|
|
|
|
|
def validatePlatform(platform): |
|
|
def validatePlatform(platform): |
|
|
for plfrm in platform.split(','): |
|
|
for plfrm in platform.split(','): |
|
|
if plfrm not in VALID_PLATFORM: |
|
|
|
|
|
|
|
|
if plfrm.lower().replace(" ", "") not in VALID_PLATFORM: |
|
|
return False |
|
|
return False |
|
|
|
|
|
|
|
|
return True |
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def validateLanguage(language): |
|
|
|
|
|
if language.lower() in VALID_LANGUAGES: |
|
|
|
|
|
return True |
|
|
|
|
|
else: |
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
|
|
|
|
|
|
options = docopt(__doc__, version=VERSION) |
|
|
options = docopt(__doc__, version=VERSION) |
|
@ -131,6 +151,11 @@ if __name__ == '__main__': |
|
|
validateCategory, |
|
|
validateCategory, |
|
|
error="Category not recognized, please see --help") |
|
|
error="Category not recognized, please see --help") |
|
|
), |
|
|
), |
|
|
|
|
|
Optional('--language'): Or(None, And( |
|
|
|
|
|
str, |
|
|
|
|
|
validateLanguage, |
|
|
|
|
|
error="Language not recognized, please see --help") |
|
|
|
|
|
), |
|
|
Optional('--privacy'): Or(None, And( |
|
|
Optional('--privacy'): Or(None, And( |
|
|
str, |
|
|
str, |
|
|
validatePrivacy, |
|
|
validatePrivacy, |
|
|