Skip to content

Commit

Permalink
Fix created_lock_file error when startup etc fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Emily3403 committed May 4, 2024
1 parent a4ce9e7 commit 1d569fe
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/isisdl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

import argparse
import atexit
import colorama
import distro as distro
import enum
import json
import os
import platform
import random
import re
import requests
import shutil
import signal
import stat
Expand All @@ -22,21 +25,17 @@
from datetime import datetime
from functools import wraps
from itertools import repeat
from packaging import version
from packaging.version import Version
from pathlib import Path
from queue import PriorityQueue, Queue, Full, Empty
from requests import Session
from tempfile import TemporaryDirectory
from threading import Thread
from typing import Callable, List, Tuple, Dict, Any, Set, cast, Iterable, NoReturn, TYPE_CHECKING, DefaultDict
from typing import Optional, Union
from urllib.parse import unquote, parse_qs, urlparse

import colorama
import distro as distro
import requests
from packaging import version
from packaging.version import Version
from requests import Session

from isisdl import settings
from isisdl.backend.database_helper import DatabaseHelper
from isisdl.settings import download_chunk_size, token_queue_download_refresh_rate, forbidden_chars, replace_dot_at_end_of_dir_name, force_filesystem, has_ffmpeg, fstype, log_file_location, \
Expand Down Expand Up @@ -254,9 +253,9 @@ def encode_yaml(st: Union[bool, str, int, None, Dict[int, str]]) -> str:


def generate_config_str(
working_dir_location: str, database_file_location: str, master_password: str, filename_replacing: bool, download_videos: bool, whitelist: Optional[List[int]], blacklist: Optional[List[int]],
throttle_rate: Optional[int], throttle_rate_autorun: Optional[int], update_policy: Optional[str], telemetry_policy: bool, status_time: float, video_size_discover_num_threads: int,
status_progress_bar_resolution: int, download_progress_bar_resolution: int, force_filesystem: Optional[str], make_subdirs: bool, follow_links: bool, absolute_path_filename: bool
working_dir_location: str, database_file_location: str, master_password: str, filename_replacing: bool, download_videos: bool, whitelist: Optional[List[int]], blacklist: Optional[List[int]],
throttle_rate: Optional[int], throttle_rate_autorun: Optional[int], update_policy: Optional[str], telemetry_policy: bool, status_time: float, video_size_discover_num_threads: int,
status_progress_bar_resolution: int, download_progress_bar_resolution: int, force_filesystem: Optional[str], make_subdirs: bool, follow_links: bool, absolute_path_filename: bool
) -> str:
return f"""---
Expand Down Expand Up @@ -1509,6 +1508,7 @@ def generate_error_message(ex: Exception) -> NoReturn:
if is_autorun:
os._exit(1)

created_lock_file = False
colorama.init()
startup()
OnKill()
Expand All @@ -1517,6 +1517,5 @@ def generate_error_message(ex: Exception) -> NoReturn:
database_helper = DatabaseHelper()
bad_urls = database_helper.get_bad_urls()
config = Config()
created_lock_file = False

logger = DataLogger()

0 comments on commit 1d569fe

Please sign in to comment.