Unit3Dup 0.8.16__tar.gz → 0.8.18__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 (105) hide show
  1. {unit3dup-0.8.16 → unit3dup-0.8.18}/PKG-INFO +1 -1
  2. {unit3dup-0.8.16 → unit3dup-0.8.18}/Unit3Dup.egg-info/PKG-INFO +1 -1
  3. {unit3dup-0.8.16 → unit3dup-0.8.18}/Unit3Dup.egg-info/SOURCES.txt +1 -2
  4. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/command.py +1 -0
  5. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/settings.py +1 -1
  6. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/utility.py +6 -0
  7. {unit3dup-0.8.16 → unit3dup-0.8.18}/pyproject.toml +1 -1
  8. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/__main__.py +1 -2
  9. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/automode.py +1 -0
  10. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media.py +0 -6
  11. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/ContentManager.py +4 -4
  12. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/torrent.py +9 -8
  13. unit3dup-0.8.18/view/web_console.py +205 -0
  14. unit3dup-0.8.16/view/custom_console2.py +0 -139
  15. unit3dup-0.8.16/view/settings.py +0 -31
  16. {unit3dup-0.8.16 → unit3dup-0.8.18}/LICENSE +0 -0
  17. {unit3dup-0.8.16 → unit3dup-0.8.18}/README.rst +0 -0
  18. {unit3dup-0.8.16 → unit3dup-0.8.18}/Unit3Dup.egg-info/dependency_links.txt +0 -0
  19. {unit3dup-0.8.16 → unit3dup-0.8.18}/Unit3Dup.egg-info/entry_points.txt +0 -0
  20. {unit3dup-0.8.16 → unit3dup-0.8.18}/Unit3Dup.egg-info/requires.txt +0 -0
  21. {unit3dup-0.8.16 → unit3dup-0.8.18}/Unit3Dup.egg-info/top_level.txt +0 -0
  22. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/__init__.py +0 -0
  23. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/bdinfo_string.py +0 -0
  24. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/bittorrent.py +0 -0
  25. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/constants.py +0 -0
  26. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/database.py +0 -0
  27. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/__init__.py +0 -0
  28. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/__init__.py +0 -0
  29. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/client.py +0 -0
  30. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/core/__init__.py +0 -0
  31. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/core/ftpx_service.py +0 -0
  32. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/core/ftpx_session.py +0 -0
  33. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/core/menu.py +0 -0
  34. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/core/models/__init__.py +0 -0
  35. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/ftpx/core/models/list.py +0 -0
  36. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/__init__.py +0 -0
  37. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/client.py +0 -0
  38. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/core/__init__.py +0 -0
  39. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/core/api.py +0 -0
  40. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/core/models/__init__.py +0 -0
  41. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/core/models/search.py +0 -0
  42. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/core/platformid.py +0 -0
  43. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/igdb/core/tags.py +0 -0
  44. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/imageHost.py +0 -0
  45. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/imdb.py +0 -0
  46. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/mediaresult.py +0 -0
  47. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/sessions/__init__.py +0 -0
  48. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/sessions/agents.py +0 -0
  49. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/sessions/exceptions.py +0 -0
  50. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/sessions/session.py +0 -0
  51. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/__init__.py +0 -0
  52. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/__init__.py +0 -0
  53. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/api.py +0 -0
  54. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/keywords.py +0 -0
  55. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/__init__.py +0 -0
  56. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/movie/__init__.py +0 -0
  57. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/movie/alternative_titles.py +0 -0
  58. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/movie/details.py +0 -0
  59. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/movie/movie.py +0 -0
  60. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/movie/nowplaying.py +0 -0
  61. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/movie/release_info.py +0 -0
  62. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/tvshow/__init__.py +0 -0
  63. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/tvshow/alternative.py +0 -0
  64. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/tvshow/details.py +0 -0
  65. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/tvshow/on_the_air.py +0 -0
  66. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/tvshow/translations.py +0 -0
  67. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/models/tvshow/tvshow.py +0 -0
  68. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/theMovieDB/core/videos.py +0 -0
  69. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/trailers/__init__.py +0 -0
  70. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/trailers/api.py +0 -0
  71. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/external_services/trailers/response.py +0 -0
  72. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/extractor.py +0 -0
  73. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/frames.py +0 -0
  74. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/mediainfo.py +0 -0
  75. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/mediainfo_string.py +0 -0
  76. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/title.py +0 -0
  77. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/torrent_clients.py +0 -0
  78. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/trackers/__init__.py +0 -0
  79. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/trackers/data.py +0 -0
  80. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/trackers/itt.py +0 -0
  81. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/trackers/sis.py +0 -0
  82. {unit3dup-0.8.16 → unit3dup-0.8.18}/common/trackers/trackers.py +0 -0
  83. {unit3dup-0.8.16 → unit3dup-0.8.18}/requirements.txt +0 -0
  84. {unit3dup-0.8.16 → unit3dup-0.8.18}/setup.cfg +0 -0
  85. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/__init__.py +0 -0
  86. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/bot.py +0 -0
  87. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/duplicate.py +0 -0
  88. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/exceptions.py +0 -0
  89. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/DocuManager.py +0 -0
  90. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/GameManager.py +0 -0
  91. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/MediaInfoManager.py +0 -0
  92. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/SeedManager.py +0 -0
  93. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/TorrentManager.py +0 -0
  94. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/VideoManager.py +0 -0
  95. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/__init__.py +0 -0
  96. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/media_manager/common.py +0 -0
  97. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/pvtDocu.py +0 -0
  98. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/pvtTorrent.py +0 -0
  99. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/pvtTracker.py +0 -0
  100. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/pvtVideo.py +0 -0
  101. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/upload.py +0 -0
  102. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/web/__init__.py +0 -0
  103. {unit3dup-0.8.16 → unit3dup-0.8.18}/unit3dup/web/main.py +0 -0
  104. {unit3dup-0.8.16 → unit3dup-0.8.18}/view/__init__.py +0 -0
  105. {unit3dup-0.8.16 → unit3dup-0.8.18}/view/custom_console.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Unit3Dup
3
- Version: 0.8.16
3
+ Version: 0.8.18
4
4
  Summary: An uploader for the Unit3D torrent tracker
5
5
  Author: Parzival
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Unit3Dup
3
- Version: 0.8.16
3
+ Version: 0.8.18
4
4
  Summary: An uploader for the Unit3D torrent tracker
5
5
  Author: Parzival
6
6
  License-Expression: MIT
@@ -98,5 +98,4 @@ unit3dup/web/__init__.py
98
98
  unit3dup/web/main.py
99
99
  view/__init__.py
100
100
  view/custom_console.py
101
- view/custom_console2.py
102
- view/settings.py
101
+ view/web_console.py
@@ -48,6 +48,7 @@ class CommandLine:
48
48
  # optional
49
49
  parser.add_argument("-dump", "--dump", action="store_true", help="Download all torrent titles")
50
50
  parser.add_argument("-s", "--search", type=str, help="Search for torrent")
51
+ parser.add_argument("-db", "--dbsave", action="store_true", help="Save the search results")
51
52
  parser.add_argument("-i", "--info", type=str, help="Get info on torrent")
52
53
  parser.add_argument("-up", "--uploader", type=str, help="Search by uploader")
53
54
  parser.add_argument("-desc", "--description", type=str, help="Search by description")
@@ -13,7 +13,7 @@ from common.utility import ManageTitles
13
13
  from common import trackers
14
14
 
15
15
  config_file = "Unit3Dbot.json"
16
- version = "0.8.16"
16
+ version = "0.8.18"
17
17
 
18
18
  if os.name == "nt":
19
19
  PW_TORRENT_ARCHIVE_PATH: Path = Path(os.getenv("LOCALAPPDATA", ".")) / "Unit3Dup_config" / "pw_torrent_archive"
@@ -37,6 +37,11 @@ class ManageTitles:
37
37
  "BR": "BRA",
38
38
  "RU": "RUS",
39
39
  "CN": "CHN",
40
+ "EN-US": "ENG",
41
+ "EN-GB": "ENG",
42
+ "EN-AU": "ENG",
43
+ "ES-ES": "ESP",
44
+ "ES-MX": "ESP"
40
45
  }
41
46
 
42
47
  @staticmethod
@@ -191,6 +196,7 @@ class ManageTitles:
191
196
  (r'\bCINEMA \bMD\b', 'CINEMA-MD'),
192
197
  (r'\bHEVC \bFHC\b', 'HEVC-FHC'),
193
198
  (r'\bCBR \bCBZ\b', 'CBR-CBZ'),
199
+ (r'\bH \b264\b', 'H.264'),
194
200
 
195
201
  ]
196
202
 
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  dynamic = ["dependencies"]
7
7
  name = "Unit3Dup"
8
- version = "0.8.16"
8
+ version = "0.8.18"
9
9
  description = "An uploader for the Unit3D torrent tracker"
10
10
  readme = "README.rst"
11
11
  requires-python = ">=3.10"
@@ -145,8 +145,7 @@ def main():
145
145
 
146
146
  # Search by different criteria
147
147
  if cli.args.search:
148
- print("NOT YET IMPLEMENTED")
149
- # torrent_info.view_search(cli.args.search)
148
+ torrent_info.view_search(cli.args.search, save=cli.args.dbsave)
150
149
  return
151
150
 
152
151
  # Dump
@@ -45,6 +45,7 @@ class Auto:
45
45
  if self.auto == "folder":
46
46
  # -f command (single folder series or 'saga')
47
47
  return self._lists(files_path=[], subfolders_path=[self.path])
48
+ return None
48
49
  else:
49
50
  return self._lists(files_path=[self.path], subfolders_path=[])
50
51
 
@@ -14,7 +14,6 @@ class Media:
14
14
  self.folder: str = folder
15
15
  self.subfolder: str = subfolder
16
16
  self.title: str = os.path.basename(os.path.join(self.folder, self.subfolder))
17
- self._not_title_lang = False
18
17
 
19
18
  # // Media
20
19
  self._crew_list: list[str] | None = None
@@ -53,9 +52,6 @@ class Media:
53
52
  self._igdb_id: int | None = None
54
53
  self._generate_title: str | None = None
55
54
 
56
- @property
57
- def no_title_lang(self) -> bool:
58
- return self._not_title_lang
59
55
 
60
56
  @property
61
57
  def title_sanitized(self)-> str:
@@ -283,8 +279,6 @@ class Media:
283
279
  if converted_code := ManageTitles.convert_iso(code):
284
280
  self._audio_languages = converted_code
285
281
  return self._audio_languages
286
- # no language found in title
287
- self._not_title_lang = True
288
282
  # get from the audio track
289
283
  self._audio_languages = self.languages
290
284
  return self._audio_languages
@@ -51,10 +51,6 @@ class ContentManager:
51
51
  content = self.get_data(media=media)
52
52
  if content:
53
53
  contents.append(content)
54
-
55
- # Add language to the title from the media file when it's absent
56
- if not media._not_title_lang:
57
- media.display_name = " ".join([media.display_name] + media.audio_languages)
58
54
  return contents
59
55
 
60
56
  def get_data(self, media: Media) -> Media | bool:
@@ -93,6 +89,10 @@ class ContentManager:
93
89
  media.igdb_id = self.igdb_id
94
90
  media.display_name = self.display_name
95
91
 
92
+ # Add language to the title from the media file when it's absent
93
+ for found_languages in media.audio_languages:
94
+ if found_languages not in media.display_name.upper():
95
+ media.display_name = f"{media.display_name} {found_languages}"
96
96
  return media
97
97
  else:
98
98
  return False
@@ -174,7 +174,7 @@ class View(Torrent):
174
174
  f" -> {item['attributes']['name']}"
175
175
  )
176
176
 
177
- def print_normal(self, tracker_data: dict):
177
+ def print_normal(self, tracker_data: dict, save= False):
178
178
  data = [item for item in tracker_data["data"]]
179
179
  for item in data:
180
180
  if item['attributes']['tmdb_id'] != 0:
@@ -192,13 +192,14 @@ class View(Torrent):
192
192
 
193
193
  # Print a data to the console
194
194
  custom_console.bot_log(f"\n {media} - {item['attributes']['name']}")
195
- # Save torrent data into database
196
- self.database.write(item['attributes'])
195
+ # Save torrent data into database by -db flag
196
+ if save:
197
+ self.database.write(item['attributes'])
197
198
 
198
199
 
199
- def page_view(self, tracker_data: dict, tracker: pvtTracker, info=False, inkey=True):
200
+ def page_view(self, tracker_data: dict, tracker: pvtTracker, info=False, inkey=True, save=False):
200
201
 
201
- self.print_normal(tracker_data) if not info else self.print_info(tracker_data)
202
+ self.print_normal(tracker_data,save=save) if not info else self.print_info(tracker_data)
202
203
  page = 0
203
204
  while True:
204
205
  if not tracker_data["links"]["next"]:
@@ -219,16 +220,16 @@ class View(Torrent):
219
220
  custom_console.rule(f"\n[bold blue]'Page -> {page}'", style="#ea00d9")
220
221
  tracker_data = tracker.next(url=tracker_data["links"]["next"])
221
222
  (
222
- self.print_normal(tracker_data)
223
+ self.print_normal(tracker_data, save=save)
223
224
  if not info
224
225
  else self.print_info(tracker_data)
225
226
  )
226
227
 
227
- def view_search(self, keyword: str, info=False, inkey=True):
228
+ def view_search(self, keyword: str, info=False, inkey=True, save=False):
228
229
  tracker_data = self.search(keyword=keyword)
229
230
  custom_console.log(f"Searching.. '{keyword}'")
230
231
  (
231
- self.page_view(tracker_data=tracker_data, tracker=self.tracker,inkey=inkey)
232
+ self.page_view(tracker_data=tracker_data, tracker=self.tracker,inkey=inkey, save=save)
232
233
  if not info
233
234
  else self.page_view(
234
235
  tracker_data=tracker_data, tracker=self.tracker, info=True
@@ -0,0 +1,205 @@
1
+ # -*- coding: utf-8 -*-
2
+ from rich.align import Align
3
+ from rich.console import Console
4
+ from rich.panel import Panel
5
+ from rich.text import Text
6
+ from rich.table import Table
7
+ from nicegui import ui
8
+ from common import config_settings
9
+
10
+ class CustomConsole(Console):
11
+ def __init__(self):
12
+ super().__init__(log_path=False)
13
+
14
+ ui.add_head_html('''
15
+ <style>
16
+ html, body {
17
+ margin: 0;
18
+ padding: 0;
19
+ overflow: hidden;
20
+ height: 100%;
21
+ background-color: #002b36;
22
+ }
23
+ </style>
24
+ ''')
25
+
26
+ self.colors = {
27
+ 'info': '#839496', # grigio chiaro
28
+ 'cmd': '#93a1a1', # input comando
29
+ 'success': '#859900', # verde
30
+ 'error': '#dc322f', # rosso
31
+ 'warning': '#b58900', # giallo
32
+ 'highlight': '#268bd2', # blu
33
+ 'log': '#586e75', # grigio scuro
34
+ 'message': '#2aa198', # ciano tenue
35
+ }
36
+
37
+ self.container = ui.column().style(
38
+ '''
39
+ width: 90vw;
40
+ height: 90vh;
41
+ background-color: #002b36;
42
+ color: #839496;
43
+ font-family: 'Fira Code', 'Cascadia Code', monospace;
44
+ font-size: clamp(0.8rem, 1.5vw, 1rem);
45
+ padding: 1rem;
46
+ overflow-y: auto;
47
+ border: 1px solid #586e75;
48
+ box-sizing: border-box;
49
+ white-space: pre-wrap;
50
+ margin: auto;
51
+ display: flex;
52
+ flex-direction: column;
53
+ row-gap: 0;
54
+ '''
55
+ )
56
+
57
+ def welcome_message(self):
58
+ title_panel = Panel(
59
+ Text(f"UNIT3Dup - An uploader for the Unit3D torrent tracker -\n{config_settings.console_options.WELCOME_MESSAGE}",
60
+ style=config_settings.console_options.WELCOME_MESSAGE_COLOR, justify="center"),
61
+ border_style=config_settings.console_options.WELCOME_MESSAGE_BORDER_COLOR,
62
+ title_align="center",
63
+ )
64
+ self.print(title_panel)
65
+
66
+ def panel_message(self, message: str):
67
+ title_panel = Panel(
68
+ Text(message, style=config_settings.console_options.PANEL_MESSAGE_COLOR, justify="center"),
69
+ border_style=config_settings.console_options.PANEL_MESSAGE_BORDER_COLOR,
70
+ title_align="center",
71
+ expand=False,
72
+ )
73
+ self.print(title_panel, justify="center")
74
+
75
+ def bot_log(self, message: str):
76
+ self.log(message, style=config_settings.console_options.NORMAL_COLOR)
77
+ self._print(message, self.colors['info'])
78
+
79
+
80
+ def bot_error_log(self, message: str):
81
+ self.log(message, style=config_settings.console_options.ERROR_COLOR)
82
+ self._print(message, self.colors['error'])
83
+
84
+
85
+ def bot_warning_log(self, message: str):
86
+ self.log(message, style=config_settings.console_options.QUESTION_MESSAGE_COLOR)
87
+ self._print(message, self.colors['warning'])
88
+
89
+ def bot_input_log(self, message: str):
90
+ self.print(f"{message} ", end="", style=config_settings.console_options.NORMAL_COLOR)
91
+
92
+ def bot_question_log(self, message: str):
93
+ self.print(message, end="", style=config_settings.console_options.QUESTION_MESSAGE_COLOR)
94
+
95
+ def bot_counter_log(self, message: str):
96
+ self.print(message, end="\r", style=config_settings.console_options.QUESTION_MESSAGE_COLOR)
97
+
98
+ def bot_process_table_log(self, content: list):
99
+
100
+ table = Table(
101
+ title="Here is your files list" if content else "There are no files here",
102
+ border_style="bold blue",
103
+ header_style="red blue",
104
+ )
105
+
106
+ table.add_column("Torrent Pack", style="dim")
107
+ table.add_column("Media", justify="left", style="bold green")
108
+ table.add_column("Path", justify="left", style="bold green")
109
+
110
+ for item in content:
111
+ pack = "Yes" if item.torrent_pack else "No"
112
+ table.add_row(
113
+ pack,
114
+ item.category,
115
+ item.torrent_path,
116
+ )
117
+
118
+ self.print(Align.center(table))
119
+
120
+ def bot_process_table_pw(self, content: list):
121
+
122
+ table = Table(
123
+ title="Here is your files list" if content else "There are no files here",
124
+ border_style="bold blue",
125
+ header_style="red blue",
126
+ )
127
+
128
+ table.add_column("Category", style="dim")
129
+ table.add_column("Indexer", justify="left", style="bold green")
130
+ table.add_column("Title", justify="left", style="bold green")
131
+ table.add_column("Size", justify="left", style="bold green")
132
+ table.add_column("Seeders", justify="left", style="bold green")
133
+
134
+ for item in content:
135
+ table.add_row(
136
+ item.categories[0]['name'],
137
+ item.indexer,
138
+ item.title,
139
+ str(item.size),
140
+ str(item.seeders),
141
+ )
142
+
143
+ self.print(Align.center(table))
144
+
145
+ def bot_tmdb_table_log(self, result, title: str, media_info_language: str):
146
+
147
+ self.print("\n")
148
+ media_info_audio_languages = (",".join(media_info_language)).upper()
149
+ self.panel_message(f"\nResults for {title.upper()}")
150
+
151
+ table = Table(border_style="bold blue")
152
+ table.add_column("TMDB ID", style="dim")
153
+ table.add_column("LANGUAGE", style="dim")
154
+ table.add_column("TMDB POSTER", justify="left", style="bold green")
155
+ table.add_column("TMDB BACKDROP", justify="left", style="bold green")
156
+ # table.add_column("TMDB KEYWORDS", justify="left", style="bold green")
157
+ table.add_row(
158
+ str(result.video_id),
159
+ media_info_audio_languages,
160
+ result.poster_path,
161
+ result.backdrop_path,
162
+ )
163
+ self.print(Align.center(table))
164
+
165
+ def wait_for_user_confirmation(self, message: str):
166
+ # Wait for user confirmation in case of validation failure
167
+ try:
168
+ self.bot_error_log(message=message)
169
+ input("> ")
170
+ except KeyboardInterrupt:
171
+ self.bot_error_log("\nOperation cancelled.Please update your config file")
172
+ exit(0)
173
+
174
+ def user_input(self,message: str)-> int:
175
+ try:
176
+ while True:
177
+ self.bot_input_log(message=message)
178
+ user_tmdb_id = input()
179
+ if user_tmdb_id.isdigit():
180
+ user_tmdb_id = int(user_tmdb_id)
181
+ return user_tmdb_id if user_tmdb_id < 9999999 else 0
182
+ except KeyboardInterrupt:
183
+ self.bot_error_log("\nOperation cancelled. Bye !")
184
+ exit(0)
185
+
186
+ def user_input_str(self,message: str)-> str:
187
+ try:
188
+ while True:
189
+ self.bot_input_log(message=message)
190
+ user_ = input()
191
+ return user_ if user_ else '0'
192
+ except KeyboardInterrupt:
193
+ self.bot_error_log("\nOperation cancelled. Bye !")
194
+ exit(0)
195
+
196
+
197
+ def _print(self, text: str, color: str):
198
+ with self.container:
199
+ ui.label(text).style(f'color: {color}; font-family: monospace;')
200
+
201
+ # def print_cmd(self, text: str): self._print(text, self.colors['cmd'])
202
+ def print_success(self, text: str): self._print(text, self.colors['success'])
203
+ def print_highlight(self, text: str): self._print(text, self.colors['highlight'])
204
+ def print_srv_log(self, text: str): self._print(text, self.colors['log'])
205
+ def print_message(self, text: str): self._print(text, self.colors['message'])
@@ -1,139 +0,0 @@
1
- from nicegui import ui
2
- from typing import List, Callable
3
- from common import config_settings
4
- from datetime import datetime
5
-
6
-
7
- class NiceGUIConsole:
8
- def __init__(self):
9
- self.init_footer_log()
10
- self.log_area = ui.column().style('max-height: 400px; overflow-y: auto; border: 1px solid #ccc; padding: 10px')
11
- self.counter_label = ui.label()
12
-
13
- def init_footer_log(self):
14
- with ui.element('div').style('''
15
- position: fixed;
16
- bottom: 0;
17
- left: 0;
18
- width: 100%;
19
- background-color: #2e3b4e;
20
- text-align: center;
21
- padding: 4px 8px; /* meno padding verticale */
22
- font-size: 14px;
23
- line-height: 18px;
24
- z-index: 1000;
25
- ''') as footer:
26
- self.footer_label = ui.label("Ready.").style("color: white; margin: 0")
27
-
28
- def log_message(self, message: str, color: str = "#ffffff"):
29
- timestamp = datetime.now().strftime("%H:%M:%S")
30
- """
31
- with self.log_area:
32
- ui.label(f"[{timestamp}] {message}").style(f'color: {color}; white-space: pre-wrap')
33
- """
34
- self.footer_label.text = f"${timestamp}$ {message}"
35
- self.footer_label.style(f"color: {color}")
36
-
37
-
38
- def panel_message(self, message: str, color: str = "#ccc"):
39
- with ui.card().style(f'background-color: {color}; color: white'):
40
- ui.label(message).style("text-align: center")
41
-
42
- def bot_log(self, message: str):
43
- self._add_log(message, config_settings.console_options.NORMAL_COLOR)
44
-
45
- def bot_error_log(self, message: str):
46
- self._add_log(f'❌ {message}', config_settings.console_options.ERROR_COLOR)
47
-
48
- def bot_warning_log(self, message: str):
49
- self._add_log(f'⚠️ {message}', config_settings.console_options.QUESTION_MESSAGE_COLOR)
50
-
51
- def bot_input_log(self, message: str):
52
- self._add_log(message, config_settings.console_options.NORMAL_COLOR)
53
-
54
- def bot_question_log(self, message: str):
55
- self._add_log(message, config_settings.console_options.QUESTION_MESSAGE_COLOR)
56
-
57
- def bot_counter_log(self, message: str):
58
- self.counter_label.set_text(message)
59
- self.counter_label.style(f'color: {config_settings.console_options.QUESTION_MESSAGE_COLOR}')
60
-
61
- def bot_process_table_log(self, content: List):
62
- ui.label("Here is your files list" if content else "There are no files here")
63
- ui.table(columns=[
64
- {'name': 'pack', 'label': 'Torrent Pack', 'field': 'pack'},
65
- {'name': 'category', 'label': 'Media', 'field': 'category'},
66
- {'name': 'path', 'label': 'Path', 'field': 'path'},
67
- ], rows=[
68
- {
69
- 'pack': 'Yes' if item.torrent_pack else 'No',
70
- 'category': item.category,
71
- 'path': item.torrent_path,
72
- } for item in content
73
- ])
74
-
75
- def bot_process_table_pw(self, content: List):
76
- ui.label("Here is your files list" if content else "There are no files here")
77
- ui.table(columns=[
78
- {'name': 'category', 'label': 'Category', 'field': 'category'},
79
- {'name': 'indexer', 'label': 'Indexer', 'field': 'indexer'},
80
- {'name': 'title', 'label': 'Title', 'field': 'title'},
81
- {'name': 'size', 'label': 'Size', 'field': 'size'},
82
- {'name': 'seeders', 'label': 'Seeders', 'field': 'seeders'},
83
- ], rows=[
84
- {
85
- 'category': item.categories[0]['name'],
86
- 'indexer': item.indexer,
87
- 'title': item.title,
88
- 'size': str(item.size),
89
- 'seeders': str(item.seeders),
90
- } for item in content
91
- ])
92
-
93
- def bot_tmdb_table_log(self, result, title: str, media_info_language: List[str]):
94
- media_info_audio_languages = ", ".join(media_info_language).upper()
95
- self.panel_message(f"Results for {title.upper()}")
96
-
97
- ui.table(columns=[
98
- {'name': 'tmdb_id', 'label': 'TMDB ID', 'field': 'tmdb_id'},
99
- {'name': 'language', 'label': 'LANGUAGE', 'field': 'language'},
100
- {'name': 'poster', 'label': 'TMDB POSTER', 'field': 'poster'},
101
- {'name': 'backdrop', 'label': 'TMDB BACKDROP', 'field': 'backdrop'},
102
- ], rows=[{
103
- 'tmdb_id': str(result.video_id),
104
- 'language': media_info_audio_languages,
105
- 'poster': result.poster_path,
106
- 'backdrop': result.backdrop_path,
107
- }])
108
-
109
- def wait_for_user_confirmation(self, message: str, on_confirm: Callable):
110
- self.bot_error_log(message)
111
- with ui.row():
112
- ui.button("OK", on_click=on_confirm)
113
- ui.button("Cancel",
114
- on_click=lambda: self.bot_error_log("Operation cancelled. Please update your config file."))
115
-
116
- def user_input(self, message: str, on_submit: Callable[[int], None]):
117
- with ui.row():
118
- input_field = ui.input(label=message, placeholder="Enter TMDB ID").props("type=number")
119
- ui.button("Submit", on_click=lambda: self._validate_and_submit(input_field.value, on_submit))
120
-
121
- def user_input_str(self, message: str, on_submit: Callable[[str], None]):
122
- with ui.row():
123
- input_field = ui.input(label=message, placeholder="Enter text")
124
- ui.button("Submit", on_click=lambda: on_submit(input_field.value or "0"))
125
-
126
- def _add_log(self, message: str, color: str = "#fff"):
127
- timestamp = datetime.now().strftime("%H:%M:%S")
128
- with self.log_area:
129
- ui.label(f"[{timestamp}] {message}").style(f'color: {color}; white-space: pre-wrap')
130
-
131
- def _validate_and_submit(self, value: str, on_submit: Callable[[int], None]):
132
- try:
133
- if value.isdigit():
134
- user_id = int(value)
135
- on_submit(user_id if user_id < 9999999 else 0)
136
- else:
137
- self.bot_error_log("Please enter a valid number.")
138
- except Exception as e:
139
- self.bot_error_log(f"Error: {str(e)}")
@@ -1,31 +0,0 @@
1
- from nicegui import ui
2
-
3
- class SettingsPanel:
4
- def __init__(self):
5
- with ui.column().classes('items-center q-pa-xl'):
6
-
7
- # Header
8
- ui.label("Settings").style('font-size: 32px; font-weight: bold; color: #2e3b4e')
9
-
10
- # Settings card
11
- with ui.card().style('max-width: 400px; width: 100%; padding: 20px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1)'):
12
-
13
- self._setting_group("Account Settings", [
14
- ("Enable notifications", True),
15
- ("Allow email updates", False),
16
- ])
17
-
18
- ui.separator().style("margin: 20px 0")
19
-
20
- self._setting_group("Privacy", [
21
- ("Location tracking", False),
22
- ("Data sharing", True),
23
- ])
24
-
25
- def _setting_group(self, title: str, settings: list[tuple[str, bool]]):
26
- ui.label(title).style('font-size: 18px; font-weight: 500; margin-bottom: 10px; color: #333')
27
-
28
- for label_text, default_value in settings:
29
- with ui.row().style('justify-content: space-between; align-items: center; margin-bottom: 12px'):
30
- ui.label(label_text).style("font-size: 14px; color: #555")
31
- ui.switch(value=default_value)
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