download API에 dateafter 추가
This commit is contained in:
10
README.md
10
README.md
@@ -73,8 +73,12 @@ API에선 직접 비트레이트를 설정할 수 있습니다.
|
|||||||
`preferedformat` | 변환할 비디오 포맷. 가능한 포맷은 https://ffmpeg.org/general.html#File-Formats 참고. 미지정 시 변환하지 않음 | X | String
|
`preferedformat` | 변환할 비디오 포맷. 가능한 포맷은 https://ffmpeg.org/general.html#File-Formats 참고. 미지정 시 변환하지 않음 | X | String
|
||||||
`preferredcodec` | 추출할 오디오 코덱. 가능한 값은 `"best"`, `"mp3"`, `"aac"`, `"flac"`, `"m4a"`, `"opus"`, `"vorbis"`, `"wav"`. 미지정 시 추출하지 않음 | X | String
|
`preferredcodec` | 추출할 오디오 코덱. 가능한 값은 `"best"`, `"mp3"`, `"aac"`, `"flac"`, `"m4a"`, `"opus"`, `"vorbis"`, `"wav"`. 미지정 시 추출하지 않음 | X | String
|
||||||
`preferredquality` | 추출한 오디오의 비트레이트. 0 ~ 9 사이의 VBR 퀄리티 값(0에 가까울수록 좋음) 혹은 특정 비트레이트 값. `preferredcodec` 키가 있을 때만 유효. 기본값: `192` | X | Integer
|
`preferredquality` | 추출한 오디오의 비트레이트. 0 ~ 9 사이의 VBR 퀄리티 값(0에 가까울수록 좋음) 혹은 특정 비트레이트 값. `preferredcodec` 키가 있을 때만 유효. 기본값: `192` | X | Integer
|
||||||
|
`dateafter` | 지정한 날짜 이후에 업로드된 동영상만 다운로드. 미지정 시 모든 동영상 다운로드 | X | String
|
||||||
`archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있을 경우 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String
|
`archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있을 경우 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String
|
||||||
`start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean
|
`start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean
|
||||||
|
|
||||||
|
`dateafter` 키에 넣을 수 있는 날짜는 `YYYYMMDD` 또는 `(now|today)[+-][0-9](day|week|month|year)(s)?` 형식의 문자열입니다.
|
||||||
|
|
||||||
#### Response
|
#### Response
|
||||||
키 | 설명 | 타입
|
키 | 설명 | 타입
|
||||||
--- | --- | ---
|
--- | --- | ---
|
||||||
@@ -131,6 +135,12 @@ API에선 직접 비트레이트를 설정할 수 있습니다.
|
|||||||
물론 해당 정보가 없으면 null입니다.
|
물론 해당 정보가 없으면 null입니다.
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
v1.7.0
|
||||||
|
* Python 3 지원
|
||||||
|
Python 2를 유지한 채로 Python 3 지원을 추가했습니다.
|
||||||
|
* download API에 dateafter 추가
|
||||||
|
지정한 날짜 이후에 업로드된 동영상만 다운로드하는 옵션입니다. 플레이리스트 다운로드 시에 유용하게 사용할 수 있습니다.
|
||||||
|
|
||||||
v1.6.11
|
v1.6.11
|
||||||
* 목록 메뉴에 전체 중지 버튼 추가
|
* 목록 메뉴에 전체 중지 버튼 추가
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"description": "\uc720\ud29c\ube0c, \ub124\uc774\ubc84TV \ub4f1 \ub3d9\uc601\uc0c1 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ub3d9\uc601\uc0c1 \ub2e4\uc6b4\ub85c\ub4dc", "name": "youtube-dl", "more": "", "version": "1.6.11", "home": "https://github.com/joyfuI/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", "name": "youtube-dl", "more": "", "version": "1.7.0", "home": "https://github.com/joyfuI/youtube-dl", "category_name": "vod", "developer": "joyfuI"}
|
||||||
@@ -72,6 +72,7 @@ class LogicNormal(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def download(**kwagrs):
|
def download(**kwagrs):
|
||||||
|
try:
|
||||||
logger.debug(kwagrs)
|
logger.debug(kwagrs)
|
||||||
plugin = kwagrs['plugin']
|
plugin = kwagrs['plugin']
|
||||||
url = kwagrs['url']
|
url = kwagrs['url']
|
||||||
@@ -101,10 +102,15 @@ class LogicNormal(object):
|
|||||||
opts['proxy'] = kwagrs['proxy']
|
opts['proxy'] = kwagrs['proxy']
|
||||||
if 'ffmpeg_path' in kwagrs and kwagrs['ffmpeg_path']:
|
if 'ffmpeg_path' in kwagrs and kwagrs['ffmpeg_path']:
|
||||||
opts['ffmpeg_location'] = kwagrs['ffmpeg_path']
|
opts['ffmpeg_location'] = kwagrs['ffmpeg_path']
|
||||||
youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts)
|
dateafter = kwagrs.get('dateafter')
|
||||||
|
youtube_dl = MyYoutubeDL(plugin, url, filename, temp_path, save_path, opts, dateafter)
|
||||||
youtube_dl.key = kwagrs.get('key')
|
youtube_dl.key = kwagrs.get('key')
|
||||||
LogicNormal.youtube_dl_list.append(youtube_dl) # 리스트 추가
|
LogicNormal.youtube_dl_list.append(youtube_dl) # 리스트 추가
|
||||||
return youtube_dl
|
return youtube_dl
|
||||||
|
except Exception as e:
|
||||||
|
logger.error('Exception:%s', e)
|
||||||
|
logger.error(traceback.format_exc())
|
||||||
|
return None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_data(youtube_dl):
|
def get_data(youtube_dl):
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ class MyYoutubeDL(object):
|
|||||||
__index = 0
|
__index = 0
|
||||||
_last_msg = ''
|
_last_msg = ''
|
||||||
|
|
||||||
def __init__(self, plugin, url, filename, temp_path, save_path=None, opts=None):
|
def __init__(self, plugin, url, filename, temp_path, save_path=None, opts=None, dateafter=None, datebefore=None):
|
||||||
|
from youtube_dl.utils import DateRange
|
||||||
|
|
||||||
if save_path is None:
|
if save_path is None:
|
||||||
save_path = temp_path
|
save_path = temp_path
|
||||||
if opts is None:
|
if opts is None:
|
||||||
@@ -60,6 +62,8 @@ class MyYoutubeDL(object):
|
|||||||
os.makedirs(save_path)
|
os.makedirs(save_path)
|
||||||
self.save_path = save_path
|
self.save_path = save_path
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
|
if dateafter or 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
|
||||||
@@ -97,6 +101,7 @@ class MyYoutubeDL(object):
|
|||||||
def run(self):
|
def run(self):
|
||||||
import youtube_dl
|
import youtube_dl
|
||||||
import glob2
|
import glob2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.start_time = datetime.now()
|
self.start_time = datetime.now()
|
||||||
self.status = Status.START
|
self.status = Status.START
|
||||||
@@ -148,12 +153,14 @@ class MyYoutubeDL(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_version():
|
def get_version():
|
||||||
import youtube_dl
|
from youtube_dl.version import __version__
|
||||||
return youtube_dl.version.__version__
|
|
||||||
|
return __version__
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_info_dict(url, proxy=None):
|
def get_info_dict(url, proxy=None):
|
||||||
import youtube_dl
|
import youtube_dl
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
'simulate': True,
|
'simulate': True,
|
||||||
@@ -199,6 +206,7 @@ class MyYoutubeDL(object):
|
|||||||
@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)
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ menu = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin_info = {
|
plugin_info = {
|
||||||
'version': '1.6.11',
|
'version': '1.7.0',
|
||||||
'name': 'youtube-dl',
|
'name': 'youtube-dl',
|
||||||
'category_name': 'vod',
|
'category_name': 'vod',
|
||||||
'developer': 'joyfuI',
|
'developer': 'joyfuI',
|
||||||
@@ -202,6 +202,7 @@ def api(sub):
|
|||||||
preferedformat = request.values.get('preferedformat', None)
|
preferedformat = request.values.get('preferedformat', None)
|
||||||
preferredcodec = request.values.get('preferredcodec', None)
|
preferredcodec = request.values.get('preferredcodec', None)
|
||||||
preferredquality = request.values.get('preferredquality', 192)
|
preferredquality = request.values.get('preferredquality', 192)
|
||||||
|
dateafter = request.values.get('dateafter', None)
|
||||||
archive = request.values.get('archive', None)
|
archive = request.values.get('archive', None)
|
||||||
start = request.values.get('start', False)
|
start = request.values.get('start', False)
|
||||||
ret = {
|
ret = {
|
||||||
@@ -225,10 +226,13 @@ def api(sub):
|
|||||||
preferedformat=preferedformat,
|
preferedformat=preferedformat,
|
||||||
preferredcodec=preferredcodec,
|
preferredcodec=preferredcodec,
|
||||||
preferredquality=preferredquality,
|
preferredquality=preferredquality,
|
||||||
|
dateafter=dateafter,
|
||||||
archive=archive,
|
archive=archive,
|
||||||
proxy=ModelSetting.get('proxy'),
|
proxy=ModelSetting.get('proxy'),
|
||||||
ffmpeg_path=ModelSetting.get('ffmpeg_path'),
|
ffmpeg_path=ModelSetting.get('ffmpeg_path'),
|
||||||
key=key)
|
key=key)
|
||||||
|
if youtube_dl is None:
|
||||||
|
return LogicNormal.abort(ret, 10) # 실패
|
||||||
ret['index'] = youtube_dl.index
|
ret['index'] = youtube_dl.index
|
||||||
if start:
|
if start:
|
||||||
youtube_dl.start()
|
youtube_dl.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user