|
|
@ -1,24 +1,106 @@ |
|
|
|
#!/usr/bin/python |
|
|
|
# coding: utf-8 |
|
|
|
|
|
|
|
# NOTE: Since we use config file to set some defaults values, it is not possible to use the standard syntax with brackets, we use parenthesis instead. |
|
|
|
# If we were to use them we would overide configuration file values with default values of cli. |
|
|
|
""" |
|
|
|
prismedia - tool to upload videos to Peertube and Youtube |
|
|
|
prismedia - tool to upload videos to different platforms (historicaly Peertube and Youtube) |
|
|
|
|
|
|
|
Usage: |
|
|
|
prismedia [--interface=INTERFACE [--help]] [--platforms=PLATFORMS] [--consumers=CONSUMERS] |
|
|
|
prismedia --list-plugins |
|
|
|
prismedia -h | --help |
|
|
|
prismedia --version |
|
|
|
prismedia [options] --file=<file> | <interface> |
|
|
|
prismedia --list-plugins | --hearthbeat |
|
|
|
prismedia -h | --help | -V | --version |
|
|
|
|
|
|
|
Options: |
|
|
|
-i --interface=INTERFACE Interface plugin to use. Select the interface you want to use (only one) [default: cli] |
|
|
|
-p --platforms=PLATFORMS Platforms plugins to use. Usually one platform plugin upload to one platform website (comma separated list) [default: all] |
|
|
|
-c --consumers=CONSUMERS Consumers plugins to use. They are executed after an upload has been done (comma separated list) [default: all] |
|
|
|
|
|
|
|
--list-plugins List all the plugins currently installed by category. |
|
|
|
|
|
|
|
-h --help Show this help. |
|
|
|
-V --version Show version. |
|
|
|
-f, --file=STRING Path to the video file to upload in mp4. This is the only mandatory option. |
|
|
|
--thumbnail=STRING Path to a file to use as a thumbnail for the video. |
|
|
|
--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. |
|
|
|
WARN: tags with punctuation (!, ', ", ?, ...) |
|
|
|
are not supported by Mastodon to be published from Peertube |
|
|
|
-c, --category=STRING Category for the videos, see below. (default: Films) |
|
|
|
--licence=STRING Creative Common licence tag (for exemple: CC-BY-SA) (default: proprietary) |
|
|
|
-p, --privacy=STRING Choose between public, unlisted or private. (default: private) |
|
|
|
--disable-comments Disable comments (Peertube only as YT API does not support) (default: comments are enabled) |
|
|
|
--nsfw Set the video as No Safe For Work (Peertube only as YT API does not support) (default: video is safe) |
|
|
|
--nfo=STRING Configure a specific nfo file to set options for the video. |
|
|
|
By default Prismedia search a .txt based on the video name and will |
|
|
|
decode the file as UTF-8 (so make sure your nfo file is UTF-8 encoded) |
|
|
|
See nfo_example.txt for more details |
|
|
|
--language=STRING Specify the default language for video. See below for supported language. (default is English) |
|
|
|
--publish-at=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 in the future |
|
|
|
--peertube-at=DATE Override publish-at for the corresponding platform. Allow to create preview on specific platform |
|
|
|
--youtube-at=DATE Override publish-at for the corresponding platform. Allow to create preview on specific platform |
|
|
|
--original-date=DATE Configure the video as initially recorded at DATE |
|
|
|
DATE should be on the form YYYY-MM-DDThh:mm:ss eg: 2018-03-12T19:00:00 |
|
|
|
DATE should be in the past |
|
|
|
--auto-original-date Automatically use the file modification time as original date |
|
|
|
Supported types are jpg and jpeg. |
|
|
|
By default, prismedia search for an image based on video name followed by .jpg or .jpeg |
|
|
|
--channel=STRING Set the channel to use for the video (Peertube only) |
|
|
|
If the channel is not found, spawn an error except if --channelCreate is set. |
|
|
|
--channel-create Create the channel if not exists. (Peertube only, default do not create) |
|
|
|
Only relevant if --channel is set. |
|
|
|
--playlist=STRING Set the playlist to use for the video. |
|
|
|
If the playlist is not found, spawn an error except if --playlistCreate is set. |
|
|
|
--playlist-create Create the playlist if not exists. (default do not create) |
|
|
|
Only relevant if --playlist is set. |
|
|
|
--progress=STRING Set the progress bar view, one of percentage, bigFile, accurate. [default: percentage] |
|
|
|
|
|
|
|
--hearthbeat Use some credits to show some activity for you apikey so the platform know it is used and would not inactivate your keys. |
|
|
|
|
|
|
|
-h, --help Show this help. |
|
|
|
-V, --version Show the version. |
|
|
|
|
|
|
|
Plugins options: |
|
|
|
<interface> Interface plugin to use. Select the interface you want to use. By default the interface is the command line. |
|
|
|
--platform=STRING Platforms plugins to use. Usually one platform plugin upload to one platform website (comma separated list) (default: all) |
|
|
|
--consumer=STRING Consumers plugins to use. They are executed after an upload has been done (comma separated list) (default: all) |
|
|
|
--list-plugins List all the plugins currently installed by category. |
|
|
|
|
|
|
|
Logging options: |
|
|
|
--log=STRING Log level, between debug, info, warning, error, critical. Ignored if --quiet is set (default to info) |
|
|
|
-q, --quiet Suppress any log except Critical (alias for --log=critical). |
|
|
|
-u, --url-only Display generated URL after upload directly on stdout, implies --quiet |
|
|
|
--batch Display generated URL after upload with platform information for easier parsing. Implies --quiet |
|
|
|
Be careful --batch and --url-only are mutually exclusives. |
|
|
|
|
|
|
|
Strict options: |
|
|
|
Strict options allow you to force some option to be present when uploading a video. It's useful to be sure you do not |
|
|
|
forget something when uploading a video, for example if you use multiples NFO. You may force the presence of description, |
|
|
|
tags, thumbnail, ... |
|
|
|
All strict option are optionals and are provided only to avoid errors when uploading :-) |
|
|
|
All strict options can be specified in NFO directly, the only strict option mandatory on cli is --withNFO |
|
|
|
All strict options are off by default |
|
|
|
|
|
|
|
--withNFO Prevent the upload without a NFO, either specified via cli or found in the directory |
|
|
|
--withThumbnail Prevent the upload without a thumbnail |
|
|
|
--withName Prevent the upload if no name are found |
|
|
|
--withDescription Prevent the upload without description |
|
|
|
--withTags Prevent the upload without tags |
|
|
|
--withPlaylist Prevent the upload if no playlist |
|
|
|
--withPublishAt Prevent the upload if no schedule |
|
|
|
--withOriginalDate Prevent the upload if no original date configured |
|
|
|
--withPlatform Prevent the upload if at least one platform is not specified |
|
|
|
--withCategory Prevent the upload if no category |
|
|
|
--withLanguage Prevent upload if no language |
|
|
|
--withChannel Prevent upload if no channel |
|
|
|
|
|
|
|
Categories: |
|
|
|
Category is the type of video you upload. Default is films. |
|
|
|
Here are available categories from Peertube and Youtube: |
|
|
|
music, films, vehicles, sports, travels, gaming, people, |
|
|
|
comedy, entertainment, news, how to, education, activism, |
|
|
|
science & technology, 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 |
|
|
|
""" |
|
|
|
|
|
|
|
import video |
|
|
@ -31,7 +113,7 @@ import logging |
|
|
|
|
|
|
|
# logging.basicConfig(level=logging.DEBUG) |
|
|
|
|
|
|
|
VERSION = "prismedia v1.0.0" |
|
|
|
VERSION = "prismedia v1.0.0-plugins-alpha" |
|
|
|
|
|
|
|
def loadPlugins(basePluginsPath): |
|
|
|
manager = PluginManagerSingleton.get() |
|
|
|