wi1-bot 1.3.15__tar.gz → 1.4.0__tar.gz

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.
Files changed (44) hide show
  1. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/PKG-INFO +1 -1
  2. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/config.yaml.template +4 -3
  3. wi1-bot-1.4.0/wi1_bot/_version.py +16 -0
  4. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/scripts/transcode_item.py +1 -1
  5. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/transcoder/transcode_queue.py +3 -3
  6. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/transcoder/transcoder.py +22 -17
  7. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/webhook.py +4 -6
  8. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot.egg-info/PKG-INFO +1 -1
  9. wi1-bot-1.3.15/wi1_bot/_version.py +0 -4
  10. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/.flake8 +0 -0
  11. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/.github/workflows/pypi-publish.yml +0 -0
  12. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/.gitignore +0 -0
  13. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/.pre-commit-config.yaml +0 -0
  14. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/.vscode/launch.json +0 -0
  15. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/.vscode/settings.json +0 -0
  16. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/LICENSE +0 -0
  17. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/README.md +0 -0
  18. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/pyproject.toml +0 -0
  19. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/setup.cfg +0 -0
  20. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/tests/movie_downloaded.py +0 -0
  21. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/__init__.py +0 -0
  22. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/arr/__init__.py +0 -0
  23. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/arr/download.py +0 -0
  24. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/arr/episode.py +0 -0
  25. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/arr/movie.py +0 -0
  26. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/arr/radarr.py +0 -0
  27. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/arr/sonarr.py +0 -0
  28. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/config.py +0 -0
  29. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/discord/__init__.py +0 -0
  30. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/discord/bot.py +0 -0
  31. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/discord/cogs/__init__.py +0 -0
  32. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/discord/cogs/movie.py +0 -0
  33. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/discord/cogs/series.py +0 -0
  34. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/discord/helpers.py +0 -0
  35. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/push.py +0 -0
  36. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/scripts/__init__.py +0 -0
  37. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/scripts/add_tag.py +0 -0
  38. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/scripts/start.py +0 -0
  39. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot/transcoder/__init__.py +0 -0
  40. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot.egg-info/SOURCES.txt +0 -0
  41. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot.egg-info/dependency_links.txt +0 -0
  42. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot.egg-info/entry_points.txt +0 -0
  43. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot.egg-info/requires.txt +0 -0
  44. {wi1-bot-1.3.15 → wi1-bot-1.4.0}/wi1_bot.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wi1-bot
3
- Version: 1.3.15
3
+ Version: 1.4.0
4
4
  Summary: Discord bot for Radarr/Sonarr integration
5
5
  Home-page: https://github.com/wthueb/wi1-bot
6
6
  Author-email: William Huebner <wilhueb@gmail.com>
@@ -53,10 +53,11 @@ transcoding:
53
53
  profiles:
54
54
  # name of profile must match name in radarr/sonarr
55
55
  good:
56
- # copy all video and audio streams (default is to copy only the first)
56
+ # copy all video and audio streams
57
+ # default is only to copy the first stream and any streams with the languages listed below
57
58
  copy_all_streams: false
58
- # comma separated ISO 639-2 codes, optional (default is to copy all subtitles)
59
- subtitle_languages: eng,spa
59
+ # comma separated ISO 639-2 codes, optional
60
+ languages: eng,spa
60
61
  # -c:v in ffmpeg, optional
61
62
  video_codec: hevc_nvenc
62
63
  # -b:v in ffmpeg, optional
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
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
- subtitle_languages=get_key(qp, "subtitle_languages"),
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
- subtitle_languages = StringField(required=False)
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
- subtitle_languages: str | None = None,
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
- subtitle_languages=subtitle_languages,
43
+ languages=languages,
44
44
  video_codec=video_codec,
45
45
  video_bitrate=video_bitrate,
46
46
  audio_codec=audio_codec,
@@ -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
- subs_map = ["0:s?"]
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
- for sub_map in subs_map:
230
- command.extend(["-map", sub_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", str(item.video_bitrate)])
241
- command.extend(["-maxrate", str(item.video_bitrate * 2)])
242
- command.extend(["-bufsize", str(item.video_bitrate * 2)])
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", str(item.audio_channels)])
251
+ command.extend(["-ac", item.audio_channels])
251
252
 
252
253
  if item.audio_bitrate:
253
- command.extend(["-b:a", str(item.audio_bitrate)])
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(["-scodec", "copy", str(transcode_to)])
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__":
@@ -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
- subtitle_languages = get_key(quality_options, "subtitle_languages")
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
- subtitle_languages=subtitle_languages,
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, indent=4)}")
107
+ logger.debug(f"got request: {json.dumps(request.json)}")
108
108
 
109
- if request.json["eventType"] == "Grab":
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wi1-bot
3
- Version: 1.3.15
3
+ Version: 1.4.0
4
4
  Summary: Discord bot for Radarr/Sonarr integration
5
5
  Home-page: https://github.com/wthueb/wi1-bot
6
6
  Author-email: William Huebner <wilhueb@gmail.com>
@@ -1,4 +0,0 @@
1
- # file generated by setuptools_scm
2
- # don't change, don't track in version control
3
- __version__ = version = '1.3.15'
4
- __version_tuple__ = version_tuple = (1, 3, 15)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes