Skip to content

Commit

Permalink
Fixed is_print_console paramenter on the main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Aug 7, 2023
1 parent eb092e9 commit 909f008
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/Package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ jobs:
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: get_cur_time
uses: srfrnk/current-time@master
id: get_cur_time
with:
format: YYYY-MM-DD-HH-mm-ss
- name: create_release
id: create_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: Draft-${{ steps.get_cur_time.outputs.formattedTime }}
automatic_release_tag: ${{ github.ref_name }}
prerelease: false
draft: true

Expand Down
1 change: 1 addition & 0 deletions rapid_videocr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
from .logger import logger
from .main import RapidVideoSubFinderOCR
from .rapid_videocr import RapidVideOCR, RapidVideOCRError
6 changes: 3 additions & 3 deletions rapid_videocr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(
is_concat_rec: bool = False,
concat_batch: int = 10,
out_format: str = "all",
print_console: bool = False,
is_print_console: bool = False,
vsf_exe_path: Optional[str] = None,
clear_dirs: bool = True,
run_search: bool = True,
Expand Down Expand Up @@ -71,7 +71,7 @@ def __init__(
is_concat_rec=is_concat_rec,
concat_batch=concat_batch,
out_format=out_format,
is_print_console=print_console,
is_print_console=is_print_console,
)
self.video_formats = [".mp4", ".avi", ".mov", ".mkv"]

Expand Down Expand Up @@ -160,7 +160,7 @@ def main():
)
videocr_param_group.add_argument(
"-p",
"--print_console",
"--is_print_console",
action="store_true",
default=False,
help="Whether to print the subtitle results to console. -p means to print.",
Expand Down
15 changes: 12 additions & 3 deletions ui/RapidVideOCR.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# @Author: SWHL
# @Contact: [email protected]
import sys
import traceback
from pathlib import Path

from PyQt5.QtCore import QRect, QSettings
Expand All @@ -21,7 +22,7 @@
QWidget,
)

from rapid_videocr import RapidVideOCR, RapidVideoSubFinderOCR
from rapid_videocr import RapidVideOCR, RapidVideoSubFinderOCR, logger


class RapidVideOCRUI(QWidget):
Expand Down Expand Up @@ -388,7 +389,11 @@ def only_ocr(self, is_select_mode: bool, batch_num: str):

save_dir = Path(save_full_path).parent
save_name = Path(save_full_path).stem
extractor(img_dir, save_dir, save_name)
try:
extractor(img_dir, save_dir, save_name)
except Exception as e:
error = traceback.format_exc()
logger.error(error)

def vsf_ocr(self, is_select_mode: bool, batch_num: str):
vsf_exe_path = self.le_vsf_path.text().strip()
Expand All @@ -413,7 +418,11 @@ def vsf_ocr(self, is_select_mode: bool, batch_num: str):
concat_batch=int(batch_num),
is_print_console=False,
)
extractor(video_path, save_dir)
try:
extractor(video_path, save_dir)
except Exception:
error = traceback.format_exc()
logger.error(error)

def click_cancel(
self,
Expand Down

0 comments on commit 909f008

Please sign in to comment.