wi1-bot 2.0.0__py3-none-any.whl → 2.0.2__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/config.py CHANGED
@@ -48,12 +48,13 @@ class DiscordConfig(TypedDict):
48
48
 
49
49
 
50
50
  class TranscodingProfile(TypedDict):
51
- copy_all_streams: bool
52
51
  video_codec: NotRequired[str]
53
52
  video_bitrate: NotRequired[int]
54
53
  audio_codec: NotRequired[str]
55
54
  audio_channels: NotRequired[int]
56
55
  audio_bitrate: NotRequired[str]
56
+ copy_all_streams: NotRequired[bool]
57
+ languages: NotRequired[str]
57
58
 
58
59
 
59
60
  class TranscodingConfig(TypedDict):
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import pathlib
3
+ import re
3
4
  import shlex
4
5
  import shutil
5
6
  import subprocess
@@ -14,6 +15,14 @@ from wi1_bot.config import config
14
15
 
15
16
  from .transcode_queue import TranscodeItem, queue
16
17
 
18
+ # https://github.com/Radarr/Radarr/blob/e29be26fc9a5570bdf37a1b9504b3c0162be7715/src/NzbDrone.Core/Parser/Parser.cs#L134
19
+ CLEAN_RELEASE_GROUP_REGEX = re.compile(
20
+ r"(-(RP|1|NZBGeek|Obfuscated|Obfuscation|Scrambled|sample|Pre|postbot|xpost|Rakuv[a-z0-9]*|WhiteRev|BUYMORE|AsRequested|AlternativeToRequested|GEROV|Z0iDS3N|Chamele0n|4P|4Planet|AlteZachen|RePACKPOST))+",
21
+ re.IGNORECASE,
22
+ )
23
+ # https://github.com/Radarr/Radarr/blob/e29be26fc9a5570bdf37a1b9504b3c0162be7715/src/NzbDrone.Core/Parser/Parser.cs#L138
24
+ CLEAN_TORRENT_SUFFIX_REGEX = re.compile(r"\[(?:ettv|rartv|rarbg|cttv|publichd)\]", re.IGNORECASE)
25
+
17
26
 
18
27
  class SignalInterrupt(Exception):
19
28
  pass
@@ -76,7 +85,10 @@ class Transcoder:
76
85
  tmp_folder = pathlib.Path("/tmp/wi1-bot")
77
86
  tmp_folder.mkdir(exist_ok=True)
78
87
 
79
- transcode_to = tmp_folder / f"{path.stem}-TRANSCODED.mkv"
88
+ filename = path.stem
89
+ filename = CLEAN_RELEASE_GROUP_REGEX.sub("", filename)
90
+ filename = CLEAN_TORRENT_SUFFIX_REGEX.sub("", filename)
91
+ transcode_to = tmp_folder / f"{filename}-TRANSCODED.mkv"
80
92
 
81
93
  command = self._build_ffmpeg_command(item, transcode_to)
82
94
 
@@ -273,4 +285,4 @@ class Transcoder:
273
285
  if __name__ == "__main__":
274
286
  logging.basicConfig(level=logging.DEBUG)
275
287
  t = Transcoder()
276
- t._worker()
288
+ t._worker() # pyright: ignore[reportPrivateUsage]
wi1_bot/webhook.py CHANGED
@@ -66,20 +66,13 @@ def on_download(req: dict[str, Any]) -> None:
66
66
 
67
67
  quality_options = config["transcoding"]["profiles"][quality_profile]
68
68
 
69
- # python 3.11: TranscodingProfile and typing.LiteralString
70
- def get_key(d: Any, k: str) -> Any:
71
- try:
72
- return d[k]
73
- except KeyError:
74
- return None
75
-
76
- copy_all_streams = get_key(quality_options, "copy_all_streams")
77
- languages = get_key(quality_options, "languages")
78
- video_codec = get_key(quality_options, "video_codec")
79
- video_bitrate = get_key(quality_options, "video_bitrate")
80
- audio_codec = get_key(quality_options, "audio_codec")
81
- audio_channels = get_key(quality_options, "audio_channels")
82
- audio_bitrate = get_key(quality_options, "audio_bitrate")
69
+ copy_all_streams = quality_options.get("copy_all_streams", None)
70
+ languages = quality_options.get("languages", None)
71
+ video_codec = quality_options.get("video_codec", None)
72
+ video_bitrate = quality_options.get("video_bitrate", None)
73
+ audio_codec = quality_options.get("audio_codec", None)
74
+ audio_channels = quality_options.get("audio_channels", None)
75
+ audio_bitrate = quality_options.get("audio_bitrate", None)
83
76
 
84
77
  transcoder.queue.add(
85
78
  path=str(path),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wi1-bot
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Discord bot for Radarr/Sonarr integration
5
5
  Project-URL: Homepage, https://github.com/wthueb/wi1-bot
6
6
  Author-email: William Huebner <wilhueb@gmail.com>
@@ -39,6 +39,7 @@ Requires Python >=3.11.
39
39
 
40
40
  ### TODO
41
41
 
42
+ - use overseerr for search/requests
42
43
  - use sqlite
43
44
  - dynamically copy streams
44
45
  - i.e. if mov_text in input, -c:s srt
@@ -1,7 +1,7 @@
1
1
  wi1_bot/__init__.py,sha256=dYlvBffClqwInBRSxSAoJHuujuh4yuPderFR4n7Odko,161
2
- wi1_bot/config.py,sha256=2gN9Hx2-nl2L4n3tLlW-XmmKMxL6jOSGMD4Re9um0jI,2181
2
+ wi1_bot/config.py,sha256=ndL3BxiOpXiDQGYNEIPtuusekS25miPFQrEphINxnsQ,2226
3
3
  wi1_bot/push.py,sha256=6EwQ1eXcJnQimAi0dOm1_t7Am056zob-1-EOkytGZWg,783
4
- wi1_bot/webhook.py,sha256=11rzmxhXnDeXWlgEnOLh26WP79rLeG71HaDvKUXuUcA,3665
4
+ wi1_bot/webhook.py,sha256=xTN_-Ivdt1ANJFWkhF4W8csyqwfBNH33d-eWbsWOPS4,3482
5
5
  wi1_bot/arr/__init__.py,sha256=-6UE81yY6OhD6-nbLindChE_HlwsNRuL8JijUmo_Q6k,149
6
6
  wi1_bot/arr/download.py,sha256=02AYFglnFdWSG8xj_TaJc6l2wjybyhUW6F97CnoyUFw,1381
7
7
  wi1_bot/arr/episode.py,sha256=0K_auUYwkBBd_Ludc4-4z7lSW8HRQ3mchFQ7FR10JSU,1041
@@ -22,9 +22,9 @@ wi1_bot/scripts/start.py,sha256=TfEKCxS_95L5ZTi8OY45ywsgNnKlsqLDN6YesowifvM,2527
22
22
  wi1_bot/scripts/transcode_item.py,sha256=21MeeIZ9wIRhAY-FOEgOdPsg6YOLlSUj59r8NkTfixw,1155
23
23
  wi1_bot/transcoder/__init__.py,sha256=B4xr82UtIFc3tyy_MEZdZKMukYW0yejPnfsGowaTIM0,105
24
24
  wi1_bot/transcoder/transcode_queue.py,sha256=W7r2I7OD8QuxseCEb7_ddOvYXiBBLmKLvCs2IgJJ92I,1856
25
- wi1_bot/transcoder/transcoder.py,sha256=2wIgDPkrrXcrSjA1HpYGd0RX5wonw1zfltJqGzCaorM,9163
26
- wi1_bot-2.0.0.dist-info/METADATA,sha256=Bwt1ZBD6ZLxmbMt3rn5sU2yl-JMMxYlxYCAfeGnO4bY,3663
27
- wi1_bot-2.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
- wi1_bot-2.0.0.dist-info/entry_points.txt,sha256=pF5EawAQsUNMHs5exynpNdRq9g4dODg-RaPkx2MyYLU,184
29
- wi1_bot-2.0.0.dist-info/licenses/LICENSE,sha256=6V4_mQoPoLJl77_WMsQRQMDG2mnIhDUdfCmMkqM9Qwc,1072
30
- wi1_bot-2.0.0.dist-info/RECORD,,
25
+ wi1_bot/transcoder/transcoder.py,sha256=bU2oKQckBWWppJOH9W8vk_ql2uz3qs8O63wAYKH1bbk,9978
26
+ wi1_bot-2.0.2.dist-info/METADATA,sha256=Oy614tRy_DoW7yAi7dKmIFtMFXP714GZ1iYm_Vr-P6U,3699
27
+ wi1_bot-2.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
28
+ wi1_bot-2.0.2.dist-info/entry_points.txt,sha256=pF5EawAQsUNMHs5exynpNdRq9g4dODg-RaPkx2MyYLU,184
29
+ wi1_bot-2.0.2.dist-info/licenses/LICENSE,sha256=6V4_mQoPoLJl77_WMsQRQMDG2mnIhDUdfCmMkqM9Qwc,1072
30
+ wi1_bot-2.0.2.dist-info/RECORD,,