mirror of
https://github.com/beetbox/beets.git
synced 2025-12-27 11:02:43 +01:00
Rename use_secure to secure and add to changelog
This commit is contained in:
parent
22d74a3b8a
commit
6d41f31309
4 changed files with 16 additions and 13 deletions
|
|
@ -18,12 +18,12 @@ from beets import config
|
|||
from beets.plugins import BeetsPlugin
|
||||
|
||||
|
||||
def get_music_section(host, port, token, library_name, use_secure,
|
||||
def get_music_section(host, port, token, library_name, secure,
|
||||
ignore_cert_errors):
|
||||
"""Getting the section key for the music library in Plex.
|
||||
"""
|
||||
api_endpoint = append_token('library/sections', token)
|
||||
url = urljoin('{0}://{1}:{2}'.format(get_protocol(use_secure), host,
|
||||
url = urljoin('{0}://{1}:{2}'.format(get_protocol(secure), host,
|
||||
port), api_endpoint)
|
||||
|
||||
# Sends request.
|
||||
|
|
@ -36,7 +36,7 @@ def get_music_section(host, port, token, library_name, use_secure,
|
|||
return child.get('key')
|
||||
|
||||
|
||||
def update_plex(host, port, token, library_name, use_secure,
|
||||
def update_plex(host, port, token, library_name, secure,
|
||||
ignore_cert_errors):
|
||||
"""Ignore certificate errors if configured to.
|
||||
"""
|
||||
|
|
@ -47,10 +47,10 @@ def update_plex(host, port, token, library_name, use_secure,
|
|||
"""
|
||||
# Getting section key and build url.
|
||||
section_key = get_music_section(host, port, token, library_name,
|
||||
use_secure, ignore_cert_errors)
|
||||
secure, ignore_cert_errors)
|
||||
api_endpoint = 'library/sections/{0}/refresh'.format(section_key)
|
||||
api_endpoint = append_token(api_endpoint, token)
|
||||
url = urljoin('{0}://{1}:{2}'.format(get_protocol(use_secure), host,
|
||||
url = urljoin('{0}://{1}:{2}'.format(get_protocol(secure), host,
|
||||
port), api_endpoint)
|
||||
|
||||
# Sends request and returns requests object.
|
||||
|
|
@ -66,8 +66,8 @@ def append_token(url, token):
|
|||
return url
|
||||
|
||||
|
||||
def get_protocol(use_secure):
|
||||
if use_secure:
|
||||
def get_protocol(secure):
|
||||
if secure:
|
||||
return 'https'
|
||||
else:
|
||||
return 'http'
|
||||
|
|
@ -83,7 +83,7 @@ class PlexUpdate(BeetsPlugin):
|
|||
u'port': 32400,
|
||||
u'token': u'',
|
||||
u'library_name': u'Music',
|
||||
u'use_secure': False,
|
||||
u'secure': False,
|
||||
u'ignore_cert_errors': False})
|
||||
|
||||
config['plex']['token'].redact = True
|
||||
|
|
@ -105,7 +105,7 @@ class PlexUpdate(BeetsPlugin):
|
|||
config['plex']['port'].get(),
|
||||
config['plex']['token'].get(),
|
||||
config['plex']['library_name'].get(),
|
||||
config['plex']['use_secure'].get(bool),
|
||||
config['plex']['secure'].get(bool),
|
||||
config['plex']['ignore_cert_errors'].get(bool))
|
||||
self._log.info(u'... started.')
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,9 @@ New features:
|
|||
:bug:`3567`
|
||||
* ``beet import`` now handles tar archives with bzip2 or gzip compression.
|
||||
:bug:`3606`
|
||||
* :doc:`/plugins/plexupdate`: Add option to use secure connection to Plex
|
||||
server, and to ignore certificate validation errors if necessary.
|
||||
:bug:`2871`
|
||||
|
||||
Fixes:
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ The available options under the ``plex:`` section are:
|
|||
Default: Empty.
|
||||
- **library_name**: The name of the Plex library to update.
|
||||
Default: ``Music``
|
||||
- **use_secure**: Use secure connections to the Plex server.
|
||||
- **secure**: Use secure connections to the Plex server.
|
||||
Default: ``False``
|
||||
- **ignore_cert_errors**: Ignore TLS certificate errors when using secure connections.
|
||||
Default: ``False``
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class PlexUpdateTest(unittest.TestCase, TestHelper):
|
|||
self.config['plex']['port'],
|
||||
self.config['plex']['token'],
|
||||
self.config['plex']['library_name'].get(),
|
||||
self.config['plex']['use_secure'],
|
||||
self.config['plex']['secure'],
|
||||
self.config['plex']['ignore_cert_errors']), '2')
|
||||
|
||||
@responses.activate
|
||||
|
|
@ -107,7 +107,7 @@ class PlexUpdateTest(unittest.TestCase, TestHelper):
|
|||
self.config['plex']['port'],
|
||||
self.config['plex']['token'],
|
||||
'My Music Library',
|
||||
self.config['plex']['use_secure'],
|
||||
self.config['plex']['secure'],
|
||||
self.config['plex']['ignore_cert_errors']), '2')
|
||||
|
||||
@responses.activate
|
||||
|
|
@ -122,7 +122,7 @@ class PlexUpdateTest(unittest.TestCase, TestHelper):
|
|||
self.config['plex']['port'],
|
||||
self.config['plex']['token'],
|
||||
self.config['plex']['library_name'].get(),
|
||||
self.config['plex']['use_secure'],
|
||||
self.config['plex']['secure'],
|
||||
self.config['plex']['ignore_cert_errors']).status_code, 200)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue