mirror of
https://git.lecygnenoir.info/LecygneNoir/prismedia.git
synced 2025-10-03 09:29:16 +02:00
Merge branch 'release/v0.9.1'
This commit is contained in:
commit
e52e7f354d
6 changed files with 76 additions and 37 deletions
|
@ -1,5 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## v0.9.1
|
||||
|
||||
### Features
|
||||
- Possibility to bypass the MIME check for .mp4 when the user is sure of its video (#46 , thanks to @zykino)
|
||||
- Now **available with pip** for installation! (See the README for doc)
|
||||
|
||||
|
||||
## v0.9.0
|
||||
|
||||
### Upgrade from v0.8.0
|
||||
|
|
56
README.md
56
README.md
|
@ -6,6 +6,8 @@ Scripting your way to upload videos to peertube and youtube. Works with Python 3
|
|||
|
||||
## Table of Contents
|
||||
- [Installation](#installation)
|
||||
- [From pip](#from-pip)
|
||||
- [From source](#from-source)
|
||||
- [Configuration](#configuration)
|
||||
- [Peertube](#peertube)
|
||||
- [Youtube](#youtube)
|
||||
|
@ -16,23 +18,45 @@ Scripting your way to upload videos to peertube and youtube. Works with Python 3
|
|||
- [Sources](#sources)
|
||||
- [Contributors](#contributors)
|
||||
|
||||
## Installation
|
||||
## Installation an upgrade
|
||||
|
||||
You may use pip to install requirements: `pip install -r requirements.txt`
|
||||
### From pip
|
||||
|
||||
Simply install with
|
||||
|
||||
```bash
|
||||
pip install prismedia
|
||||
```
|
||||
|
||||
Upgrade with
|
||||
|
||||
```bash
|
||||
pip install --upgrade prismedia
|
||||
```
|
||||
|
||||
### From source
|
||||
|
||||
Get the source:
|
||||
|
||||
```bash
|
||||
git clone https://git.lecygnenoir.info/LecygneNoir/prismedia.git prismedia
|
||||
```
|
||||
|
||||
You may use pip to install requirements: `pip install -r requirements.txt` if you want to use the script directly.
|
||||
(*note:* requirements are generated via `poetry export -f requirements.txt`)
|
||||
|
||||
Otherwise, you can use [poetry](https://python-poetry.org):
|
||||
Otherwise, you can use [poetry](https://python-poetry.org), which create a virtualenv for the project directly
|
||||
(Or use the existing virtualenv if one is activated)
|
||||
|
||||
```
|
||||
poetry install # installs the dependency in the current virtualenv,
|
||||
or creates one specific to the project if no virtualenv is currently active
|
||||
poetry install
|
||||
```
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
Generate sample files with `python -m prismedia.genconfig`.
|
||||
Then edit `peertube_secret` and `youtube_secret.json` with your credentials. (see below)
|
||||
Then rename and edit `peertube_secret` and `youtube_secret.json` with your credentials. (see below)
|
||||
|
||||
### Peertube
|
||||
Set your credentials, peertube server URL.
|
||||
|
@ -44,7 +68,7 @@ You can set ``OAUTHLIB_INSECURE_TRANSPORT`` to 1 if you do not use https (not re
|
|||
Youtube uses combination of oauth and API access to identify.
|
||||
|
||||
**Credentials**
|
||||
The first time you connect, prismedia will open your browser to as you to authenticate to
|
||||
The first time you connect, prismedia will open your browser to ask 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``.
|
||||
|
@ -52,7 +76,7 @@ Prismedia will try to use this file at each launch, and re-ask for authenticatio
|
|||
|
||||
**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:
|
||||
If you plan a larger usage, please consider creating your own youtube_secret file:
|
||||
|
||||
- Go to the [Google console](https://console.developers.google.com/).
|
||||
- Create project.
|
||||
|
@ -64,31 +88,32 @@ If you plan an larger usage, please consider creating your own youtube_secret fi
|
|||
- Save this JSON as your youtube_secret.json file.
|
||||
|
||||
## Usage
|
||||
Support only mp4 for cross compatibility between Youtube and Peertube
|
||||
Support only mp4 for cross compatibility between Youtube and Peertube.
|
||||
**Note that all options may be specified in a NFO file!** (see [Enhanced NFO](#enhanced-use-of-nfo))
|
||||
|
||||
Upload a video:
|
||||
|
||||
```
|
||||
python -m prismedia --file="yourvideo.mp4"
|
||||
prismedia --file="yourvideo.mp4"
|
||||
```
|
||||
|
||||
Specify description and tags:
|
||||
|
||||
```
|
||||
python -m prismedia --file="yourvideo.mp4" -d "My supa description" -t "tag1,tag2,foo"
|
||||
prismedia --file="yourvideo.mp4" -d "My supa description" -t "tag1,tag2,foo"
|
||||
```
|
||||
|
||||
Provide a thumbnail:
|
||||
|
||||
```
|
||||
python -m prismedia --file="yourvideo.mp4" -d "Video with thumbnail" --thumbnail="/path/to/your/thumbnail.jpg"
|
||||
prismedia --file="yourvideo.mp4" -d "Video with thumbnail" --thumbnail="/path/to/your/thumbnail.jpg"
|
||||
```
|
||||
|
||||
|
||||
Use a NFO file to specify your video options:
|
||||
(See nfo_example.txt for more precise example)
|
||||
(See [Enhanced NFO](#enhanced-use-of-nfo) for more precise example)
|
||||
```
|
||||
python -m prismedia --file="yourvideo.mp4" --nfo /path/to/your/nfo.txt
|
||||
prismedia --file="yourvideo.mp4" --nfo /path/to/your/nfo.txt
|
||||
```
|
||||
|
||||
|
||||
|
@ -213,11 +238,12 @@ It allows to specify more easily default options for an entire set of video, dir
|
|||
- [x] Allow to choose peertube or youtube upload (to resume failed upload for example)
|
||||
- [x] Usable on Desktop (Linux and/or Windows and/or MacOS)
|
||||
- [x] Different schedules on platforms to prepare preview
|
||||
- [ ] A usable graphical interface
|
||||
|
||||
## Compatibility
|
||||
|
||||
- If you still use python2, use the version 0.7.1 (no more updated)
|
||||
- peertube before 1.0.0-beta4, use the version inside tag 1.0.0-beta3
|
||||
- If you use peertube before 1.0.0-beta4, use the version inside tag 1.0.0-beta3
|
||||
|
||||
## Sources
|
||||
inspired by [peeror](https://git.rigelk.eu/rigelk/peeror) and [youtube-upload](https://github.com/tokland/youtube-upload)
|
||||
|
|
20
poetry.lock
generated
20
poetry.lock
generated
|
@ -56,10 +56,10 @@ description = "Google API client core library"
|
|||
name = "google-api-core"
|
||||
optional = false
|
||||
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
|
||||
version = "1.16.0"
|
||||
version = "1.17.0"
|
||||
|
||||
[package.dependencies]
|
||||
google-auth = ">=0.4.0,<2.0dev"
|
||||
google-auth = ">=1.14.0,<2.0dev"
|
||||
googleapis-common-protos = ">=1.6.0,<2.0dev"
|
||||
protobuf = ">=3.4.0"
|
||||
pytz = "*"
|
||||
|
@ -78,7 +78,7 @@ description = "Google API Client Library for Python"
|
|||
name = "google-api-python-client"
|
||||
optional = false
|
||||
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
|
||||
version = "1.8.0"
|
||||
version = "1.8.2"
|
||||
|
||||
[package.dependencies]
|
||||
google-api-core = ">=1.13.0,<2dev"
|
||||
|
@ -94,7 +94,7 @@ description = "Google Authentication Library"
|
|||
name = "google-auth"
|
||||
optional = false
|
||||
python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*"
|
||||
version = "1.13.1"
|
||||
version = "1.14.1"
|
||||
|
||||
[package.dependencies]
|
||||
cachetools = ">=2.0.0,<5.0"
|
||||
|
@ -368,16 +368,16 @@ future = [
|
|||
{file = "future-0.17.1.tar.gz", hash = "sha256:67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8"},
|
||||
]
|
||||
google-api-core = [
|
||||
{file = "google-api-core-1.16.0.tar.gz", hash = "sha256:92e962a087f1c4b8d1c5c88ade1c1dfd550047dcffb320c57ef6a534a20403e2"},
|
||||
{file = "google_api_core-1.16.0-py2.py3-none-any.whl", hash = "sha256:859f7392676761f2b160c6ee030c3422135ada4458f0948c5690a6a7c8d86294"},
|
||||
{file = "google-api-core-1.17.0.tar.gz", hash = "sha256:e4082a0b479dc2dee2f8d7b80ea8b5d0184885b773caab15ab1836277a01d689"},
|
||||
{file = "google_api_core-1.17.0-py2.py3-none-any.whl", hash = "sha256:c0e430658ed6be902d7ba7095fb0a9cac810270d71bf7ac4484e76c300407aae"},
|
||||
]
|
||||
google-api-python-client = [
|
||||
{file = "google-api-python-client-1.8.0.tar.gz", hash = "sha256:0f5b42a14e2d2f7dee40f2e4514531dbe95ebde9c2173b1c4040a65c427e7900"},
|
||||
{file = "google_api_python_client-1.8.0-py3-none-any.whl", hash = "sha256:5032ad1af5046889649b3848f2e871889fbb6ae440198a549fe1699581300386"},
|
||||
{file = "google-api-python-client-1.8.2.tar.gz", hash = "sha256:bf482c13fb41a6d01770f9d62be6b33fdcd41d68c97f2beb9be02297bdd9e725"},
|
||||
{file = "google_api_python_client-1.8.2-py3-none-any.whl", hash = "sha256:8dd35a3704650c2db44e6cf52abdaf9de71f409c93c56bbe48a321ab5e14ebad"},
|
||||
]
|
||||
google-auth = [
|
||||
{file = "google-auth-1.13.1.tar.gz", hash = "sha256:a5ee4c40fef77ea756cf2f1c0adcf475ecb53af6700cf9c133354cdc9b267148"},
|
||||
{file = "google_auth-1.13.1-py2.py3-none-any.whl", hash = "sha256:cab6c707e6ee20e567e348168a5c69dc6480384f777a9e5159f4299ad177dcc0"},
|
||||
{file = "google-auth-1.14.1.tar.gz", hash = "sha256:e63b2210e03c4ed829063b72c4af0c4b867c2788efb3210b6b9439b488bd3afd"},
|
||||
{file = "google_auth-1.14.1-py2.py3-none-any.whl", hash = "sha256:0c41a453b9a8e77975bfa436b8daedac00aed1c545d84410daff8272fff40fbb"},
|
||||
]
|
||||
google-auth-httplib2 = [
|
||||
{file = "google-auth-httplib2-0.0.3.tar.gz", hash = "sha256:098fade613c25b4527b2c08fa42d11f3c2037dda8995d86de0745228e965d445"},
|
||||
|
|
|
@ -96,7 +96,7 @@ except ImportError:
|
|||
'see https://github.com/ahupp/python-magic\n')
|
||||
exit(1)
|
||||
|
||||
VERSION = "prismedia v0.9.0"
|
||||
VERSION = "prismedia v0.9.1"
|
||||
|
||||
VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted')
|
||||
VALID_CATEGORIES = (
|
||||
|
@ -115,11 +115,17 @@ VALID_LANGUAGES = ('arabic', 'english', 'french',
|
|||
|
||||
def validateVideo(path):
|
||||
supported_types = ['video/mp4']
|
||||
if magic.from_file(path, mime=True) in supported_types:
|
||||
return path
|
||||
else:
|
||||
detected_type = magic.from_file(path, mime=True)
|
||||
if detected_type not in supported_types:
|
||||
print("File", path, "detected type is", detected_type, "which is not one of", supported_types)
|
||||
|
||||
force_file = ['y', 'yes']
|
||||
is_forcing = input("Are you sure you selected the correct file? (y/N)")
|
||||
if is_forcing.lower() not in force_file:
|
||||
return False
|
||||
|
||||
return path
|
||||
|
||||
|
||||
def validateCategory(category):
|
||||
if category.lower() in VALID_CATEGORIES:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "prismedia"
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
description = "scripting your way to upload videos on peertube and youtube"
|
||||
authors = [
|
||||
"LecygneNoir <git@lecygnenoir.info>",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
cachetools==3.1.1 \
|
||||
--hash=sha256:428266a1c0d36dc5aca63a2d7c5942e88c2c898d72139fca0e97fdd2380517ae \
|
||||
--hash=sha256:8ea2d3ce97850f31e4a08b0e2b5e6c34997d7216a9d2c98e0f3978630d4da69a
|
||||
certifi==2019.11.28 \
|
||||
--hash=sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3 \
|
||||
--hash=sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f
|
||||
certifi==2020.4.5.1 \
|
||||
--hash=sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304 \
|
||||
--hash=sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519
|
||||
chardet==3.0.4 \
|
||||
--hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691 \
|
||||
--hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae
|
||||
|
@ -20,9 +20,9 @@ google-api-core==1.16.0 \
|
|||
google-api-python-client==1.8.0 \
|
||||
--hash=sha256:0f5b42a14e2d2f7dee40f2e4514531dbe95ebde9c2173b1c4040a65c427e7900 \
|
||||
--hash=sha256:5032ad1af5046889649b3848f2e871889fbb6ae440198a549fe1699581300386
|
||||
google-auth==1.12.0 \
|
||||
--hash=sha256:016924388770b7e66c7e9ade1c4c3144ee88812d79697fd6c0dad9abdfcda2fd \
|
||||
--hash=sha256:01d686448f57d3bc027726474faa1aa650ba333bedb392e06938b0add8ec8d3a
|
||||
google-auth==1.13.1 \
|
||||
--hash=sha256:a5ee4c40fef77ea756cf2f1c0adcf475ecb53af6700cf9c133354cdc9b267148 \
|
||||
--hash=sha256:cab6c707e6ee20e567e348168a5c69dc6480384f777a9e5159f4299ad177dcc0
|
||||
google-auth-httplib2==0.0.3 \
|
||||
--hash=sha256:098fade613c25b4527b2c08fa42d11f3c2037dda8995d86de0745228e965d445 \
|
||||
--hash=sha256:f1c437842155680cf9918df9bc51c1182fda41feef88c34004bd1978c8157e08
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue