Browse Source

Merge branch 'hotfix/v0.6.1-1' into develop

feature/pt-playlist-1.3
LecygneNoir 5 years ago
parent
commit
8f0fc4cfb5
5 changed files with 12 additions and 21 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +0
    -3
      lib/pt_upload.py
  3. +5
    -12
      lib/utils.py
  4. +0
    -1
      nfo_example.txt
  5. +2
    -5
      prismedia_upload.py

+ 5
- 0
CHANGELOG.md View File

@ -1,5 +1,10 @@
# Changelog # Changelog
## v0.6.1-1 Hotfix
This fix prepares the python3 compatibility
- Remove mastodon tags (mt) options as it's deprecated. Compatibility between Peertube and Mastodon is complete.
## v0.6.1 ## v0.6.1
### Fixes ### Fixes

+ 0
- 3
lib/pt_upload.py View File

@ -135,9 +135,6 @@ def upload_video(oauth, secret, options):
if len(strtag) >= 30: if len(strtag) >= 30:
logging.warning("Peertube: Sorry, Peertube does not support tag with more than 30 characters, please reduce your tag size") logging.warning("Peertube: Sorry, Peertube does not support tag with more than 30 characters, please reduce your tag size")
exit(1) exit(1)
# If Mastodon compatibility is enabled, clean tags from special characters
if options.get('--mt'):
strtag = utils.cleanString(strtag)
fields.append(("tags", strtag)) fields.append(("tags", strtag))
if options.get('--category'): if options.get('--category'):

+ 5
- 12
lib/utils.py View File

@ -3,9 +3,10 @@
from ConfigParser import RawConfigParser, NoOptionError, NoSectionError from ConfigParser import RawConfigParser, NoOptionError, NoSectionError
from os.path import dirname, splitext, basename, isfile from os.path import dirname, splitext, basename, isfile
import re
from os import devnull from os import devnull
from subprocess import check_call, CalledProcessError, STDOUT from subprocess import check_call, CalledProcessError, STDOUT
import unicodedata
import unidecode
import logging import logging
### CATEGORIES ### ### CATEGORIES ###
@ -191,17 +192,9 @@ def upcaseFirstLetter(s):
return s[0].upper() + s[1:] return s[0].upper() + s[1:]
def cleanString(toclean): def cleanString(toclean):
toclean = toclean.split(' ')
cleaned = ''
for s in toclean:
if s == '':
continue
strtoclean = unicodedata.normalize('NFKD', unicode (s, 'utf-8')).encode('ASCII', 'ignore')
strtoclean = ''.join(e for e in strtoclean if e.isalnum())
if strtoclean == '':
continue
strtoclean = upcaseFirstLetter(strtoclean)
cleaned = cleaned + strtoclean
toclean = toclean.decode('utf-8')
toclean = unidecode.unidecode(toclean)
cleaned = re.sub('[^A-Za-z0-9]+', '', toclean)
return cleaned return cleaned

+ 0
- 1
nfo_example.txt View File

@ -12,7 +12,6 @@ description = Your complete video description
should be wrote with a blank space should be wrote with a blank space
at the beginning of the line :) at the beginning of the line :)
tags = list of tags, comma separated tags = list of tags, comma separated
mt = True
category = Films category = Films
cca = True cca = True
privacy = private privacy = private

+ 2
- 5
prismedia_upload.py View File

@ -6,7 +6,7 @@ prismedia_upload - tool to upload videos to Peertube and Youtube
Usage: Usage:
prismedia_upload.py --file=<FILE> [options] prismedia_upload.py --file=<FILE> [options]
prismedia_upload.py -f <FILE> --tags=STRING [--mt options]
prismedia_upload.py -f <FILE> --tags=STRING [options]
prismedia_upload.py -h | --help prismedia_upload.py -h | --help
prismedia_upload.py --version prismedia_upload.py --version
@ -18,8 +18,6 @@ Options:
WARN: tags with space and special characters (!, ', ", ?, ...) WARN: tags with space and special characters (!, ', ", ?, ...)
are not supported by Mastodon to be published from Peertube are not supported by Mastodon to be published from Peertube
use mastodon compatibility below use mastodon compatibility below
--mt Force Mastodon compatibility for tags (drop every incompatible characters inside tags)
This option requires --tags
-c, --category=STRING Category for the videos, see below. (default: Films) -c, --category=STRING Category for the videos, see below. (default: Films)
--cca License should be CreativeCommon Attribution (affects Youtube upload only) --cca License should be CreativeCommon Attribution (affects Youtube upload only)
-p, --privacy=STRING Choose between public, unlisted or private. (default: private) -p, --privacy=STRING Choose between public, unlisted or private. (default: private)
@ -94,7 +92,7 @@ except ImportError:
'see https://github.com/ahupp/python-magic\n') 'see https://github.com/ahupp/python-magic\n')
exit(1) exit(1)
VERSION = "prismedia v0.6.1"
VERSION = "prismedia v0.6.1-1"
VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted') VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted')
VALID_CATEGORIES = ( VALID_CATEGORIES = (
@ -181,7 +179,6 @@ if __name__ == '__main__':
lambda x: not x.isdigit(), lambda x: not x.isdigit(),
error="Tags should be a string") error="Tags should be a string")
), ),
Optional('--mt'): bool,
Optional('--category'): Or(None, And( Optional('--category'): Or(None, And(
str, str,
validateCategory, validateCategory,

Loading…
Cancel
Save