Browse Source

Merge branch 'hotfix/0.6.3'

Fix #38 when creating public playlist on Peertube
master
LecygneNoir 4 years ago
parent
commit
6b1260c7bc
3 changed files with 12 additions and 7 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +6
    -6
      lib/pt_upload.py
  3. +1
    -1
      prismedia_upload.py

+ 5
- 0
CHANGELOG.md View File

@ -1,5 +1,10 @@
# Changelog
## v0.6.3
### Fixes
Fix Critical bug #38 that prevent upload when creating playlists on Peertube, as public playlist need a non-null channel_id.
## v0.6.2
**Warning**: your Peertube instance should be at least in v1.3.0 to use this new functionality.

+ 6
- 6
lib/pt_upload.py View File

@ -65,7 +65,7 @@ def get_playlist_by_name(user_playlists, options):
return playlist['id']
def create_playlist(oauth, url, options):
def create_playlist(oauth, url, options, default_channel):
template = ('Peertube: Playlist %s does not exist, creating it.')
logging.info(template % (str(options.get('--playlist'))))
# We use files for form-data Content
@ -74,7 +74,7 @@ def create_playlist(oauth, url, options):
files = {'displayName': (None, str(options.get('--playlist'))),
'privacy': (None, "1"),
'description': (None, "null"),
'videoChannelId': (None, "null"),
'videoChannelId': (None, str(default_channel)),
'thumbnailfile': (None, "null")}
try:
response = oauth.post(url + "/api/v1/video-playlists/",
@ -199,18 +199,18 @@ def upload_video(oauth, secret, options):
fields.append(("thumbnailfile", get_file(options.get('--thumbnail'))))
fields.append(("previewfile", get_file(options.get('--thumbnail'))))
default_channel = get_default_channel(user_info)
fields.append(("channelId", str(default_channel)))
if options.get('--playlist'):
playlist_id = get_playlist_by_name(user_playlists, options)
if not playlist_id and options.get('--playlistCreate'):
playlist_id = create_playlist(oauth, url, options)
playlist_id = create_playlist(oauth, url, options, default_channel)
elif not playlist_id:
logging.warning("Playlist `" + options.get('--playlist') + "` does not exist, please set --playlistCreate"
" if you want to create it")
exit(1)
default_channel = get_default_channel(user_info)
fields.append(("channelId", str(default_channel)))
multipart_data = MultipartEncoder(fields)
headers = {

+ 1
- 1
prismedia_upload.py View File

@ -92,7 +92,7 @@ except ImportError:
'see https://github.com/ahupp/python-magic\n')
exit(1)
VERSION = "prismedia v0.6.2"
VERSION = "prismedia v0.6.3"
VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted')
VALID_CATEGORIES = (

Loading…
Cancel
Save