Skip to content

Commit 25b6b4c

Browse files
committed
Reorganize __init__ package to fix shadowing issues, make API consistent
As a helper/for code completion and simplicity, make the params available through the root module withing having to import via qencode.custom_params.
1 parent f70b754 commit 25b6b4c

File tree

4 files changed

+20
-48
lines changed

4 files changed

+20
-48
lines changed

docs/usage.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ import qencode
6262

6363
API_KEY = 'Your API KEY'
6464

65-
params = qencode.custom_params()
65+
params = qencode.CustomTranscodingParams()
6666

67-
FORMAT = qencode.format()
68-
STREAM = qencode.stream()
69-
DESTINATION = qencode.destination()
70-
VIDEO_CODEC = qencode.x264_video_codec()
67+
FORMAT = qencode.Format()
68+
STREAM = qencode.Stream()
69+
DESTINATION = qencode.Destination()
70+
VIDEO_CODEC = qencode.Libx264_VideoCodecParameters()
7171

7272

7373
DESTINATION.url = "..."

qencode/__init__.py

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
from .custom_params import (
2+
CustomTranscodingParams,
3+
Destination,
4+
Format,
5+
Libx264_VideoCodecParameters,
6+
Libx265_VideoCodecParameters,
7+
Stream,
8+
)
19
from .exceptions import QencodeClientException, QencodeTaskException
210

311

@@ -7,42 +15,6 @@ def client(api_key, api_url=None, version=None, **kwargs):
715
return QencodeApiClient(api_key, api_url=api_url, version=version, **kwargs)
816

917

10-
def custom_params():
11-
from custom_params import CustomTranscodingParams
12-
13-
return CustomTranscodingParams()
14-
15-
16-
def format():
17-
from custom_params import Format
18-
19-
return Format()
20-
21-
22-
def destination():
23-
from custom_params import Destination
24-
25-
return Destination()
26-
27-
28-
def stream():
29-
from custom_params import Stream
30-
31-
return Stream()
32-
33-
34-
def x264_video_codec():
35-
from custom_params import Libx264_VideoCodecParameters
36-
37-
return Libx264_VideoCodecParameters()
38-
39-
40-
def x265_video_codec():
41-
from custom_params import Libx265_VideoCodecParameters
42-
43-
return Libx265_VideoCodecParameters()
44-
45-
4618
__version__ = "0.9.29"
4719
__status__ = "Beta"
4820
__author__ = "Qencode"

sample-code/start_custom_hls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
# replace with your API KEY (can be found in your Project settings on Qencode portal)
1616
API_KEY = 'your-api-qencode-key'
1717

18-
params = qencode.custom_params()
18+
params = qencode.CustomTranscodingParams()
1919

20-
FORMAT = qencode.format()
21-
STREAM = qencode.stream()
22-
DESTINATION = qencode.destination()
20+
FORMAT = qencode.Format()
21+
STREAM = qencode.Stream()
22+
DESTINATION = qencode.Destination()
2323

2424
# Set your S3 access credentials here. For more storage types see Destination object
2525
# description: https://docs.qencode.com/#010_050

sample-code/start_custom_mp4.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
# replace with your API KEY (can be found in your Project settings on Qencode portal)
1717
API_KEY = 'your-api-qencode-key'
1818

19-
params = qencode.custom_params()
19+
params = qencode.CustomTranscodingParams()
2020

21-
FORMAT = qencode.format()
22-
DESTINATION = qencode.destination()
21+
FORMAT = qencode.Format()
22+
DESTINATION = qencode.Destination()
2323

2424
# set your S3 access credentials here for more storage types see Destination object
2525
# description: https://docs.qencode.com/#010_050

0 commit comments

Comments
 (0)