Browse Source

moved prismedia_upload in a module, added poetry command

requirements
Romain Kerguelen 5 years ago
parent
commit
4b970fed99
Signed by: rigelk GPG Key ID: EA12971B0E438F36
7 changed files with 34 additions and 26 deletions
  1. +17
    -15
      README.md
  2. +1
    -0
      prismedia/__init__.py
  3. +0
    -0
      prismedia/pt_upload.py
  4. +8
    -10
      prismedia/upload.py
  5. +0
    -0
      prismedia/utils.py
  6. +0
    -0
      prismedia/yt_upload.py
  7. +8
    -1
      pyproject.toml

+ 17
- 15
README.md View File

@ -1,6 +1,6 @@
# Prismedia
Scripting your way to upload videos to peertube and youtube.
Scripting your way to upload videos to peertube and youtube. Works only with Python 2 so far.
## Dependencies
@ -38,18 +38,20 @@ You can set ``OAUTHLIB_INSECURE_TRANSPORT`` to 1 if you do not use https (not re
### Youtube
Youtube uses combination of oauth and API access to identify.
Youtube uses OAuth 2.0 to restrict its API access to identified users. Registering a client is documented [here](https://developers.google.com/youtube/v3/guides/uploading_a_video).
**Credentials**
The first time you connect, prismedia will open your browser to as you to authenticate to
Youtube and allow the app to use your Youtube channel.
**It is here you choose which channel you will upload to**.
Once authenticated, the token is stored inside the file ``.youtube_credentials.json``.
Prismedia will try to use this file at each launch, and re-ask for authentication if it does not exist.
**Credentials:** the first time you connect, prismedia will open your browser
to as you to authenticate to Youtube and allow the app to use your Youtube
channel.
**Oauth**:
The default youtube_secret.json should allow you to upload some videos.
If you plan an larger usage, please consider creating your own youtube_secret file:
**It is here you choose which channel you will upload to:** once authenticated,
the token is stored inside the file `.youtube_credentials.json`. Prismedia will
try to use this file at each launch, and re-ask for authentication if it does
not exist.
**OAuth 2.0**: the default `youtube_secret.json` should allow you to upload
some videos. If you plan a more frequent usage, please consider creating your
own `youtube_secret` file:
- Go to the [Google console](https://console.developers.google.com/).
- Create project.
@ -69,26 +71,26 @@ Supports only mp4 for cross compatibility between Youtube and Peertube.
Simply upload a video:
```
./prismedia_upload.py --file="yourvideo.mp4"
python -m prismedia.upload --file="yourvideo.mp4"
```
Specify description and tags:
```
./prismedia_upload.py --file="yourvideo.mp4" -d "My supa description" -t "tag1,tag2,foo"
python -m prismedia.upload --file="yourvideo.mp4" -d "My supa description" -t "tag1,tag2,foo"
```
Provide a thumbnail:
```
./prismedia_upload.py --file="yourvideo.mp4" -d "Video with thumbnail" --thumbnail="/path/to/your/thumbnail.jpg"
python -m prismedia.upload --file="yourvideo.mp4" -d "Video with thumbnail" --thumbnail="/path/to/your/thumbnail.jpg"
```
Use a NFO file to specify your video options:
```
./prismedia_upload.py --file="yourvideo.mp4" --nfo /path/to/your/nfo.txt
python -m prismedia.upload --file="yourvideo.mp4" --nfo /path/to/your/nfo.txt
```
Use --help to get all available options:

+ 1
- 0
prismedia/__init__.py View File

@ -0,0 +1 @@
from . import upload

lib/pt_upload.py → prismedia/pt_upload.py View File


prismedia_upload.py → prismedia/upload.py View File

@ -59,8 +59,6 @@ Languages:
Japanese, Korean, Mandarin, Portuguese, Punjabi, Russian, Spanish
"""
from os.path import dirname, realpath
import sys
import datetime
import locale
import logging
@ -68,12 +66,9 @@ logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
from docopt import docopt
# Allows a relative import from the parent folder
sys.path.insert(0, dirname(realpath(__file__)) + "/lib")
import yt_upload
import pt_upload
import utils
from . import yt_upload
from . import pt_upload
from . import utils
try:
# noinspection PyUnresolvedReferences
@ -158,8 +153,7 @@ def validateThumbnail(thumbnail):
else:
return False
if __name__ == '__main__':
def main():
options = docopt(__doc__, version=VERSION)
schema = Schema({
@ -228,3 +222,7 @@ if __name__ == '__main__':
yt_upload.run(options)
if options.get('--platform') is None or "peertube" in options.get('--platform'):
pt_upload.run(options)
if __name__ == '__main__':
main()

lib/utils.py → prismedia/utils.py View File


lib/yt_upload.py → prismedia/yt_upload.py View File


+ 8
- 1
pyproject.toml View File

@ -3,14 +3,18 @@ name = "prismedia"
version = "0.6.2"
description = "scripting your way to upload videos on peertube and youtube"
authors = [
"LecygneNoir <git@lecygnenoir.info>"
"LecygneNoir <git@lecygnenoir.info>",
"Rigel Kent <sendmemail@rigelk.eu>"
]
license = "AGPL-3.0-only"
readme = 'README.md'
repository = "https://git.lecygnenoir.info/LecygneNoir/prismedia"
homepage = "https://git.lecygnenoir.info/LecygneNoir/prismedia"
keywords = ['peertube', 'youtube']
[tool.poetry.dependencies]
python = "^2.7"
google-auth-oauthlib = "^0.2.0"
@ -28,3 +32,6 @@ google-api-python-client = "^1.7"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
[tool.poetry.scripts]
prismedia = 'prismedia.upload:main'

Loading…
Cancel
Save