Skip to content

Commit 611e73c

Browse files
authored
Add files via upload
1 parent 8977c1f commit 611e73c

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

Manga Processor.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def convert_cbz_cbr(self):
252252

253253
files_to_convert = [
254254
f for f in os.listdir(self.source_dir)
255-
if f.lower().endswith((".cbz", ".cbr"))
255+
if f.lower().endswith((".cbz", ".cbr", ".zip")) # Include .zip files
256256
]
257257

258258
for file in files_to_convert:
@@ -261,9 +261,19 @@ def convert_cbz_cbr(self):
261261
break
262262

263263
old_path = os.path.join(self.source_dir, file)
264-
new_extension = ".cbr" if file.lower().endswith(".cbz") else ".cbz"
264+
265+
# Determine the new extension
266+
if file.lower().endswith(".cbz"):
267+
new_extension = ".cbr"
268+
elif file.lower().endswith(".cbr"):
269+
new_extension = ".cbz"
270+
elif file.lower().endswith(".zip"):
271+
new_extension = ".cbz" # Convert .zip to .cbz
272+
else:
273+
continue
274+
265275
new_path = os.path.join(self.source_dir, os.path.splitext(file)[0] + new_extension)
266-
276+
267277
try:
268278
os.rename(old_path, new_path)
269279
self.update_console.emit(f"Converted: {file} -> {os.path.basename(new_path)}")
@@ -272,6 +282,7 @@ def convert_cbz_cbr(self):
272282

273283
self.update_console.emit("\nFile Conversion Complete!")
274284

285+
275286
class MangaProcessor(QMainWindow):
276287
def __init__(self):
277288
super().__init__()
@@ -311,8 +322,8 @@ def __init__(self):
311322
self.reverse_process_button.clicked.connect(self.start_reverse_processing)
312323
self.reverse_process_button.setStyleSheet("background-color: #0066CC; color: #FFFFFF; border: none; padding: 8px 16px;")
313324

314-
# Convert CBZ/CBR button
315-
self.convert_button = QPushButton("Convert CBZ/CBR")
325+
# Convert CBZ/CBR/ZIP button
326+
self.convert_button = QPushButton("Convert CBZ/CBR/ZIP")
316327
self.convert_button.clicked.connect(self.start_conversion)
317328
self.convert_button.setStyleSheet("background-color: #FF9900; color: #FFFFFF; border: none; padding: 8px 16px;")
318329

0 commit comments

Comments
 (0)