wi1-bot 1.3.15__py3-none-any.whl → 1.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wi1_bot/_version.py +14 -2
- wi1_bot/scripts/transcode_item.py +1 -1
- wi1_bot/transcoder/transcode_queue.py +3 -3
- wi1_bot/transcoder/transcoder.py +22 -17
- wi1_bot/webhook.py +4 -6
- {wi1_bot-1.3.15.dist-info → wi1_bot-1.4.0.dist-info}/METADATA +1 -1
- {wi1_bot-1.3.15.dist-info → wi1_bot-1.4.0.dist-info}/RECORD +11 -11
- {wi1_bot-1.3.15.dist-info → wi1_bot-1.4.0.dist-info}/LICENSE +0 -0
- {wi1_bot-1.3.15.dist-info → wi1_bot-1.4.0.dist-info}/WHEEL +0 -0
- {wi1_bot-1.3.15.dist-info → wi1_bot-1.4.0.dist-info}/entry_points.txt +0 -0
- {wi1_bot-1.3.15.dist-info → wi1_bot-1.4.0.dist-info}/top_level.txt +0 -0
wi1_bot/_version.py
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
# file generated by setuptools_scm
|
2
2
|
# don't change, don't track in version control
|
3
|
-
|
4
|
-
|
3
|
+
TYPE_CHECKING = False
|
4
|
+
if TYPE_CHECKING:
|
5
|
+
from typing import Tuple, Union
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
7
|
+
else:
|
8
|
+
VERSION_TUPLE = object
|
9
|
+
|
10
|
+
version: str
|
11
|
+
__version__: str
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
13
|
+
version_tuple: VERSION_TUPLE
|
14
|
+
|
15
|
+
__version__ = version = '1.4.0'
|
16
|
+
__version_tuple__ = version_tuple = (1, 4, 0)
|
@@ -29,7 +29,7 @@ def main() -> None:
|
|
29
29
|
queue.add(
|
30
30
|
path=str(path),
|
31
31
|
copy_all_streams=get_key(qp, "copy_all_streams"),
|
32
|
-
|
32
|
+
languages=get_key(qp, "languages"),
|
33
33
|
video_codec=get_key(qp, "video_codec"),
|
34
34
|
video_bitrate=get_key(qp, "video_bitrate"),
|
35
35
|
audio_codec=get_key(qp, "audio_codec"),
|
@@ -10,7 +10,7 @@ class TranscodeItem(Document):
|
|
10
10
|
path = StringField(required=True)
|
11
11
|
|
12
12
|
copy_all_streams = BooleanField(required=False)
|
13
|
-
|
13
|
+
languages = StringField(required=False)
|
14
14
|
|
15
15
|
video_codec = StringField(required=False)
|
16
16
|
video_bitrate = IntField(required=False)
|
@@ -29,7 +29,7 @@ class TranscodeQueue:
|
|
29
29
|
self,
|
30
30
|
path: str,
|
31
31
|
copy_all_streams: bool | None = None,
|
32
|
-
|
32
|
+
languages: str | None = None,
|
33
33
|
video_codec: str | None = None,
|
34
34
|
video_bitrate: int | None = None,
|
35
35
|
audio_codec: str | None = None,
|
@@ -40,7 +40,7 @@ class TranscodeQueue:
|
|
40
40
|
TranscodeItem(
|
41
41
|
path=path,
|
42
42
|
copy_all_streams=copy_all_streams,
|
43
|
-
|
43
|
+
languages=languages,
|
44
44
|
video_codec=video_codec,
|
45
45
|
video_bitrate=video_bitrate,
|
46
46
|
audio_codec=audio_codec,
|
wi1_bot/transcoder/transcoder.py
CHANGED
@@ -6,6 +6,7 @@ import subprocess
|
|
6
6
|
import threading
|
7
7
|
from datetime import timedelta
|
8
8
|
from time import sleep
|
9
|
+
from typing import Any
|
9
10
|
|
10
11
|
from wi1_bot import push
|
11
12
|
from wi1_bot.arr import Radarr, Sonarr
|
@@ -196,7 +197,7 @@ class Transcoder:
|
|
196
197
|
def _build_ffmpeg_command(
|
197
198
|
self, item: TranscodeItem, transcode_to: pathlib.Path
|
198
199
|
) -> list[str]:
|
199
|
-
command = [
|
200
|
+
command: list[Any] = [
|
200
201
|
"ffmpeg",
|
201
202
|
"-hide_banner",
|
202
203
|
"-y",
|
@@ -213,21 +214,21 @@ class Transcoder:
|
|
213
214
|
|
214
215
|
command.extend(["-i", item.path])
|
215
216
|
|
217
|
+
langs: list[str] = []
|
218
|
+
|
219
|
+
if item.languages:
|
220
|
+
langs = item.languages.split(",")
|
221
|
+
|
216
222
|
if item.copy_all_streams:
|
217
223
|
command.extend(["-map", "0"])
|
218
224
|
else:
|
219
225
|
command.extend(["-map", "0:v:0"])
|
220
|
-
command.extend(["-map", "0:a:0?"])
|
221
226
|
|
222
|
-
|
223
|
-
|
224
|
-
if item.subtitle_languages:
|
225
|
-
subs_map = [
|
226
|
-
f"0:s:m:language:{lang}?" for lang in item.subtitle_languages.split(",")
|
227
|
-
]
|
227
|
+
command.extend(["-map", "0:a:0?"])
|
228
|
+
command.extend(["-map", f"0:a:m:language:{lang}?"] for lang in langs)
|
228
229
|
|
229
|
-
|
230
|
-
command.extend(["-map",
|
230
|
+
command.extend(["-map", "0:s?"])
|
231
|
+
command.extend(["-map", f"0:s:m:language:{lang}?"] for lang in langs)
|
231
232
|
|
232
233
|
if item.video_codec:
|
233
234
|
command.extend(["-vcodec", item.video_codec])
|
@@ -237,9 +238,9 @@ class Transcoder:
|
|
237
238
|
command.extend(["-vcodec", "copy"])
|
238
239
|
|
239
240
|
if item.video_bitrate:
|
240
|
-
command.extend(["-b:v",
|
241
|
-
command.extend(["-maxrate",
|
242
|
-
command.extend(["-bufsize",
|
241
|
+
command.extend(["-b:v", item.video_bitrate])
|
242
|
+
command.extend(["-maxrate", item.video_bitrate * 2])
|
243
|
+
command.extend(["-bufsize", item.video_bitrate * 2])
|
243
244
|
|
244
245
|
if item.audio_codec:
|
245
246
|
command.extend(["-acodec", item.audio_codec])
|
@@ -247,14 +248,18 @@ class Transcoder:
|
|
247
248
|
command.extend(["-acodec", "copy"])
|
248
249
|
|
249
250
|
if item.audio_channels:
|
250
|
-
command.extend(["-ac",
|
251
|
+
command.extend(["-ac", item.audio_channels])
|
251
252
|
|
252
253
|
if item.audio_bitrate:
|
253
|
-
command.extend(["-b:a",
|
254
|
+
command.extend(["-b:a", item.audio_bitrate])
|
255
|
+
|
256
|
+
# TODO: use ffprobe to figure out if we can copy subs,
|
257
|
+
# or implement some form of retry functionality if ffmpeg errors out
|
258
|
+
command.extend(["-scodec", "copy"])
|
254
259
|
|
255
|
-
command.extend([
|
260
|
+
command.extend([transcode_to])
|
256
261
|
|
257
|
-
return command
|
262
|
+
return [str(arg) for arg in command]
|
258
263
|
|
259
264
|
|
260
265
|
if __name__ == "__main__":
|
wi1_bot/webhook.py
CHANGED
@@ -78,7 +78,7 @@ def on_download(req: dict[str, Any]) -> None:
|
|
78
78
|
return None
|
79
79
|
|
80
80
|
copy_all_streams = get_key(quality_options, "copy_all_streams")
|
81
|
-
|
81
|
+
languages = get_key(quality_options, "languages")
|
82
82
|
video_codec = get_key(quality_options, "video_codec")
|
83
83
|
video_bitrate = get_key(quality_options, "video_bitrate")
|
84
84
|
audio_codec = get_key(quality_options, "audio_codec")
|
@@ -89,7 +89,7 @@ def on_download(req: dict[str, Any]) -> None:
|
|
89
89
|
path=str(path),
|
90
90
|
content_id=content_id,
|
91
91
|
copy_all_streams=copy_all_streams,
|
92
|
-
|
92
|
+
languages=languages,
|
93
93
|
video_codec=video_codec,
|
94
94
|
video_bitrate=video_bitrate,
|
95
95
|
audio_codec=audio_codec,
|
@@ -104,11 +104,9 @@ def index() -> Any:
|
|
104
104
|
if request.json is None or "eventType" not in request.json:
|
105
105
|
return "", 400
|
106
106
|
|
107
|
-
logger.debug(f"got request: {json.dumps(request.json
|
107
|
+
logger.debug(f"got request: {json.dumps(request.json)}")
|
108
108
|
|
109
|
-
if request.json["eventType"] == "
|
110
|
-
on_grab(request.json)
|
111
|
-
elif request.json["eventType"] == "Download":
|
109
|
+
if request.json["eventType"] == "Download":
|
112
110
|
on_download(request.json)
|
113
111
|
except Exception:
|
114
112
|
logger.warning(
|
@@ -1,8 +1,8 @@
|
|
1
1
|
wi1_bot/__init__.py,sha256=11ozJKiUsqDCZ3_mcAHhGYUyGK_Unl54djVSBBExFB4,59
|
2
|
-
wi1_bot/_version.py,sha256=
|
2
|
+
wi1_bot/_version.py,sha256=R8-T9fmURjcuoxYpHTAjyNAhgJPDtI2jogCjqYYkfCU,411
|
3
3
|
wi1_bot/config.py,sha256=cWgpI7GUwqUed43RZhD1ruZT0A5RoN8VESbSo8uwr5A,2797
|
4
4
|
wi1_bot/push.py,sha256=-Az8c21R3IZAkJVRQmWsbNXMfvBzzpc9pFTWsDy1mJE,789
|
5
|
-
wi1_bot/webhook.py,sha256=
|
5
|
+
wi1_bot/webhook.py,sha256=SEKd11Hkcewf9Y_DvMKfo2TEP6wgqAGWUlGls7t0gso,3685
|
6
6
|
wi1_bot/arr/__init__.py,sha256=ZIgkW24GBdS4sJmaiEIhueHOB6s2L8y2s9ahgp1USRI,86
|
7
7
|
wi1_bot/arr/download.py,sha256=02AYFglnFdWSG8xj_TaJc6l2wjybyhUW6F97CnoyUFw,1381
|
8
8
|
wi1_bot/arr/episode.py,sha256=j25ljy9hyTXFAEBeUQ4iozKP2YXpZyzauphaXa2oqh8,1057
|
@@ -18,13 +18,13 @@ wi1_bot/discord/cogs/series.py,sha256=AfUfWuU-vUlID-gW7GWu9w-GiwWzZ4Cxm49_FjgvJi
|
|
18
18
|
wi1_bot/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
wi1_bot/scripts/add_tag.py,sha256=mWwo8egk2Y5XRiQCpfkA11-3rcxZoD0JOJKxV0LguLk,586
|
20
20
|
wi1_bot/scripts/start.py,sha256=vNa_iHkx10D5YWonyRW0f5nG8uE3_JtwJ-XZ-c0hWCs,2477
|
21
|
-
wi1_bot/scripts/transcode_item.py,sha256=
|
21
|
+
wi1_bot/scripts/transcode_item.py,sha256=21MeeIZ9wIRhAY-FOEgOdPsg6YOLlSUj59r8NkTfixw,1155
|
22
22
|
wi1_bot/transcoder/__init__.py,sha256=B4xr82UtIFc3tyy_MEZdZKMukYW0yejPnfsGowaTIM0,105
|
23
|
-
wi1_bot/transcoder/transcode_queue.py,sha256=
|
24
|
-
wi1_bot/transcoder/transcoder.py,sha256=
|
25
|
-
wi1_bot-1.
|
26
|
-
wi1_bot-1.
|
27
|
-
wi1_bot-1.
|
28
|
-
wi1_bot-1.
|
29
|
-
wi1_bot-1.
|
30
|
-
wi1_bot-1.
|
23
|
+
wi1_bot/transcoder/transcode_queue.py,sha256=W7r2I7OD8QuxseCEb7_ddOvYXiBBLmKLvCs2IgJJ92I,1856
|
24
|
+
wi1_bot/transcoder/transcoder.py,sha256=qPFXo9p2NS7gWrBNav8u9QBGE-QU-wiiUSvOefFozyw,8471
|
25
|
+
wi1_bot-1.4.0.dist-info/LICENSE,sha256=6V4_mQoPoLJl77_WMsQRQMDG2mnIhDUdfCmMkqM9Qwc,1072
|
26
|
+
wi1_bot-1.4.0.dist-info/METADATA,sha256=Qf2WEeXsOS-2vCAbH_vx5wIPxa7zGSzmY82PQDSDdvY,4612
|
27
|
+
wi1_bot-1.4.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
28
|
+
wi1_bot-1.4.0.dist-info/entry_points.txt,sha256=G_NEW2uMHHw4pbmVwGZ6cZaBwGpdkv741jNYtuX-1vM,147
|
29
|
+
wi1_bot-1.4.0.dist-info/top_level.txt,sha256=Q7mTnPLk80Td82YbjlBMO5tvXJoTFHhheHdmwc-c-7I,8
|
30
|
+
wi1_bot-1.4.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|