mirror of
https://git.lecygnenoir.info/LecygneNoir/prismedia.git
synced 2025-10-04 09:59:16 +02:00
Add option to choose which platform to upload to (default is Youtube and Peertube)
This commit is contained in:
parent
54beb8ee7e
commit
5c5c70b246
2 changed files with 21 additions and 3 deletions
|
@ -93,6 +93,8 @@ Options:
|
||||||
--nfo=STRING Configure a specific nfo file to set options for the video.
|
--nfo=STRING Configure a specific nfo file to set options for the video.
|
||||||
By default Prismedia search a .txt based on video name
|
By default Prismedia search a .txt based on video name
|
||||||
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.
|
||||||
|
Supported platforms are youtube and peertube (default is both)
|
||||||
-h --help Show this help.
|
-h --help Show this help.
|
||||||
--version Show version.
|
--version Show version.
|
||||||
|
|
||||||
|
@ -121,7 +123,7 @@ Categories:
|
||||||
- [ ] set default language
|
- [ ] set default language
|
||||||
- ~~thumbnail/preview~~ Canceled, waiting for Youtube's API support
|
- ~~thumbnail/preview~~ Canceled, waiting for Youtube's API support
|
||||||
- [x] Use a config file (NFO) file to retrieve videos arguments
|
- [x] Use a config file (NFO) file to retrieve videos arguments
|
||||||
- [ ] Allow to choose peertube or youtube upload (to resume failed upload for example)
|
- [x] Allow to choose peertube or youtube upload (to resume failed upload for example)
|
||||||
- [ ] Record and forget: put the video in a directory, and the script uploads it for you
|
- [ ] Record and forget: put the video in a directory, and the script uploads it for you
|
||||||
- [ ] Usable on Desktop (Linux and/or Windows and/or MacOS)
|
- [ ] Usable on Desktop (Linux and/or Windows and/or MacOS)
|
||||||
- [ ] Graphical User Interface
|
- [ ] Graphical User Interface
|
||||||
|
|
|
@ -21,6 +21,8 @@ Options:
|
||||||
--nfo=STRING Configure a specific nfo file to set options for the video.
|
--nfo=STRING Configure a specific nfo file to set options for the video.
|
||||||
By default Prismedia search a .txt based on video name
|
By default Prismedia search a .txt based on video name
|
||||||
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.
|
||||||
|
Supported platforms are youtube and peertube (default is both)
|
||||||
-h --help Show this help.
|
-h --help Show this help.
|
||||||
--version Show version.
|
--version Show version.
|
||||||
|
|
||||||
|
@ -47,12 +49,14 @@ import pt_upload
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
from schema import Schema, And, Or, Optional, SchemaError
|
from schema import Schema, And, Or, Optional, SchemaError
|
||||||
except ImportError:
|
except ImportError:
|
||||||
exit('This program requires that the `schema` data-validation library'
|
exit('This program requires that the `schema` data-validation library'
|
||||||
' is installed: \n'
|
' is installed: \n'
|
||||||
'see https://github.com/halst/schema\n')
|
'see https://github.com/halst/schema\n')
|
||||||
try:
|
try:
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
import magic
|
import magic
|
||||||
except ImportError:
|
except ImportError:
|
||||||
exit('This program requires that the `python-magic` library'
|
exit('This program requires that the `python-magic` library'
|
||||||
|
@ -68,6 +72,7 @@ VALID_CATEGORIES = (
|
||||||
"how to", "education", "activism", "science & technology",
|
"how to", "education", "activism", "science & technology",
|
||||||
"science", "technology", "animals"
|
"science", "technology", "animals"
|
||||||
)
|
)
|
||||||
|
VALID_PLATFORM = ('youtube', 'peertube')
|
||||||
|
|
||||||
|
|
||||||
def validateVideo(path):
|
def validateVideo(path):
|
||||||
|
@ -92,6 +97,14 @@ def validatePrivacy(privacy):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def validatePlatform(platform):
|
||||||
|
for plfrm in platform.split(','):
|
||||||
|
if plfrm not in VALID_PLATFORM:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
options = docopt(__doc__, version=VERSION)
|
options = docopt(__doc__, version=VERSION)
|
||||||
|
@ -124,6 +137,7 @@ if __name__ == '__main__':
|
||||||
error="Please use recognized privacy between public, unlisted or private")
|
error="Please use recognized privacy between public, unlisted or private")
|
||||||
),
|
),
|
||||||
Optional('--nfo'): Or(None, str),
|
Optional('--nfo'): Or(None, str),
|
||||||
|
Optional('--platform'): Or(None, And(str, validatePlatform, error="Sorry, upload platform not supported")),
|
||||||
Optional('--cca'): bool,
|
Optional('--cca'): bool,
|
||||||
Optional('--disable-comments'): bool,
|
Optional('--disable-comments'): bool,
|
||||||
Optional('--nsfw'): bool,
|
Optional('--nsfw'): bool,
|
||||||
|
@ -138,5 +152,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
options = utils.parseNFO(options)
|
options = utils.parseNFO(options)
|
||||||
|
|
||||||
yt_upload.run(options)
|
if options.get('--platform') is None or "youtube" in options.get('--platform'):
|
||||||
pt_upload.run(options)
|
yt_upload.run(options)
|
||||||
|
if options.get('--platform') is None or "peertube" in options.get('--platform'):
|
||||||
|
pt_upload.run(options)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue