__ 리팩토링

This commit is contained in:
joyfuI
2021-07-15 23:13:22 +09:00
parent 4db7ce9913
commit 90997f548d
2 changed files with 18 additions and 10 deletions

View File

@@ -1 +1,9 @@
{"version": "3.0.1", "name": "youtube-dl", "category_name": "vod", "developer": "joyfuI", "description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "home": "https://github.com/joyfuI/youtube-dl", "more": ""} {
"version": "3.0.1",
"name": "youtube-dl",
"category_name": "vod",
"developer": "joyfuI",
"description": "유튜브, 네이버TV 등 동영상 사이트에서 동영상 다운로드",
"home": "https://github.com/joyfuI/youtube-dl",
"more": ""
}

View File

@@ -41,7 +41,7 @@ class Status(Enum):
class MyYoutubeDL(object): class MyYoutubeDL(object):
DEFAULT_FILENAME = '%(title)s-%(id)s.%(ext)s' DEFAULT_FILENAME = '%(title)s-%(id)s.%(ext)s'
__index = 0 _index = 0
_last_msg = '' _last_msg = ''
def __init__(self, plugin, type_name, url, filename, temp_path, save_path=None, opts=None, dateafter=None, def __init__(self, plugin, type_name, url, filename, temp_path, save_path=None, opts=None, dateafter=None,
@@ -67,10 +67,10 @@ class MyYoutubeDL(object):
self.opts = opts self.opts = opts
if dateafter or datebefore: if dateafter or datebefore:
self.opts['daterange'] = DateRange(start=dateafter, end=datebefore) self.opts['daterange'] = DateRange(start=dateafter, end=datebefore)
self.index = MyYoutubeDL.__index self.index = MyYoutubeDL._index
MyYoutubeDL.__index += 1 MyYoutubeDL._index += 1
self.__status = Status.READY self._status = Status.READY
self.__thread = None self._thread = None
self.key = None self.key = None
self.start_time = None # 시작 시간 self.start_time = None # 시작 시간
self.end_time = None # 종료 시간 self.end_time = None # 종료 시간
@@ -97,8 +97,8 @@ class MyYoutubeDL(object):
def start(self): def start(self):
if self.status != Status.READY: if self.status != Status.READY:
return False return False
self.__thread = Thread(target=self.run) self._thread = Thread(target=self.run)
self.__thread.start() self._thread.start()
return True return True
def run(self): def run(self):
@@ -211,13 +211,13 @@ class MyYoutubeDL(object):
@property @property
def status(self): def status(self):
return self.__status return self._status
@status.setter @status.setter
def status(self, value): def status(self, value):
from .plugin import socketio_emit from .plugin import socketio_emit
self.__status = value self._status = value
socketio_emit('status', self) socketio_emit('status', self)