Compare commits
104
Commits
main
..
1167e60c36
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1167e60c36 | ||
|
|
51ef1ee459 | ||
|
|
3410ddd73c | ||
|
|
26e4f96d49 | ||
|
|
3ef17ad0b3 | ||
|
|
44b792bc28 | ||
|
|
3d1e12d081 | ||
|
|
8cd3c769b0 | ||
|
|
28dcded7ce | ||
|
|
c74ad4bc78 | ||
|
|
3202fd2fb9 | ||
|
|
9d72ebbc6c | ||
|
|
15d98a96ec | ||
|
|
d2afafd77d | ||
|
|
3ce114d182 | ||
|
|
90997f548d | ||
|
|
6c293e5748 | ||
|
|
4db7ce9913 | ||
|
|
fe8caa337e | ||
|
|
446d39eb31 | ||
|
|
ad2079edad | ||
|
|
01042a7748 | ||
|
|
d04a71a348 | ||
|
|
0cf53d3093 | ||
|
|
e6a7b86670 | ||
|
|
d7f31c4990 | ||
|
|
64ce8c1d05 | ||
|
|
a782c05ebf | ||
|
|
86a3287859 | ||
|
|
3ab3debc53 | ||
|
|
342263d153 | ||
|
|
a4f2c5fbd7 | ||
|
|
b443aaeff5 | ||
|
|
c2343a0bbb | ||
|
|
fdb85f4ffd | ||
|
|
25004b97c9 | ||
|
|
2043373395 | ||
|
|
4f3d3bc2cc | ||
|
|
04937f7c64 | ||
|
|
33bfe6f4ee | ||
|
|
a7ee24d436 | ||
|
|
99884f28be | ||
|
|
1ba702be6e | ||
|
|
43497032a2 | ||
|
|
0ceb81dcbd | ||
|
|
3c9369b034 | ||
|
|
5e0aaa0d92 | ||
|
|
7bec0524e6 | ||
|
|
b7d9501802 | ||
|
|
91ed141229 | ||
|
|
3318a11788 | ||
|
|
9ec79d3482 | ||
|
|
36f3ecab76 | ||
|
|
8d61a7ca81 | ||
|
|
e40d396c25 | ||
|
|
63de346506 | ||
|
|
bd29bbe6db | ||
|
|
d80796ebb9 | ||
|
|
432fc92f54 | ||
|
|
bc23b5e8ca | ||
|
|
157e31cb71 | ||
|
|
ab11ed47ac | ||
|
|
5d2c2ba4cf | ||
|
|
d630ef2d2e | ||
|
|
a2370cabbe | ||
|
|
27bdca813e | ||
|
|
5a91d34f6e | ||
|
|
62728ab9b7 | ||
|
|
480f0be4aa | ||
|
|
33b70e3ec7 | ||
|
|
f78fde9d19 | ||
|
|
ecb4ed12b1 | ||
|
|
6bedf69533 | ||
|
|
9c74ab6768 | ||
|
|
5d43fdffe2 | ||
|
|
806f4c616a | ||
|
|
23c1521588 | ||
|
|
2801de603a | ||
|
|
edb354b2d6 | ||
|
|
9a66d4540f | ||
|
|
cce361fe79 | ||
|
|
181b51fa1c | ||
|
|
728967327e | ||
|
|
d5f6084664 | ||
|
|
d8e5955028 | ||
|
|
a9165a78be | ||
|
|
ef6c8e3066 | ||
|
|
8a9f08d9db | ||
|
|
352c2eb73b | ||
|
|
02a7b05642 | ||
|
|
f8c080093c | ||
|
|
87d310900b | ||
|
|
fa9356419c | ||
|
|
1101dad393 | ||
|
|
40ce3ece03 | ||
|
|
6581394a6d | ||
|
|
a190335de2 | ||
|
|
39a2867d31 | ||
|
|
847ab7fb7d | ||
|
|
47b3f615eb | ||
|
|
7951973ddf | ||
|
|
b26f25a413 | ||
|
|
3b157491c6 | ||
|
|
77c696d63e |
@@ -1,21 +0,0 @@
|
||||
# Docker 무시 파일
|
||||
# 빌드 시 컨테이너에 복사하지 않을 파일들
|
||||
|
||||
.git
|
||||
.gitignore
|
||||
.idea
|
||||
.vscode
|
||||
.venv
|
||||
__pycache__
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
.DS_Store
|
||||
.python-version
|
||||
|
||||
# 데이터 폴더는 볼륨으로 마운트
|
||||
data/
|
||||
|
||||
# 개발용 파일
|
||||
*.md
|
||||
*.log
|
||||
+2
-153
@@ -1,154 +1,3 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
.venv/
|
||||
__pycache__/
|
||||
*.py[co]
|
||||
*$py.class
|
||||
|
||||
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
#lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
#.env
|
||||
#.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
|
||||
# FlaksFarm
|
||||
# config.yaml
|
||||
lib2/
|
||||
.vscode/
|
||||
memo.txt
|
||||
*.zip
|
||||
flaskfarm.sh
|
||||
export.sh
|
||||
run.sh
|
||||
pre_start.sh
|
||||
*.code-workspace
|
||||
false
|
||||
*copy.py
|
||||
# *.sh
|
||||
data/
|
||||
tmp/
|
||||
lib/support/site/tving.py
|
||||
lib/support/site/wavve.py
|
||||
lib/support/site/seezn.py
|
||||
lib/support/site/kakaotv.py
|
||||
*.bat
|
||||
output/
|
||||
*.mkv
|
||||
|
||||
test/
|
||||
|
||||
Generated
-8
@@ -1,8 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
Generated
-12
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="linkkf" uuid="8b6bf041-ffab-472b-b603-18b3316bc628">
|
||||
<driver-ref>sqlite.xerial</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
|
||||
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/data/db/linkkf.db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
Generated
-20
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.9 (FF)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="PLAIN" />
|
||||
<option name="myDocStringFormat" value="Plain" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/lib/framework/templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</module>
|
||||
-76
@@ -1,76 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="HttpUrlsUsage" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredUrls">
|
||||
<list>
|
||||
<option value="http://localhost" />
|
||||
<option value="http://127.0.0.1" />
|
||||
<option value="http://0.0.0.0" />
|
||||
<option value="http://www.w3.org/" />
|
||||
<option value="http://json-schema.org/draft" />
|
||||
<option value="http://java.sun.com/" />
|
||||
<option value="http://xmlns.jcp.org/" />
|
||||
<option value="http://javafx.com/javafx/" />
|
||||
<option value="http://javafx.com/fxml" />
|
||||
<option value="http://maven.apache.org/xsd/" />
|
||||
<option value="http://maven.apache.org/POM/" />
|
||||
<option value="http://www.springframework.org/schema/" />
|
||||
<option value="http://www.springframework.org/tags" />
|
||||
<option value="http://www.springframework.org/security/tags" />
|
||||
<option value="http://www.thymeleaf.org" />
|
||||
<option value="http://www.jboss.org/j2ee/schema/" />
|
||||
<option value="http://www.jboss.com/xml/ns/" />
|
||||
<option value="http://www.ibm.com/webservices/xsd" />
|
||||
<option value="http://activemq.apache.org/schema/" />
|
||||
<option value="http://schema.cloudfoundry.org/spring/" />
|
||||
<option value="http://schemas.xmlsoap.org/" />
|
||||
<option value="http://cxf.apache.org/schemas/" />
|
||||
<option value="http://primefaces.org/ui" />
|
||||
<option value="http://tiles.apache.org/" />
|
||||
<option value="http://yommi.duckdns.org" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="17">
|
||||
<item index="0" class="java.lang.String" itemvalue="trio-websocket" />
|
||||
<item index="1" class="java.lang.String" itemvalue="h11" />
|
||||
<item index="2" class="java.lang.String" itemvalue="loguru" />
|
||||
<item index="3" class="java.lang.String" itemvalue="sniffio" />
|
||||
<item index="4" class="java.lang.String" itemvalue="sqlalchemy" />
|
||||
<item index="5" class="java.lang.String" itemvalue="wsproto" />
|
||||
<item index="6" class="java.lang.String" itemvalue="attrs" />
|
||||
<item index="7" class="java.lang.String" itemvalue="sortedcontainers" />
|
||||
<item index="8" class="java.lang.String" itemvalue="exceptiongroup" />
|
||||
<item index="9" class="java.lang.String" itemvalue="trio" />
|
||||
<item index="10" class="java.lang.String" itemvalue="selenium" />
|
||||
<item index="11" class="java.lang.String" itemvalue="certifi" />
|
||||
<item index="12" class="java.lang.String" itemvalue="pysocks" />
|
||||
<item index="13" class="java.lang.String" itemvalue="urllib3" />
|
||||
<item index="14" class="java.lang.String" itemvalue="async-generator" />
|
||||
<item index="15" class="java.lang.String" itemvalue="outcome" />
|
||||
<item index="16" class="java.lang.String" itemvalue="idna" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N802" />
|
||||
<option value="N803" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="sqlalchemy.engine.result.Result.__await__" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
Generated
-4
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (FF)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
Generated
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/flaskfarm.iml" filepath="$PROJECT_DIR$/.idea/flaskfarm.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
cpython:S6019"FFix this reluctant quantifier that will only ever match 0 repetitions.(¨†…™üÿÿÿÿ
|
||||
cpython:S6019"FFix this reluctant quantifier that will only ever match 0 repetitions.(Ìé©èùÿÿÿÿ
|
||||
cpython:S6019"FFix this reluctant quantifier that will only ever match 0 repetitions.(–…‡éþÿÿÿÿ
|
||||
^python:S6019"FFix this reluctant quantifier that will only ever match 0 repetitions.(ëÅÑš
|
||||
^python:S6019"FFix this reluctant quantifier that will only ever match 0 repetitions.(‹Ò•–
|
||||
6python:S125!"Remove this commented out code.(¡‚ÙÈ
|
||||
Tpython:S5754)"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
6python:S1252"Remove this commented out code.(ý�™Ë
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
qpython:S3776␍"TRefactor this function to reduce its Cognitive Complexity from 22 to the 15 allowed.(úÈœ‚ÿÿÿÿÿ
|
||||
6python:S125"Remove this commented out code.(ÑêÏà
|
||||
Tpython:S5754/"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
6python:S125("Remove this commented out code.(£ÌÎæ
|
||||
ypython:S1186„"[Add a nested comment explaining why this function is empty, or complete the implementation.(ë�½ãùÿÿÿÿ
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
lpython:S3776"TRefactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed.(”ÒÑ
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
epython:S1192'"MDefine a constant instead of duplicating this literal 'Exception:%s' 9 times.(ï°Ð½
|
||||
Lpython:S10669"/Merge this if statement with the enclosing one.(Íìáöüÿÿÿÿ
|
||||
lpython:S3776"TRefactor this function to reduce its Cognitive Complexity from 50 to the 15 allowed.(�Øê
|
||||
6python:S125/"Remove this commented out code.(“Ä¡–
|
||||
lpython:S3776k"TRefactor this function to reduce its Cognitive Complexity from 39 to the 15 allowed.(ûãô”
|
||||
rpython:S3776á"TRefactor this function to reduce its Cognitive Complexity from 58 to the 15 allowed.(ó‚‚åýÿÿÿÿ
|
||||
Upython:S5754ü"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
<python:S125¼"Remove this commented out code.(ÁêÕúûÿÿÿÿ
|
||||
Upython:S5754é"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
Bpython:S1481"%Remove the unused local variable "e".(¼–¯¸ÿÿÿÿÿ
|
||||
6python:S125"Remove this commented out code.(™èÇÅ
|
||||
;python:S125"Remove this commented out code.(à髈üÿÿÿÿ
|
||||
6python:S125T"Remove this commented out code.(»—Ö
|
||||
Cpython:S5806Y"+Rename this variable; it shadows a builtin.(Ç¡¡
|
||||
6python:S125Z"Remove this commented out code.(¾§Ç¡
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
epython:S5797I"HReplace this expression; used as a condition it will always be constant.(™¼ï€üÿÿÿÿ
|
||||
Mpython:S1066ã"/Merge this if statement with the enclosing one.(„Õý“þÿÿÿÿ
|
||||
vpython:S1163"ZRename this field "SystemModelSetting" to match the regular expression ^[_a-z][_a-z0-9]*$.(òªÆÓýÿÿÿÿ
|
||||
bpython:S1164"KRename this field "Job" to match the regular expression ^[_a-z][_a-z0-9]*$.(„è´’
|
||||
rpython:S116Ù"URename this field "PluginManager" to match the regular expression ^[_a-z][_a-z0-9]*$.(æ¥Ë÷ùÿÿÿÿ
|
||||
6python:S125/"Remove this commented out code.(´ÔÔí
|
||||
6python:S125_"Remove this commented out code.(„ÿ’È
|
||||
6python:S125"Remove this commented out code.(æ‰Èì
|
||||
[python:S112‰">Replace this generic exception class with a more specific one.(¢…›°þÿÿÿÿ
|
||||
ypython:S1186¯"[Add a nested comment explaining why this function is empty, or complete the implementation.(³‡Êºþÿÿÿÿ
|
||||
|python:S117Á"_Rename this local variable "SystemInstance" to match the regular expression ^[_a-z][a-z0-9_]*$.(çÉÍ¥úÿÿÿÿ
|
||||
rpython:S3776÷"TRefactor this function to reduce its Cognitive Complexity from 26 to the 15 allowed.(��›†øÿÿÿÿ
|
||||
7python:S125ü"Remove this commented out code.(‚ðû�
|
||||
Apython:S108–")Either remove or fill this block of code.(ã‘Û¾
|
||||
Upython:S5754 "<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
<python:S125¼"Remove this commented out code.(ÛÑ“¹üÿÿÿÿ
|
||||
rpython:S3776Ç"TRefactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed.(û´´¨ýÿÿÿÿ
|
||||
<python:S125Ê"Remove this commented out code.(ˆà¡×ÿÿÿÿÿ
|
||||
Upython:S5754þ"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
tpython:S117²"\Rename this local variable "fileHandler" to match the regular expression ^[_a-z][a-z0-9_]*$.(ºŽ™…
|
||||
vpython:S117¶"^Rename this local variable "streamHandler" to match the regular expression ^[_a-z][a-z0-9_]*$.(�½ÝÀ
|
||||
mpython:S3776�"TRefactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed.(¸ì¶Ê
|
||||
Upython:S5754¢"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
Upython:S5754–"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
npython:S1542¥"PRename function "customTime" to match the regular expression ^[a-z_][a-z0-9_]*$.(ŠˆíÖúÿÿÿÿ
|
||||
Upython:S5754À"<Specify an exception class to catch or reraise the exception(–’Ê�
|
||||
Upython:S5754Â"<Specify an exception class to catch or reraise the exception(–’Ê�
|
||||
Upython:S5754Ä"<Specify an exception class to catch or reraise the exception(–’Ê�
|
||||
Upython:S5754Æ"<Specify an exception class to catch or reraise the exception(–’Ê�
|
||||
Upython:S5754È"<Specify an exception class to catch or reraise the exception(–’Ê�
|
||||
Upython:S5754Ï"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
Upython:S5754�"<Specify an exception class to catch or reraise the exception(ˆÊÉ·
|
||||
Generated
-17
@@ -1,17 +0,0 @@
|
||||
|
||||
I
|
||||
lib/framework/__init__.py,0/3/03875fef6dc33ed50c8bc5f25df52c02e352a134
|
||||
M
|
||||
lib/framework/init_declare.py,9/5/95519e06d92ec11e26cf873c3c30e2fcedf78892
|
||||
J
|
||||
lib/framework/init_menu.py,6/2/627433fe5c5c7210e3062642e7963227a319d5c6
|
||||
L
|
||||
lib/framework/init_plugin.py,8/2/82544e7bcd3de23afaf278a62d1180d65a1ef456
|
||||
K
|
||||
lib/framework/init_route.py,5/8/58836750c643ef469da17133f44914292a82f3b3
|
||||
I
|
||||
lib/framework/init_web.py,0/e/0e68783ed60c8d2f67617374a92c1652fb6bdaee
|
||||
K
|
||||
lib/framework/log_viewer.py,0/c/0c528d2f014ab7c32dd27d4e5d79396e74f3e62c
|
||||
J
|
||||
lib/framework/init_main.py,e/e/eeb13886aba87bd6947610e1cba3283d308baf0c
|
||||
Generated
-13
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/data/plugins/ffmpeg" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/data/plugins/flaskcode" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/data/plugins/klive_plus" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/data/plugins/number_baseball" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/data/plugins/sjva" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/data/plugins/terminal" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/data/plugins/trans" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,9 @@
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once).
|
||||
disable=missing-module-docstring,missing-class-docstring,missing-function-docstring,broad-except,line-too-long
|
||||
|
||||
ignored-modules=framework
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.html": "jinja-html"
|
||||
}
|
||||
}
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
# FlaskFarm Docker Image v3.16
|
||||
# Ubuntu/Debian + Python 3.14 for maximum performance
|
||||
# Python 3.14.2 stable release
|
||||
|
||||
FROM python:3.14-slim
|
||||
|
||||
LABEL maintainer="yommi"
|
||||
LABEL description="FlaskFarm with sc module support"
|
||||
|
||||
# Install system dependencies
|
||||
# Install system dependencies and Korean locales
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ffmpeg \
|
||||
git \
|
||||
curl \
|
||||
gcc \
|
||||
python3-dev \
|
||||
wget \
|
||||
gnupg \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
zlib1g-dev \
|
||||
libjpeg-dev \
|
||||
libnss3 \
|
||||
libatk-bridge2.0-0 \
|
||||
libxcomposite1 \
|
||||
libxdamage1 \
|
||||
libxrandr2 \
|
||||
libgbm1 \
|
||||
libasound2 \
|
||||
libasound2-dev \
|
||||
libpangocairo-1.0-0 \
|
||||
libgtk-3-0 \
|
||||
pkg-config \
|
||||
libbz2-dev \
|
||||
libreadline-dev \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
build-essential \
|
||||
locales \
|
||||
&& sed -i -e 's/# ko_KR.UTF-8 UTF-8/ko_KR.UTF-8 UTF-8/' /etc/locale.gen \
|
||||
&& locale-gen \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV LC_ALL=ko_KR.UTF-8 \
|
||||
LANG=ko_KR.UTF-8 \
|
||||
LANGUAGE=ko_KR.UTF-8
|
||||
|
||||
# Install Google Chrome Stable (amd64) or Chromium (arm64)
|
||||
ARG TARGETARCH
|
||||
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg && \
|
||||
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \
|
||||
apt-get update && apt-get install -y google-chrome-stable; \
|
||||
else \
|
||||
apt-get update && apt-get install -y chromium chromium-driver; \
|
||||
fi && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory to /root
|
||||
WORKDIR /root
|
||||
|
||||
# Copy requirements first for layer caching
|
||||
COPY ff_3_14_requirements.txt .
|
||||
|
||||
# Install Python dependencies (including camoufox/zendriver)
|
||||
RUN grep -v "FlaskFarm" ff_3_14_requirements.txt > requirements_docker.txt \
|
||||
&& pip install --no-cache-dir -r requirements_docker.txt
|
||||
|
||||
# Copy FlaskFarm application
|
||||
COPY . .
|
||||
RUN mkdir -p /data/plugins /data/db
|
||||
COPY gommi.sh /root/gommi.sh
|
||||
COPY config.yaml /data/config.yaml
|
||||
RUN chmod +x /root/gommi.sh
|
||||
|
||||
# Environment variables
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV TZ=Asia/Seoul
|
||||
|
||||
# Health check (Matching EXPOSE port 9999)
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:9999/ || exit 1
|
||||
|
||||
# Expose port
|
||||
EXPOSE 9999/tcp
|
||||
|
||||
# Run FlaskFarm via gommi.sh in /root
|
||||
ENTRYPOINT ["/root/gommi.sh"]
|
||||
@@ -1,44 +0,0 @@
|
||||
# FlaskFarm Docker Image
|
||||
# Ubuntu 22.04 + Python 3.10 for sc module support on ARM64/x86_64 Linux
|
||||
|
||||
FROM python:3.10-slim-bullseye
|
||||
|
||||
LABEL maintainer="yommi"
|
||||
LABEL description="FlaskFarm with sc module support"
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ffmpeg \
|
||||
git \
|
||||
curl \
|
||||
gcc \
|
||||
python3-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements first for layer caching
|
||||
COPY ff_3_10_requirements.txt .
|
||||
|
||||
# Install Python dependencies (skip FlaskFarm package - running from source)
|
||||
RUN grep -v "FlaskFarm" ff_3_10_requirements.txt > requirements_docker.txt \
|
||||
&& pip install --no-cache-dir -r requirements_docker.txt \
|
||||
&& pip install --no-cache-dir curl_cffi yt-dlp loguru
|
||||
|
||||
# Copy FlaskFarm application
|
||||
COPY . .
|
||||
|
||||
# Expose port
|
||||
EXPOSE 9099
|
||||
|
||||
# Environment variables
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV TZ=Asia/Seoul
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:9099/ || exit 1
|
||||
|
||||
# Run FlaskFarm
|
||||
CMD ["python", "main.py"]
|
||||
@@ -1,674 +1,21 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 joyfuI
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
@@ -1,16 +1,476 @@
|
||||
### Hi there 👋
|
||||
# youtube-dl_sjva
|
||||
|
||||
<!--
|
||||
**flaskfarm/flaskfarm** is a ✨ _special_ ✨ repository because its `README.md` (this file) appears on your GitHub profile.
|
||||
[SJVA](https://sjva.me/) 용 [youtube-dl](https://youtube-dl.org/) 플러그인입니다.
|
||||
SJVA에서 유튜브, 네이버TV 등 동영상 사이트 영상을 다운로드할 수 있습니다.
|
||||
|
||||
Here are some ideas to get you started:
|
||||
## 설치
|
||||
|
||||
- 🔭 I’m currently working on ...
|
||||
- 🌱 I’m currently learning ...
|
||||
- 👯 I’m looking to collaborate on ...
|
||||
- 🤔 I’m looking for help with ...
|
||||
- 💬 Ask me about ...
|
||||
- 📫 How to reach me: ...
|
||||
- 😄 Pronouns: ...
|
||||
- ⚡ Fun fact: ...
|
||||
-->
|
||||
SJVA에서 "시스템 → 플러그인 → 플러그인 수동 설치" 칸에 저장소 주소를 넣고 설치 버튼을 누르면 됩니다.
|
||||
`https://github.com/joyfuI/youtube-dl`
|
||||
|
||||
## 잡담
|
||||
|
||||
시놀로지 docker 환경에서 테스트했습니다.
|
||||
|
||||
API를 제공합니다. 다른 플러그인에서 동영상 정보나 다운로드를 요청할 수 있습니다.
|
||||
다른 플러그인이 멋대로 다운로드를 중지할 수 없도록 다운로드를 요청할 때 임의의 키를 넘겨받습니다. 중지 요청 시 키가 일치해야 요청이 실행됩니다.
|
||||
|
||||
[youtube-dl](https://github.com/ytdl-org/youtube-dl)의 DMCA 테이크다운 사태 이후, 비슷한 상황을 대비하기 위해 youtube-dl의 포크 프로젝트 [youtube-dlc](https://github.com/blackjack4494/yt-dlc)의 포크 프로젝트(...)인 [yt-dlp](https://github.com/yt-dlp/yt-dlp)를 추가했습니다.
|
||||
설정에서 취향껏 골라서 사용하시면 되며 youtube-dl가 우선 지원됩니다.
|
||||
|
||||
## API
|
||||
|
||||
### 공통사항
|
||||
|
||||
모든 요청은 `POST` 또는 `GET`만 받습니다. 그리고 응답은 `JSON` 형식입니다.
|
||||
모든 요청엔 _플러그인 이름_ 정보가 있어야 합니다. `plugin` 키에 담아서 보내면 됩니다. 만약 _플러그인 이름_ 정보가 없으면 **403 에러**를 반환합니다.
|
||||
요청을 처리하는 과정에서 예외가 발생하면 **500 에러**를 반환합니다. 이건 저한테 로그와 함께 알려주시면 됩니다.
|
||||
모든 응답에는 `errorCode` 키가 있습니다. 코드의 의미는 아래 문단 참고
|
||||
|
||||
#### 에러 코드 (errorCode)
|
||||
|
||||
- `0` - 성공. 문제없음
|
||||
- `1` - 필수 요청 변수가 없음
|
||||
- `2` - 잘못된 동영상 주소
|
||||
- `3` - 인덱스 범위를 벗어남
|
||||
- `4` - 키 값이 일치하지 않음
|
||||
- `5` - 허용되지 않은 값이 있음
|
||||
- `10` - 실패. 요청은 성공하였으나 실행 결과가 실패
|
||||
|
||||
#### Status 타입
|
||||
|
||||
상태를 나타냄
|
||||
|
||||
- `"READY"` - 준비
|
||||
- `"START"` - 분석중
|
||||
- `"DOWNLOADING"` - 다운로드중
|
||||
- `"ERROR"` - 실패
|
||||
- `"FINISHED"` - 변환중
|
||||
- `"STOP"` - 중지
|
||||
- `"COMPLETED"` - 완료
|
||||
|
||||
### /youtube-dl/api/info_dict
|
||||
|
||||
동영상 정보를 반환하는 API
|
||||
|
||||
#### Request
|
||||
|
||||
| 키 | 설명 | 필수 | 타입 |
|
||||
| -------- | ------------- | ---- | ------ |
|
||||
| `plugin` | 플러그인 이름 | O | String |
|
||||
| `url` | 동영상 주소 | O | String |
|
||||
|
||||
#### Response
|
||||
|
||||
| 키 | 설명 | 타입 |
|
||||
| ----------- | ----------- | ------- |
|
||||
| `errorCode` | 에러 코드 | Integer |
|
||||
| `info_dict` | 동영상 정보 | Object |
|
||||
|
||||
동영상 정보(`info_dict` 키)에는 youtube-dl에서 생성한 info_dict 정보가 그대로 들어있습니다. 따라서 이 부분은 직접 주소를 넣어가며 반환되는 정보를 확인해보는 게 좋습니다.
|
||||
간단한 예로 `thumbnail` 키엔 썸네일 주소, `uploader` 키엔 업로더 이름, `title` 키엔 동영상 제목, `duration` 키엔 동영상 길이 등이 들어 있습니다.
|
||||
그리고 만약 주소가 플레이리스트라면 `_type` 키에 `"playlist"`라는 값이 들어 있습니다. 이때는 `entries` 키에 리스트가 들어있어 동영상들의 제목과 ID를 확인할 수 있습니다.
|
||||
|
||||
### /youtube-dl/api/download
|
||||
|
||||
비디오 다운로드 준비를 요청하는 API
|
||||
|
||||
#### Request
|
||||
|
||||
| 키 | 설명 | 필수 | 타입 |
|
||||
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | ------- |
|
||||
| `plugin` | 플러그인 이름 | O | String |
|
||||
| `key` | 임의의 키. 이후 다운로드를 제어할 때 이 키가 필요함 | O | String |
|
||||
| `url` | 동영상 주소 | O | String |
|
||||
| `filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/#output-template 참고. 미지정 시 사용자 설정 | X | String |
|
||||
| `save_path` | 저장 폴더 경로. 미지정 시 사용자 설정 | X | String |
|
||||
| `format` | 동영상 포맷. 포맷 지정은 https://github.com/ytdl-org/youtube-dl/#format-selection 참고. 미지정 시 최고 화질 | X | String |
|
||||
| `preferedformat` | 변환할 비디오 포맷. 가능한 포맷은 https://ffmpeg.org/general.html#File-Formats 참고. 미지정 시 변환하지 않음 | X | String |
|
||||
| `preferredcodec` | 추출할 오디오 코덱. 가능한 값은 `"best"`, `"mp3"`, `"aac"`, `"flac"`, `"m4a"`, `"opus"`, `"vorbis"`, `"wav"`. 미지정 시 추출하지 않음 | X | String |
|
||||
| `preferredquality` | 추출한 오디오의 비트레이트. 0 ~ 9 사이의 VBR 퀄리티 값(0에 가까울수록 좋음) 혹은 특정 비트레이트 값. `preferredcodec` 키가 있을 때만 유효. 기본값: `192` | X | Integer |
|
||||
| `dateafter` | 지정한 날짜 이후에 업로드된 동영상만 다운로드. 미지정 시 모두 다운로드 | X | String |
|
||||
| `playlist` | 플레이리스트를 다운로드할 때 범위나 순서 지정. 미지정 시 모두 순서대로 다운로드 | X | String |
|
||||
| `archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있으면 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String |
|
||||
| `start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean |
|
||||
| `cookiefile` | 다운로드 시 필요한 쿠키 파일 경로 | X | String |
|
||||
| `headers` | 다운로드 시 사용할 HTTP 헤더 정보 | X | String |
|
||||
|
||||
`dateafter` 키에 넣을 수 있는 날짜는 `"YYYYMMDD"` 또는 `"(now|today)[+-][0-9](day|week|month|year)(s)?"` 형식의 문자열입니다.
|
||||
`headers` 키에 넣는 값은 `json` 형식의 문자열입니다.
|
||||
|
||||
`playlist` 키에 넣을 수 있는 값은 `"1-3,7,10-13"` 형식의 범위 또는 `"reverse"`, `"random"`입니다.
|
||||
범위를 넣으면 플레이리스트에서 선택한 것만 다운로드합니다.
|
||||
`"reverse"`를 넣으면 전체 플레이리스트를 역순으로 다운로드합니다.
|
||||
`"random"`을 넣으면 전체 플레이리스트를 랜덤 순서로 다운로드합니다.
|
||||
|
||||
#### Response
|
||||
|
||||
| 키 | 설명 | 타입 |
|
||||
| ----------- | ------------------------------------------------------- | ------- |
|
||||
| `errorCode` | 에러 코드 | Integer |
|
||||
| `index` | 동영상 인덱스. 이후 다운로드를 제어할 때 이 값이 필요함 | Integer |
|
||||
|
||||
### /youtube-dl/api/thumbnail
|
||||
|
||||
썸네일 다운로드 준비를 요청하는 API
|
||||
|
||||
#### Request
|
||||
|
||||
| 키 | 설명 | 필수 | 타입 |
|
||||
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---- | ------- |
|
||||
| `plugin` | 플러그인 이름 | O | String |
|
||||
| `key` | 임의의 키. 이후 다운로드를 제어할 때 이 키가 필요함 | O | String |
|
||||
| `url` | 동영상 주소 | O | String |
|
||||
| `filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/#output-template 참고. 미지정 시 사용자 설정 | X | String |
|
||||
| `save_path` | 저장 폴더 경로. 미지정 시 사용자 설정 | X | String |
|
||||
| `all_thumbnails` | 모든 썸네일 다운로드 여부. `false`는 대표 썸네일 하나만 다운로드. 기본값: `false` | X | Boolean |
|
||||
| `dateafter` | 지정한 날짜 이후에 업로드된 동영상만 다운로드. 미지정 시 모두 다운로드 | X | String |
|
||||
| `playlist` | 플레이리스트를 다운로드할 때 범위나 순서 지정. 미지정 시 모두 순서대로 다운로드 | X | String |
|
||||
| `archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있으면 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String |
|
||||
| `start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean |
|
||||
| `cookiefile` | 다운로드 시 필요한 쿠키 파일 경로 | X | String |
|
||||
| `headers` | 다운로드 시 사용할 HTTP 헤더 정보 | X | String |
|
||||
|
||||
`dateafter` 키에 넣을 수 있는 날짜는 `"YYYYMMDD"` 또는 `"(now|today)[+-][0-9](day|week|month|year)(s)?"` 형식의 문자열입니다.
|
||||
`headers` 키에 넣는 값은 `json` 형식의 문자열입니다.
|
||||
|
||||
`playlist` 키에 넣을 수 있는 값은 `"1-3,7,10-13"` 형식의 범위 또는 `"reverse"`, `"random"`입니다.
|
||||
범위를 넣으면 플레이리스트에서 선택한 것만 다운로드합니다.
|
||||
`"reverse"`를 넣으면 전체 플레이리스트를 역순으로 다운로드합니다.
|
||||
`"random"`을 넣으면 전체 플레이리스트를 랜덤 순서로 다운로드합니다.
|
||||
|
||||
#### Response
|
||||
|
||||
| 키 | 설명 | 타입 |
|
||||
| ----------- | ------------------------------------------------------- | ------- |
|
||||
| `errorCode` | 에러 코드 | Integer |
|
||||
| `index` | 동영상 인덱스. 이후 다운로드를 제어할 때 이 값이 필요함 | Integer |
|
||||
|
||||
### /youtube-dl/api/sub
|
||||
|
||||
자막 다운로드 준비를 요청하는 API
|
||||
|
||||
#### Request
|
||||
|
||||
| 키 | 설명 | 필수 | 타입 |
|
||||
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------- | ---- | ------- |
|
||||
| `plugin` | 플러그인 이름 | O | String |
|
||||
| `key` | 임의의 키. 이후 다운로드를 제어할 때 이 키가 필요함 | O | String |
|
||||
| `url` | 동영상 주소 | O | String |
|
||||
| `filename` | 파일명. 템플릿 규칙은 https://github.com/ytdl-org/youtube-dl/#output-template 참고. 미지정 시 사용자 설정 | X | String |
|
||||
| `save_path` | 저장 폴더 경로. 미지정 시 사용자 설정 | X | String |
|
||||
| `all_subs` | 모든 자막 다운로드 여부. 기본값: `false` | X | Boolean |
|
||||
| `sub_lang` | 자막 언어. 두 자리 국가 코드. 콤마(,)를 구분자로 여러 개 지정 가능. `all_subs` 키가 `false`일 때만 유효. 기본값: `"ko"` | X | String |
|
||||
| `auto_sub` | 자동생성 자막 다운로드 여부. 유튜브 전용. 기본값: `false` | X | Boolean |
|
||||
| `dateafter` | 지정한 날짜 이후에 업로드된 동영상만 다운로드. 미지정 시 모두 다운로드 | X | String |
|
||||
| `playlist` | 플레이리스트를 다운로드할 때 범위나 순서 지정. 미지정 시 모두 순서대로 다운로드 | X | String |
|
||||
| `archive` | 다운로드한 동영상의 ID를 기록할 파일 경로. 파일이 이미 있으면 이미 다운로드한 동영상은 다운로드 하지 않음. 미지정 시 기록하지 않음 | X | String |
|
||||
| `start` | 다운로드 준비 후 바로 다운로드를 시작할지 여부. 기본값: `false` | X | Boolean |
|
||||
| `cookiefile` | 다운로드 시 필요한 쿠키 파일 경로 | X | String |
|
||||
| `headers` | 다운로드 시 사용할 HTTP 헤더 정보 | X | String |
|
||||
|
||||
`dateafter` 키에 넣을 수 있는 날짜는 `"YYYYMMDD"` 또는 `"(now|today)[+-][0-9](day|week|month|year)(s)?"` 형식의 문자열입니다.
|
||||
`headers` 키에 넣는 값은 `json` 형식의 문자열입니다.
|
||||
|
||||
`playlist` 키에 넣을 수 있는 값은 `"1-3,7,10-13"` 형식의 범위 또는 `"reverse"`, `"random"`입니다.
|
||||
범위를 넣으면 플레이리스트에서 선택한 것만 다운로드합니다.
|
||||
`"reverse"`를 넣으면 전체 플레이리스트를 역순으로 다운로드합니다.
|
||||
`"random"`을 넣으면 전체 플레이리스트를 랜덤 순서로 다운로드합니다.
|
||||
|
||||
#### Response
|
||||
|
||||
| 키 | 설명 | 타입 |
|
||||
| ----------- | ------------------------------------------------------- | ------- |
|
||||
| `errorCode` | 에러 코드 | Integer |
|
||||
| `index` | 동영상 인덱스. 이후 다운로드를 제어할 때 이 값이 필요함 | Integer |
|
||||
|
||||
### /youtube-dl/api/start
|
||||
|
||||
다운로드 시작을 요청하는 API
|
||||
|
||||
#### Request
|
||||
|
||||
| 키 | 설명 | 필수 | 타입 |
|
||||
| -------- | ----------------------------------------------------------- | ---- | ------- |
|
||||
| `plugin` | 플러그인 이름 | O | String |
|
||||
| `index` | 제어할 동영상의 인덱스 | O | Integer |
|
||||
| `key` | 제어할 동영상에게 넘겨준 키. 이 값이 일치해야 요청이 실행됨 | O | String |
|
||||
|
||||
#### Response
|
||||
|
||||
| 키 | 설명 | 타입 |
|
||||
| ----------- | ------------------------- | ------- |
|
||||
| `errorCode` | 에러 코드 | Integer |
|
||||
| `status` | 요청을 받았을 당시의 상태 | Status |
|
||||
|
||||
### /youtube-dl/api/stop
|
||||
|
||||
다운로드 중지를 요청하는 API
|
||||
|
||||
#### Request
|
||||
|
||||
| 키 | 설명 | 필수 | 타입 |
|
||||
| -------- | ----------------------------------------------------------- | ---- | ------- |
|
||||
| `plugin` | 플러그인 이름 | O | String |
|
||||
| `index` | 제어할 동영상의 인덱스 | O | Integer |
|
||||
| `key` | 제어할 동영상에게 넘겨준 키. 이 값이 일치해야 요청이 실행됨 | O | String |
|
||||
|
||||
#### Response
|
||||
|
||||
| 키 | 설명 | 타입 |
|
||||
| ----------- | ------------------------- | ------- |
|
||||
| `errorCode` | 에러 코드 | Integer |
|
||||
| `status` | 요청을 받았을 당시의 상태 | Status |
|
||||
|
||||
### /youtube-dl/api/status
|
||||
|
||||
현재 상태를 반환하는 API
|
||||
|
||||
#### Request
|
||||
|
||||
| 키 | 설명 | 필수 | 타입 |
|
||||
| -------- | ----------------------------------------------------------- | ---- | ------- |
|
||||
| `plugin` | 플러그인 이름 | O | String |
|
||||
| `index` | 제어할 동영상의 인덱스 | O | Integer |
|
||||
| `key` | 제어할 동영상에게 넘겨준 키. 이 값이 일치해야 요청이 실행됨 | O | String |
|
||||
|
||||
#### Response
|
||||
|
||||
| 키 | 설명 | 타입 |
|
||||
| ------------ | ----------------------------------------------- | ------- |
|
||||
| `errorCode` | 에러 코드 | Integer |
|
||||
| `status` | 요청을 받았을 당시의 상태 | Status |
|
||||
| `type` | 다운로드 타입. `"video" "thumbnail" "subtitle"` | String |
|
||||
| `start_time` | 다운로드 시작 시간 | String |
|
||||
| `end_time` | 다운로드 종료 시간 | String |
|
||||
| `temp_path` | 임시 폴더 경로 | String |
|
||||
| `save_path` | 저장 폴더 경로 | String |
|
||||
|
||||
`start_time` 키와 `end_time` 키에 들어있는 시간은 `"YYYY-MM-DDThh:mm:ss"` 형식의 문자열입니다.
|
||||
물론 해당 정보가 없으면 null입니다.
|
||||
|
||||
## Changelog
|
||||
|
||||
v4.0.1
|
||||
|
||||
- 다운로드 요청 오류 수정
|
||||
|
||||
v4.0.0
|
||||
|
||||
- 최신 플러그인 구조로 변경
|
||||
- download, thumbnail, sub API에 headers 키 추가
|
||||
http 헤더 수정이 필요한 경우 활용할 수 있습니다.
|
||||
|
||||
v3.1.1
|
||||
|
||||
- 디폴트 youtube_dl 패키지를 yt-dlp로 변경
|
||||
|
||||
v3.1.0
|
||||
|
||||
- yt-dlp일 때 작동 안하는 문제 수정
|
||||
|
||||
v3.0.1
|
||||
|
||||
- 다운로드 후 파일 이동이 안되던 문제 수정
|
||||
|
||||
v3.0.0
|
||||
|
||||
- SJVA3 대응
|
||||
- SJVA에 flask_cors가 내장됨에 따라 항상 CORS 허용
|
||||
|
||||
v2.4.0
|
||||
|
||||
- API에 playlist 키 추가
|
||||
플레이리스트 다운로드 시 범위나 순서를 지정할 수 있습니다.
|
||||
- 썸네일 다운로드 기능 추가
|
||||
- thumbnail API 추가
|
||||
- 자막 다운로드 기능 추가
|
||||
- sub API 추가
|
||||
- 설정에 경로 선택 버튼 추가
|
||||
|
||||
v2.3.1
|
||||
|
||||
- yt-dlp 패키지명 변경 대응
|
||||
|
||||
v2.3.0
|
||||
|
||||
- youtube-dlc를 yt-dlp로 변경
|
||||
youtube-dlc가 2개월 넘게 커밋이 없어서 youtube-dlc의 포크 프로젝트인 yt-dlp로 변경했습니다.
|
||||
기존에 youtube-dlc로 사용하던 분들은 yt-dlp로 변경됩니다.
|
||||
|
||||
v2.2.0
|
||||
|
||||
- download API의 headers 키 제거
|
||||
|
||||
v2.1.2
|
||||
|
||||
- youtube-dlc 호환 문제 수정
|
||||
|
||||
v2.1.1
|
||||
|
||||
v2.1.0
|
||||
|
||||
- download API에 cookiefile, headers 키 추가
|
||||
카카오TV 동영상 다운로드에 활용할 수 있습니다. 잘하면 로봇 체크 패스에도 사용이 가능한 듯 싶습니다.
|
||||
Thanks to [soju6jan](https://github.com/soju6jan)
|
||||
|
||||
v2.0.0
|
||||
|
||||
- youtube-dlc 추가
|
||||
사용할 youtube-dl 패키지를 선택할 수 있습니다. 설정 변경 후 재시작해야 적용됩니다.
|
||||
|
||||
v1.7.0
|
||||
|
||||
- Python 3 지원
|
||||
Python 2를 유지한 채로 Python 3 지원을 추가했습니다.
|
||||
- download API에 dateafter 추가
|
||||
지정한 날짜 이후에 업로드된 동영상만 다운로드하는 옵션입니다. 플레이리스트 다운로드 시에 유용하게 사용할 수 있습니다.
|
||||
|
||||
v1.6.11
|
||||
|
||||
- 목록 메뉴에 전체 중지 버튼 추가
|
||||
|
||||
v1.6.10
|
||||
|
||||
- CORS 허용 설정이 작동하지 않는 문제 수정
|
||||
Thanks to [dbswnschl](https://github.com/dbswnschl)
|
||||
|
||||
v1.6.9
|
||||
|
||||
- 일부 동영상 사이트에서 다운로드 실패하는 문제 수정
|
||||
|
||||
v1.6.8
|
||||
|
||||
- download API에서 filename 키가 적용되지 않는 문제 수정
|
||||
|
||||
v1.6.7
|
||||
|
||||
- 일부 상황에서 다운로드가 완료로 표시되지 않는 문제 수정
|
||||
|
||||
v1.6.6
|
||||
|
||||
v1.6.5
|
||||
|
||||
- info_dict API가 동작하지 않는 문제 수정
|
||||
|
||||
v1.6.4
|
||||
|
||||
- FFmpeg 경로 설정 추가
|
||||
SJVA에 내장된 버전 말고 원하는 버전을 사용할 수 있습니다.
|
||||
- API에서 GET 요청 지원
|
||||
이제 GET 요청으로도 API를 사용할 수 있습니다.
|
||||
|
||||
v1.6.3
|
||||
|
||||
- 프록시 기능을 사용해도 국가차단 우회가 안 되는 문제 수정
|
||||
|
||||
v1.6.2
|
||||
|
||||
v1.6.1
|
||||
|
||||
v1.6.0
|
||||
|
||||
- API에 format_code를 format으로 변경
|
||||
- API에 temp_path 삭제
|
||||
|
||||
v1.5.1
|
||||
|
||||
v1.5.0
|
||||
|
||||
- 프록시 설정 추가
|
||||
- API에 archive 추가
|
||||
download-archive 기능으로 다운로드한 동영상의 ID를 기록하여 이미 다운로드한 동영상은 다운로드 하지 않는 옵션입니다.
|
||||
- status API의 시간 형식 변경 (ISO 8601)
|
||||
|
||||
v1.4.2
|
||||
|
||||
- --rm-cache-dir 옵션 추가
|
||||
- 플러그인 최초 설치 시 작동 안 되는 문제 수정
|
||||
|
||||
v1.4.1
|
||||
|
||||
- CORS 허용 설정 추가
|
||||
Thanks to [dbswnschl](https://github.com/dbswnschl)
|
||||
|
||||
v1.4.0
|
||||
|
||||
- socketio 적용
|
||||
목록 페이지에서 목록이 실시간으로 업데이트됩니다.
|
||||
|
||||
v1.3.5
|
||||
|
||||
v1.3.4
|
||||
|
||||
- 플러그인 구조를 가이드에 맞춰 변경
|
||||
플러그인 설정이 초기화됩니다.
|
||||
|
||||
v1.3.3
|
||||
|
||||
- API 변경
|
||||
|
||||
v1.3.2
|
||||
|
||||
- 파일명에 경로 지정 시 이미 존재하는 경로면 에러가 발생하는 문제 수정
|
||||
- celery 적용
|
||||
|
||||
v1.3.1
|
||||
|
||||
v1.3.0
|
||||
|
||||
- 후처리 기능 추가
|
||||
이제 비디오 변환이나 오디오 추출이 가능합니다.
|
||||
오디오 추출의 비트레이트는 192kbps로 설정되어 있습니다.
|
||||
|
||||
v1.2.5
|
||||
|
||||
- 기본 파일명 설정 추가
|
||||
- API에서 일부 키를 선택으로 변경
|
||||
|
||||
v1.2.4
|
||||
|
||||
- API Key 기능 추가
|
||||
|
||||
v1.2.3
|
||||
|
||||
- 저장 경로가 존재하지 않으면 생성하도록 개선
|
||||
|
||||
v1.2.2
|
||||
|
||||
- youtube-dl 패키지 업그레이드도 로그 찍히도록 수정
|
||||
|
||||
v1.2.1
|
||||
|
||||
v1.2.0
|
||||
|
||||
- API 추가
|
||||
이제 다른 플러그인에서 동영상 정보 가져오기, 다운로드 요청이 가능합니다.
|
||||
자세한 명세는 API 문단을 참고하세요.
|
||||
|
||||
v1.1.1
|
||||
|
||||
- 플레이리스트 다운로드 중 국가차단 등의 이유로 다운로드 실패한 동영상이 있으면 건너뛰도록 개선
|
||||
|
||||
v1.1.0
|
||||
|
||||
- 화질 선택 기능 추가
|
||||
- 잘못된 예외처리 수정
|
||||
|
||||
v1.0.2
|
||||
|
||||
v1.0.1
|
||||
|
||||
- 로그 좀 더 상세히 찍도록 수정
|
||||
|
||||
v1.0.0
|
||||
|
||||
- 바이너리 실행 방식에서 파이썬 임베딩 방식으로 변경
|
||||
- SJVA 시작 시 자동으로 youtube-dl 업데이트
|
||||
- 목록에서 진행률 표시 추가
|
||||
|
||||
v0.1.1
|
||||
|
||||
- 다운로드 실패 시 임시파일 삭제가 안 되는 문제 수정
|
||||
|
||||
v0.1.0
|
||||
|
||||
- 최초 공개
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
from flask import jsonify
|
||||
|
||||
|
||||
class LogicAbort:
|
||||
@staticmethod
|
||||
def abort(base, code):
|
||||
base["errorCode"] = code
|
||||
return jsonify(base)
|
||||
@@ -1,74 +0,0 @@
|
||||
너 따위가 마왕을 이길 수 있다고 생각하지 마 라며 용사 파티에서 추방되었으니 왕도에서 멋대로 살고 싶다 (2026)
|
||||
내가 연인이 될 수 있을 리 없잖아, 무리무리! (※무리가 아니었다 !) 속편 (2026)
|
||||
소꿉친구와는 러브 코미디를 할 수 없어 (2026)
|
||||
어느 날 공주가 되어 버렸다 - 중국어 (2025)
|
||||
타몬 군 지금 어느 쪽 ! (2026)
|
||||
치토세 군은 라무네 병 속에 (2025)
|
||||
친구의 여동생이 나한테만 짜증나게 군다 (2025)
|
||||
토지마 탄자부로는 가면라이더가 되고 싶어 (2025)
|
||||
이세계 사정은 사축 하기 나름 (2026)
|
||||
무사태평 영주의 즐거운 영지 방어 ~생산계 마법으로 이름 없는 마을을 최강의 성채 도시로~ (2026)
|
||||
용사 파티에 귀여운 애가 있어서, 고백해봤다. (2026)
|
||||
내가 너무 귀여운 걸 어쩌겠어! (2025)
|
||||
더 파이팅 뉴 챌린저 (2009)
|
||||
볼룸에 오신 것을 환영합니다 (2017)
|
||||
아르마는 가족이 되고 싶어 (2025)
|
||||
미소가 끊이지 않는 직장입니다 (2025)
|
||||
악식 영애와 광혈 공작 (2025)
|
||||
온화한 귀족의 휴가의 권장 (2026)
|
||||
용사 파티에서 쫓겨난 다재무능 (2026)
|
||||
밤은 고양이와 함께 시즌 3 (2024)
|
||||
미남 고교 지구방위부 하이칼라! (2025)
|
||||
마왕의 딸은 너무 친절해!! (2026)
|
||||
사망 유희로 밥을 먹는다. (2026)
|
||||
정반대의 너와 나 (2026)
|
||||
마술사 쿠논은 보인다 (2026)
|
||||
고문 아르바이트의 일상 (2026)
|
||||
카야는 무섭지 않아 (2026)
|
||||
페이트 스트레인지 페이크 (2026)
|
||||
전생했더니 드래곤의 알이었다 ~최강이 아니면 목표로 하지 않아~ (2026)
|
||||
공주님 “고문“의 시간입니다 2기 (2026)
|
||||
나를 먹고 싶은, 괴물 (2025)
|
||||
비밀의 아이프리 (2024)
|
||||
마루는 강쥐 (2025)
|
||||
울트라맨 오메가 (2025)
|
||||
트라이건 스타게이즈 (2026)
|
||||
아름다운 그대에게 (2026)
|
||||
아름다운 초저녁달 (2026)
|
||||
용사형에 처함 (2026)
|
||||
데드 어카운트 (2026)
|
||||
에리스의 성배 (2026)
|
||||
한밤중 하트튠 (2026)
|
||||
헬 모드 ~파고들기 좋아하는 게이머는 폐급 설정 이세계에서 무쌍한다~ (2026)
|
||||
귀족 전생 ~축복받은 태생으로 최강의 힘을 손에 넣다~ (2026)
|
||||
투명남과 인간녀 ~곧 부부가 될 두 사람~ (2026)
|
||||
라디앙 시즌 2 (2019)
|
||||
마도정병의 슬레이브 2 (2026)
|
||||
【최애의 아이】 3기 (2026)
|
||||
불꽃 소방대 3기 part 2 (2026)
|
||||
무한의 주인 IMMORTAL (2019)
|
||||
푸른 오케스트라 Season 2 (2025)
|
||||
불멸의 그대에게 Season 3 (2025)
|
||||
와타리 군의 XX가 붕괴 직전 (2025)
|
||||
비질랜티 -나의 히어로 아카데미아 ILLEGALS- Season 2 (2026)
|
||||
아빠는 영웅, 엄마는 정령, 딸인 나는 전생자. (2025)
|
||||
그노시아 (2025)
|
||||
가치아쿠타 (2025)
|
||||
위국일기 (2026)
|
||||
주술회전 3기 사멸회유 전편 (2025)
|
||||
주술회전 3기 사멸회유 전편 (2026)
|
||||
원펀맨 3기 (2025)
|
||||
용족 Ⅱ-The Mourner's Eyes- - 중국어 (2025)
|
||||
용족 Ⅱ-The Mourner's Eyes- - 일본어 (2025)
|
||||
어차피, 사랑하고 만다. 2기 (2026)
|
||||
안녕! 틴틴팅클 (2025)
|
||||
(자막) 달의 요정 세일러 문 (2021)
|
||||
(더빙) 카쿠리요의 여관밥 (2018)
|
||||
(더빙) 디지몬 비트브레이크 (2025)
|
||||
(자막) 장송의 프리렌 2기 (2026)
|
||||
(자막) 원피스 33기 (2024)
|
||||
(더빙) 하나Doll (2025)
|
||||
DARK MOON 달의 제단 (2026)
|
||||
SI-VIS The Sound of Heroes (2025)
|
||||
WORKING!!! (3기) (2015)
|
||||
WWW.WORKING!! (2016)
|
||||
@@ -1,24 +0,0 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
# FF 경로 설정
|
||||
sys.path.append('/Volumes/WD/Users/Work/python/flaskfarm')
|
||||
from framework import F
|
||||
from gds_dviewer.logic import LogicExplorer
|
||||
|
||||
def check():
|
||||
try:
|
||||
logic = LogicExplorer(None) # 인스턴스 생성 (싱글톤 패턴일 경우 기존 인스턴스 접근 필요할 수도)
|
||||
# 실제로는 LogicExplorer.instance 같은 게 있는지 확인 필요
|
||||
# 하지만 gds_dviewer는 보통 P.logic에 저장됨.
|
||||
|
||||
# P instance 가져오기
|
||||
from gds_dviewer.plugin import P
|
||||
indexer = P.logic.explorer.indexer
|
||||
print(f"Is Running: {indexer.is_running}")
|
||||
print(f"Progress: {indexer.progress}")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
check()
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
import unicodedata
|
||||
sys.path.append('/Volumes/WD/Users/Work/python/flaskfarm')
|
||||
from framework import app, db
|
||||
from system.logic import SystemLogic
|
||||
|
||||
# 플러그인 모듈 로드
|
||||
from data.plugins.gds_dviewer.model_file_index import FileIndex
|
||||
|
||||
def cleanup_duplicates(parent_path):
|
||||
with app.app_context():
|
||||
# 해당 폴더의 모든 항목 조회
|
||||
items = FileIndex.query.filter_by(parent_path=parent_path).all()
|
||||
print(f"Total items in {parent_path}: {len(items)}")
|
||||
|
||||
# NFC 이름 기준으로 그룹화
|
||||
groups = {}
|
||||
for item in items:
|
||||
nfc_name = unicodedata.normalize('NFC', item.name)
|
||||
if nfc_name not in groups:
|
||||
groups[nfc_name] = []
|
||||
groups[nfc_name].append(item)
|
||||
|
||||
deleted_count = 0
|
||||
for name, group in groups.items():
|
||||
if len(group) > 1:
|
||||
print(f"Found duplicate: {name} (Count: {len(group)})")
|
||||
|
||||
# 우선순위: 메타데이터 있는 것 > ID가 작은 것(오래된 것)
|
||||
# 정렬: 메타데이터 있나? (내림차순 True=1, False=0), ID (오름차순)
|
||||
group.sort(key=lambda x: (1 if x.meta_id else 0, -x.id), reverse=True)
|
||||
|
||||
# 첫 번째(가장 좋은 것)를 남기고 나머지 삭제
|
||||
keep = group[0]
|
||||
remove_list = group[1:]
|
||||
|
||||
print(f" Keep: ID={keep.id}, Meta={keep.meta_id}, Name={keep.name}")
|
||||
for rm in remove_list:
|
||||
print(f" REMOVE: ID={rm.id}, Meta={rm.meta_id}, Name={rm.name}")
|
||||
db.session.delete(rm)
|
||||
deleted_count += 1
|
||||
|
||||
if deleted_count > 0:
|
||||
db.session.commit()
|
||||
print(f"Deleted {deleted_count} duplicate items.")
|
||||
else:
|
||||
print("No duplicates found to delete.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
cleanup_duplicates('VIDEO/방송중/라프텔 애니메이션')
|
||||
@@ -1,26 +0,0 @@
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib'))
|
||||
|
||||
from support import SupportFile, logger
|
||||
|
||||
|
||||
class ChangeUI:
|
||||
def change(self, target, old, new):
|
||||
if target == 'macro':
|
||||
target_filepath = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib', 'framework', 'templates', 'macro.html')
|
||||
text = SupportFile.read_file(target_filepath)
|
||||
SupportFile.write_file(target_filepath, text.replace(old, new))
|
||||
|
||||
def process_args(self):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--target', default='macro')
|
||||
parser.add_argument('--old', default='btn-outline-primary')
|
||||
parser.add_argument('--new', required=True)
|
||||
args = parser.parse_args()
|
||||
self.change(args.target, args.old, args.new)
|
||||
|
||||
if __name__== "__main__":
|
||||
ChangeUI().process_args()
|
||||
@@ -1,48 +0,0 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib'))
|
||||
|
||||
from support import SupportFile, SupportSC, logger
|
||||
|
||||
|
||||
class CodeEncode:
|
||||
def start_folder(self, folderpath):
|
||||
for name in os.listdir(folderpath):
|
||||
filepath = os.path.join(folderpath, name)
|
||||
if os.path.isfile(filepath) and name not in ['setup.py', '__init__.py'] and name.endswith('.py'):
|
||||
self.encode_file(filepath)
|
||||
|
||||
def encode_file(self, filepath):
|
||||
if filepath.endswith(".py") == False:
|
||||
logger.info("is not .py file")
|
||||
return
|
||||
text = SupportFile.read_file(filepath)
|
||||
data = SupportSC.encode(text, 1)
|
||||
SupportFile.write_file(filepath + 'f', data)
|
||||
logger.info(f"Create {os.path.basename(filepath + 'f')}")
|
||||
|
||||
|
||||
def process_args(self):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--mode', default='encode')
|
||||
parser.add_argument('--source', required=True, help=u'absolute path. folder or file')
|
||||
args = parser.parse_args()
|
||||
if SupportSC.LIBRARY_LOADING == False:
|
||||
logger.error("sc import fail")
|
||||
return
|
||||
if os.path.exists(args.source):
|
||||
if os.path.isdir(args.source):
|
||||
self.start_folder(args.source)
|
||||
elif os.path.isfile(args.source):
|
||||
self.encode_file(args.source)
|
||||
else:
|
||||
logger.error("wrong source path!!")
|
||||
|
||||
|
||||
if __name__== "__main__":
|
||||
CodeEncode().process_args()
|
||||
|
||||
# python C:\work\FlaskFarm\flaskfarm\cli\code_encode.py --source=C:\work\FlaskFarm\data\LOADING\sjva
|
||||
@@ -1,43 +0,0 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib'))
|
||||
|
||||
from support import SupportFile, SupportSC, logger
|
||||
|
||||
|
||||
class Encode:
|
||||
def start_folder(self, folderpath):
|
||||
for name in os.listdir(folderpath):
|
||||
filepath = os.path.join(folderpath, name)
|
||||
if os.path.isfile(filepath) and name not in ['setup.py', '__init__.py']:
|
||||
self.encode_file(filepath)
|
||||
|
||||
def encode_file(self, filepath):
|
||||
text = SupportFile.read_file(filepath)
|
||||
data = SupportSC.encode(text, 0)
|
||||
SupportFile.write_file(filepath + 'f', data)
|
||||
logger.info(f"Create {os.path.basename(filepath + 'f')}")
|
||||
|
||||
|
||||
def process_args(self):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--mode', default='encode')
|
||||
parser.add_argument('--source', required=True, help=u'absolute path. folder or file')
|
||||
args = parser.parse_args()
|
||||
if SupportSC.LIBRARY_LOADING == False:
|
||||
logger.error("sc import fail")
|
||||
return
|
||||
if os.path.exists(args.source):
|
||||
if os.path.isdir(args.source):
|
||||
self.start_folder(args.source)
|
||||
elif os.path.isfile(args.source):
|
||||
self.encode_file(args.source)
|
||||
else:
|
||||
logger.error("wrong source path!!")
|
||||
|
||||
|
||||
if __name__== "__main__":
|
||||
Encode().process_args()
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
path_data: '/data'
|
||||
##########################################################################
|
||||
# 데이터 폴더 루트 경로
|
||||
# 윈도우의 경우 폴더 구분 기호 \ 를 두개 사용
|
||||
# 예) data_folder: "C:\\work\\data"
|
||||
# 현재 폴더인 경우 .
|
||||
#path_data: "."
|
||||
|
||||
# 개발용 플러그인 경로
|
||||
path_dev: '/Volumes/WD/Users/Work/python/ff_dev_plugins'
|
||||
|
||||
# gevent 사용여부
|
||||
# 플러그인 개발이나 termux 환경에서의 실행 같이 특수한 경우에만 false로 사용.
|
||||
# 실행환경에 gevent 관련 패키지가 설치되어 있지 않는다면 값과 상관 없이 false로 동작.
|
||||
use_gevent: true
|
||||
|
||||
# celery 사용 여부
|
||||
use_celery: true
|
||||
|
||||
# redis port
|
||||
# celery를 사용하는 경우 사용하는 redis 포트
|
||||
# 환경변수 REDIS_PORT 값이 있는 경우 무시됨.
|
||||
#redis_port: 6379
|
||||
|
||||
# 포트
|
||||
# 생략시 DB 값을 사용.
|
||||
port: 9999
|
||||
|
||||
# 소스 수정시 재로딩
|
||||
# 두번 로딩되는 것을 감안하여 코딩해야 함.
|
||||
# debug: true
|
||||
debug: false
|
||||
|
||||
# 플러그인 업데이트 여부
|
||||
# - true인 경우 로딩시 플러그인을 업데이트 함.
|
||||
# /data/plugins 폴더에 있는 플러그인 만을 대상으로 함.
|
||||
# - debug 값이 true인 경우에는 항상 false
|
||||
plugin_update: false
|
||||
|
||||
# running_type
|
||||
# termux, entware 인 경우 입력 함.
|
||||
running_type: 'docker'
|
||||
# 개발용 폴더만 로딩할 경우 사용
|
||||
# plugin_loading_only_devpath: true
|
||||
# 로딩할 플러그인 package 명
|
||||
# 타 플러그인과 연동되는 플러그인 개발시 사용.
|
||||
# import 로 런타임에 로딩할 수 있지만 타 패키지 메뉴 등은 표시되지 않음.
|
||||
#plugin_loading_list: ['command', 'flaskcode']
|
||||
|
||||
# 로딩 제외할 플러그인 package 명
|
||||
plugin_except_list: ['.idea', '.git', '.vscode', '.nova', '.mypy_cache']
|
||||
@@ -1,51 +0,0 @@
|
||||
path_data: 'data'
|
||||
##########################################################################
|
||||
# 데이터 폴더 루트 경로
|
||||
# 윈도우의 경우 폴더 구분 기호 \ 를 두개 사용
|
||||
# 예) data_folder: "C:\\work\\data"
|
||||
# 현재 폴더인 경우 .
|
||||
#path_data: "."
|
||||
|
||||
# 개발용 플러그인 경로
|
||||
path_dev: '/Volumes/WD/Users/Work/python/ff_dev_plugins/anime_downloader'
|
||||
|
||||
# gevent 사용여부
|
||||
# 플러그인 개발이나 termux 환경에서의 실행 같이 특수한 경우에만 false로 사용.
|
||||
# 실행환경에 gevent 관련 패키지가 설치되어 있지 않는다면 값과 상관 없이 false로 동작.
|
||||
use_gevent: true
|
||||
|
||||
# celery 사용 여부
|
||||
use_celery: true
|
||||
|
||||
# redis port
|
||||
# celery를 사용하는 경우 사용하는 redis 포트
|
||||
# 환경변수 REDIS_PORT 값이 있는 경우 무시됨.
|
||||
#redis_port: 6379
|
||||
|
||||
# 포트
|
||||
# 생략시 DB 값을 사용.
|
||||
port: 9099
|
||||
|
||||
# 소스 수정시 재로딩
|
||||
# 두번 로딩되는 것을 감안하여 코딩해야 함.
|
||||
# debug: true
|
||||
debug: true
|
||||
|
||||
# 플러그인 업데이트 여부
|
||||
# - true인 경우 로딩시 플러그인을 업데이트 함.
|
||||
# /data/plugins 폴더에 있는 플러그인 만을 대상으로 함.
|
||||
# - debug 값이 true인 경우에는 항상 false
|
||||
plugin_update: false
|
||||
|
||||
# running_type
|
||||
# termux, entware 인 경우 입력 함.
|
||||
running_type: 'native'
|
||||
# 개발용 폴더만 로딩할 경우 사용
|
||||
# plugin_loading_only_devpath: true
|
||||
# 로딩할 플러그인 package 명
|
||||
# 타 플러그인과 연동되는 플러그인 개발시 사용.
|
||||
# import 로 런타임에 로딩할 수 있지만 타 패키지 메뉴 등은 표시되지 않음.
|
||||
#plugin_loading_list: ['command', 'flaskcode']
|
||||
|
||||
# 로딩 제외할 플러그인 package 명
|
||||
plugin_except_list: ['.idea', '.git', '.vscode', '.nova', '.mypy_cache']
|
||||
@@ -1,23 +0,0 @@
|
||||
# FlaskFarm Docker Compose
|
||||
# Usage:
|
||||
# docker compose up -d # 시작
|
||||
# docker compose down # 중지
|
||||
# docker compose logs -f # 로그 보기
|
||||
|
||||
services:
|
||||
flaskfarm:
|
||||
build: .
|
||||
container_name: flaskfarm
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9099:9099"
|
||||
volumes:
|
||||
# FlaskFarm data 폴더 (DB, 설정, 다운로드 등)
|
||||
- ./data:/data
|
||||
# 플러그인 폴더 (외부 마운트)
|
||||
- ../ff_dev_plugins:/data/plugins
|
||||
environment:
|
||||
- TZ=Asia/Seoul
|
||||
- PYTHONUNBUFFERED=1
|
||||
# M1/M2 Mac에서 ARM64 Linux 이미지 사용
|
||||
platform: linux/arm64
|
||||
@@ -1,90 +0,0 @@
|
||||
aiohttp==3.8.3
|
||||
aiosignal==1.2.0
|
||||
amqp==5.1.1
|
||||
appdirs==1.4.4
|
||||
APScheduler==3.9.1
|
||||
async-generator==1.10
|
||||
async-timeout==4.0.2
|
||||
attrs==22.1.0
|
||||
beautifulsoup4==4.11.1
|
||||
bidict==0.22.0
|
||||
billiard==3.6.4.0
|
||||
cattrs==22.2.0
|
||||
celery==5.2.7
|
||||
certifi==2022.9.24
|
||||
charset-normalizer==2.1.1
|
||||
click==8.1.3
|
||||
click-didyoumean==0.3.0
|
||||
click-plugins==1.1.1
|
||||
click-repl==0.2.0
|
||||
cloudscraper==1.2.64
|
||||
Deprecated==1.2.13
|
||||
discord-webhook==0.17.0
|
||||
EditorConfig==0.12.3
|
||||
exceptiongroup==1.0.0rc9
|
||||
Flask==2.2.2
|
||||
Flask-Cors==3.0.10
|
||||
Flask-Dropzone==1.6.0
|
||||
Flask-Login==0.6.2
|
||||
Flask-Markdown==0.3
|
||||
Flask-SocketIO==5.3.1
|
||||
Flask-SQLAlchemy==3.0.2
|
||||
FlaskFarm==4.0.47
|
||||
frozenlist==1.3.1
|
||||
gevent==22.10.1
|
||||
gevent-websocket==0.10.1
|
||||
greenlet==1.1.3.post0
|
||||
h11==0.14.0
|
||||
idna==3.4
|
||||
importlib-metadata==5.0.0
|
||||
itsdangerous==2.1.2
|
||||
Jinja2==3.1.2
|
||||
jsbeautifier==1.14.7
|
||||
kombu==5.2.4
|
||||
lxml==4.9.1
|
||||
Markdown==3.4.1
|
||||
MarkupSafe==2.1.1
|
||||
multidict==6.0.2
|
||||
outcome==1.2.0
|
||||
packaging==21.3
|
||||
Pillow==9.2.0
|
||||
prompt-toolkit==3.0.31
|
||||
psutil==5.9.3
|
||||
pycryptodome==3.15.0
|
||||
pyparsing==3.0.9
|
||||
PySocks==1.7.1
|
||||
python-dotenv==0.21.0
|
||||
python-engineio==4.3.4
|
||||
python-socketio==5.7.2
|
||||
pytz==2022.5
|
||||
pytz-deprecation-shim==0.1.0.post0
|
||||
PyYAML==6.0
|
||||
redis==4.3.4
|
||||
requests==2.28.1
|
||||
requests-cache==0.9.6
|
||||
requests-toolbelt==0.10.1
|
||||
selenium==4.5.0
|
||||
selenium-stealth==1.0.6
|
||||
six==1.16.0
|
||||
sniffio==1.3.0
|
||||
sortedcontainers==2.4.0
|
||||
soupsieve==2.3.2.post1
|
||||
SQLAlchemy==1.4.42
|
||||
telepot-mod==0.0.1
|
||||
tqdm==4.64.1
|
||||
trio==0.22.0
|
||||
trio-websocket==0.9.2
|
||||
tzdata==2022.5
|
||||
tzlocal==4.2
|
||||
url-normalize==1.4.3
|
||||
urllib3==1.26.12
|
||||
vine==5.0.0
|
||||
wcwidth==0.2.5
|
||||
webdriver-manager==3.8.4
|
||||
Werkzeug==2.2.2
|
||||
wrapt==1.14.1
|
||||
wsproto==1.2.0
|
||||
yarl==1.8.1
|
||||
zipp==3.10.0
|
||||
zope.event==4.5.0
|
||||
zope.interface==5.5.0
|
||||
@@ -1,97 +0,0 @@
|
||||
aiohttp>=3.9.0
|
||||
aiosignal==1.2.0
|
||||
amqp>=5.1.1
|
||||
appdirs==1.4.4
|
||||
APScheduler==3.9.1
|
||||
async-generator==1.10
|
||||
async-timeout==4.0.2
|
||||
attrs==22.1.0
|
||||
beautifulsoup4==4.11.1
|
||||
bidict==0.22.0
|
||||
billiard>=3.6.4.0
|
||||
cattrs==22.2.0
|
||||
celery>=5.4.0
|
||||
certifi>=2022.9.24
|
||||
charset-normalizer==2.1.1
|
||||
click>=8.1.7
|
||||
click-didyoumean==0.3.0
|
||||
click-plugins==1.1.1
|
||||
click-repl==0.2.0
|
||||
cloudscraper==1.2.64
|
||||
Deprecated>=1.2.14
|
||||
discord-webhook==0.17.0
|
||||
EditorConfig==0.12.3
|
||||
exceptiongroup==1.0.0rc9
|
||||
Flask>=3.0.0
|
||||
Flask-Cors>=3.0.10
|
||||
Flask-Dropzone>=1.6.0
|
||||
Flask-Login>=0.6.3
|
||||
Flask-Markdown==0.3
|
||||
Flask-SocketIO>=5.3.6
|
||||
Flask-SQLAlchemy>=3.0.2
|
||||
FlaskFarm==4.0.47
|
||||
frozenlist>=1.4.1
|
||||
gevent>=24.2.1
|
||||
gevent-websocket==0.10.1
|
||||
greenlet>=3.2.2
|
||||
h11==0.14.0
|
||||
idna==3.4
|
||||
importlib-metadata==5.0.0
|
||||
itsdangerous>=2.1.2
|
||||
Jinja2>=3.1.2
|
||||
jsbeautifier==1.14.7
|
||||
kombu>=5.3.0
|
||||
lxml>=4.9.4
|
||||
Markdown==3.4.1
|
||||
MarkupSafe>=2.1.4
|
||||
multidict>=6.0.5
|
||||
outcome==1.2.0
|
||||
packaging==21.3
|
||||
Pillow>=10.0.0
|
||||
prompt-toolkit==3.0.31
|
||||
psutil==5.9.3
|
||||
pycryptodome==3.15.0
|
||||
pyparsing==3.0.9
|
||||
PySocks==1.7.1
|
||||
python-dotenv==0.21.0
|
||||
python-engineio>=4.8.0
|
||||
python-socketio>=5.10.0
|
||||
pytz==2022.5
|
||||
pytz-deprecation-shim==0.1.0.post0
|
||||
PyYAML>=6.0.2
|
||||
redis>=4.3.4
|
||||
requests==2.28.1
|
||||
requests-cache==0.9.6
|
||||
requests-toolbelt==0.10.1
|
||||
selenium>=4.20.0
|
||||
selenium-stealth==1.0.6
|
||||
six==1.16.0
|
||||
sniffio==1.3.0
|
||||
sortedcontainers==2.4.0
|
||||
soupsieve==2.3.2.post1
|
||||
SQLAlchemy==1.4.42
|
||||
telepot-mod==0.0.1
|
||||
tqdm==4.64.1
|
||||
trio==0.22.0
|
||||
trio-websocket==0.9.2
|
||||
tzdata>=2022.5
|
||||
tzlocal==4.2
|
||||
url-normalize==1.4.3
|
||||
urllib3==1.26.12
|
||||
vine>=5.1.0
|
||||
wcwidth==0.2.5
|
||||
webdriver-manager>=4.0.0
|
||||
Werkzeug>=3.0.0
|
||||
wrapt==1.14.1
|
||||
wsproto==1.2.0
|
||||
yarl>=1.9.4
|
||||
zipp==3.10.0
|
||||
zope.event>=5.0
|
||||
zope.interface>=7.0
|
||||
zendriver
|
||||
camoufox
|
||||
curl_cffi
|
||||
yt-dlp
|
||||
loguru
|
||||
shazamio
|
||||
shazamio-core
|
||||
@@ -1,74 +0,0 @@
|
||||
너 따위가 마왕을 이길 수 있다고 생각하지 마 라며 용사 파티에서 추방되었으니 왕도에서 멋대로 살고 싶다 (2026)
|
||||
내가 연인이 될 수 있을 리 없잖아, 무리무리! (※무리가 아니었다 !) 속편 (2026)
|
||||
소꿉친구와는 러브 코미디를 할 수 없어 (2026)
|
||||
어느 날 공주가 되어 버렸다 - 중국어 (2025)
|
||||
타몬 군 지금 어느 쪽 ! (2026)
|
||||
치토세 군은 라무네 병 속에 (2025)
|
||||
친구의 여동생이 나한테만 짜증나게 군다 (2025)
|
||||
토지마 탄자부로는 가면라이더가 되고 싶어 (2025)
|
||||
이세계 사정은 사축 하기 나름 (2026)
|
||||
무사태평 영주의 즐거운 영지 방어 ~생산계 마법으로 이름 없는 마을을 최강의 성채 도시로~ (2026)
|
||||
용사 파티에 귀여운 애가 있어서, 고백해봤다. (2026)
|
||||
내가 너무 귀여운 걸 어쩌겠어! (2025)
|
||||
더 파이팅 뉴 챌린저 (2009)
|
||||
볼룸에 오신 것을 환영합니다 (2017)
|
||||
아르마는 가족이 되고 싶어 (2025)
|
||||
미소가 끊이지 않는 직장입니다 (2025)
|
||||
악식 영애와 광혈 공작 (2025)
|
||||
온화한 귀족의 휴가의 권장 (2026)
|
||||
용사 파티에서 쫓겨난 다재무능 (2026)
|
||||
밤은 고양이와 함께 시즌 3 (2024)
|
||||
미남 고교 지구방위부 하이칼라! (2025)
|
||||
마왕의 딸은 너무 친절해!! (2026)
|
||||
사망 유희로 밥을 먹는다. (2026)
|
||||
정반대의 너와 나 (2026)
|
||||
마술사 쿠논은 보인다 (2026)
|
||||
고문 아르바이트의 일상 (2026)
|
||||
카야는 무섭지 않아 (2026)
|
||||
페이트 스트레인지 페이크 (2026)
|
||||
전생했더니 드래곤의 알이었다 ~최강이 아니면 목표로 하지 않아~ (2026)
|
||||
공주님 “고문“의 시간입니다 2기 (2026)
|
||||
나를 먹고 싶은, 괴물 (2025)
|
||||
비밀의 아이프리 (2024)
|
||||
마루는 강쥐 (2025)
|
||||
울트라맨 오메가 (2025)
|
||||
트라이건 스타게이즈 (2026)
|
||||
아름다운 그대에게 (2026)
|
||||
아름다운 초저녁달 (2026)
|
||||
용사형에 처함 (2026)
|
||||
데드 어카운트 (2026)
|
||||
에리스의 성배 (2026)
|
||||
한밤중 하트튠 (2026)
|
||||
헬 모드 ~파고들기 좋아하는 게이머는 폐급 설정 이세계에서 무쌍한다~ (2026)
|
||||
귀족 전생 ~축복받은 태생으로 최강의 힘을 손에 넣다~ (2026)
|
||||
투명남과 인간녀 ~곧 부부가 될 두 사람~ (2026)
|
||||
라디앙 시즌 2 (2019)
|
||||
마도정병의 슬레이브 2 (2026)
|
||||
【최애의 아이】 3기 (2026)
|
||||
불꽃 소방대 3기 part 2 (2026)
|
||||
무한의 주인 IMMORTAL (2019)
|
||||
푸른 오케스트라 Season 2 (2025)
|
||||
불멸의 그대에게 Season 3 (2025)
|
||||
와타리 군의 XX가 붕괴 직전 (2025)
|
||||
비질랜티 -나의 히어로 아카데미아 ILLEGALS- Season 2 (2026)
|
||||
아빠는 영웅, 엄마는 정령, 딸인 나는 전생자. (2025)
|
||||
그노시아 (2025)
|
||||
가치아쿠타 (2025)
|
||||
위국일기 (2026)
|
||||
주술회전 3기 사멸회유 전편 (2025)
|
||||
주술회전 3기 사멸회유 전편 (2026)
|
||||
원펀맨 3기 (2025)
|
||||
용족 Ⅱ-The Mourner's Eyes- - 중국어 (2025)
|
||||
용족 Ⅱ-The Mourner's Eyes- - 일본어 (2025)
|
||||
어차피, 사랑하고 만다. 2기 (2026)
|
||||
안녕! 틴틴팅클 (2025)
|
||||
(자막) 달의 요정 세일러 문 (2021)
|
||||
(더빙) 카쿠리요의 여관밥 (2018)
|
||||
(더빙) 디지몬 비트브레이크 (2025)
|
||||
(자막) 장송의 프리렌 2기 (2026)
|
||||
(자막) 원피스 33기 (2024)
|
||||
(더빙) 하나Doll (2025)
|
||||
DARK MOON 달의 제단 (2026)
|
||||
SI-VIS The Sound of Heroes (2025)
|
||||
WORKING!!! (3기) (2015)
|
||||
WWW.WORKING!! (2016)
|
||||
@@ -1,69 +0,0 @@
|
||||
path_data: "."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##########################################################################
|
||||
# 데이터 폴더 루트 경로
|
||||
# 윈도우의 경우 폴더 구분 기호 \ 를 두개 사용
|
||||
# 예) data_folder: "C:\\work\\data"
|
||||
# 현재 폴더인 경우 .
|
||||
#path_data: "."
|
||||
|
||||
|
||||
# 개발용 플러그인 경로
|
||||
#path_dev:
|
||||
|
||||
|
||||
# gevent 사용여부
|
||||
# 플러그인 개발이나 termux 환경에서의 실행 같이 특수한 경우에만 false로 사용.
|
||||
# 실행환경에 gevent 관련 패키지가 설치되어 있지 않는다면 값과 상관 없이 false로 동작.
|
||||
#use_gevent: true
|
||||
|
||||
# celery 사용 여부
|
||||
#use_celery: true
|
||||
|
||||
# redis port
|
||||
# celery를 사용하는 경우 사용하는 redis 포트
|
||||
# 환경변수 REDIS_PORT 값이 있는 경우 무시됨.
|
||||
#redis_port: 6379
|
||||
|
||||
# 포트
|
||||
# 생략시 DB 값을 사용.
|
||||
#port: 9999
|
||||
|
||||
# 소스 수정시 재로딩
|
||||
# 두번 로딩되는 것을 감안하여 코딩해야 함.
|
||||
#debug: false
|
||||
|
||||
# 플러그인 업데이트 여부
|
||||
# - true인 경우 로딩시 플러그인을 업데이트 함.
|
||||
# /data/plugins 폴더에 있는 플러그인 만을 대상으로 함.
|
||||
# - debug 값이 true인 경우에는 항상 false
|
||||
#plugin_update: true
|
||||
|
||||
# running_type
|
||||
# termux, entware 인 경우 입력 함.
|
||||
#running_type: "native"
|
||||
|
||||
# 개발용 폴더만 로딩할 경우 사용
|
||||
#plugin_loading_only_devpath: true
|
||||
|
||||
# 로딩할 플러그인 package 명
|
||||
# 타 플러그인과 연동되는 플러그인 개발시 사용.
|
||||
# import 로 런타임에 로딩할 수 있지만 타 패키지 메뉴 등은 표시되지 않음.
|
||||
#plugin_loading_list: ['command', 'flaskcode']
|
||||
|
||||
|
||||
# 로딩 제외할 플러그인 package 명
|
||||
#plugin_except_list: ['terminal', 'membership']
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
# 카테고리
|
||||
# uri 가 plugin인 경우 name 값은 대체
|
||||
|
||||
|
||||
#- name: "기본 기능"
|
||||
# list:
|
||||
# - uri: "terminal"
|
||||
# - uri: "flaskfilemanager"
|
||||
# - uri: "flaskcode"
|
||||
|
||||
|
||||
#- name: "링크"
|
||||
# list:
|
||||
# - uri: "https://app.plex.tv"
|
||||
# name: "Plex"
|
||||
# target: "_self"
|
||||
# - uri: "https://www.netflix.com"
|
||||
# name: "Netflix"
|
||||
|
||||
|
||||
- name: "시스템"
|
||||
list:
|
||||
- uri: "system"
|
||||
name: "설정"
|
||||
- uri: "setting"
|
||||
name: "확장 설정"
|
||||
- uri: "system/plugin"
|
||||
name: "플러그인 관리"
|
||||
- uri: "system/tool/command"
|
||||
name: "Command 관리"
|
||||
- uri: "-"
|
||||
- uri: "system/logout"
|
||||
name: "로그아웃"
|
||||
- uri: "system/restart"
|
||||
name: "재시작(업데이트)"
|
||||
- uri: "system/shutdown"
|
||||
#uri: "javascript:shutdown_confirm();"
|
||||
name: "종료"
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# DEFAULT 필수
|
||||
# message id 별로 각각 알림 설정 추가
|
||||
# message id 가 없을 경우 DEFAULT 값 사용
|
||||
# 공통: type, enable_time (시작시간-종료시간. 항상 받을 경우 생략)
|
||||
|
||||
DEFAULT:
|
||||
- type: 'telegram'
|
||||
token: ''
|
||||
chat_id: ''
|
||||
disable_notification: false
|
||||
enable_time: '09-23'
|
||||
- type: 'discord'
|
||||
webhook: ''
|
||||
enable_time: '09-23'
|
||||
|
||||
|
||||
system_start:
|
||||
- type: 'telegram'
|
||||
token: ''
|
||||
chat_id: ''
|
||||
disable_notification: false
|
||||
- type: 'discord'
|
||||
webhook: ''
|
||||
@@ -1,29 +0,0 @@
|
||||
#flask
|
||||
Flask
|
||||
Flask-SQLAlchemy
|
||||
Flask-Login
|
||||
Flask-Cors
|
||||
#Flask-Markdown
|
||||
Flask-SocketIO
|
||||
python-engineio
|
||||
python-socketio<5.8.0
|
||||
Werkzeug<3.0
|
||||
Jinja2
|
||||
|
||||
# common util
|
||||
apscheduler
|
||||
pytz
|
||||
requests
|
||||
discord-webhook
|
||||
pyyaml
|
||||
telepot-mod
|
||||
Flask-Dropzone
|
||||
psutil
|
||||
|
||||
# filemanager
|
||||
pillow
|
||||
|
||||
gevent
|
||||
gevent-websocket
|
||||
pycryptodome
|
||||
json_fix
|
||||
@@ -1,2 +0,0 @@
|
||||
celery
|
||||
redis
|
||||
@@ -1,2 +0,0 @@
|
||||
lxml
|
||||
selenium
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# GDS-DViewer Flower Dashboard Startup Script
|
||||
# This script bypasses main.py to avoid gevent monkey-patch conflicts (infinite loading).
|
||||
|
||||
cd /Volumes/WD/Users/Work/python/flaskfarm
|
||||
|
||||
# Kill existing processes
|
||||
pkill -f flower
|
||||
|
||||
# Execute integrated startup command
|
||||
/Users/yommi/.pyenv/versions/FF_3.10/bin/python3 -c "import sys, os; sys.path.append(os.path.join(os.getcwd(), 'lib')); sys.argv=['celery', '--config_filepath=data/config_mac.yaml', '--running_type=local']; from framework import initiaize; celery=initiaize().celery; celery.start(['flower', '--address=0.0.0.0', '--port=5556'])"
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Python 3.14 + gevent fork 경고 억제
|
||||
export GEVENT_NOWAITPID=1
|
||||
export PYTHONWARNINGS="ignore::DeprecationWarning"
|
||||
|
||||
CONFIGFILE="/data/config.yaml"
|
||||
COUNT=0
|
||||
|
||||
# 🌐 Camoufox 브라우저 캐시 경로 설정 (마운트된 data 폴더 사용으로 이미지 용량 절감)
|
||||
export CAMOUFOX_CACHE_DIR="/data/.camoufox"
|
||||
|
||||
# 🔧 서버 시작 전에 플러그인 업데이트 및 브라우저 확인
|
||||
update_plugins() {
|
||||
# Camoufox 브라우저 체크 및 다운로드 (컨테이너 최초 실행 시 1회)
|
||||
if [ ! -d "$CAMOUFOX_CACHE_DIR" ]; then
|
||||
echo "Fetching Camoufox binaries to $CAMOUFOX_CACHE_DIR..."
|
||||
camoufox fetch
|
||||
fi
|
||||
|
||||
PLUGINS_DIR="/data/plugins"
|
||||
if [ -d "$PLUGINS_DIR" ]; then
|
||||
for dir in "$PLUGINS_DIR"/*/; do
|
||||
if [ -d "$dir/.git" ]; then
|
||||
echo "Updating plugin: $dir"
|
||||
git -C "$dir" reset --hard HEAD 2>/dev/null
|
||||
git -C "$dir" pull 2>/dev/null & # 병렬 실행
|
||||
fi
|
||||
done
|
||||
wait # 모든 git pull 완료 대기
|
||||
fi
|
||||
}
|
||||
# 첫 실행 시 또는 --update 옵션일 때만
|
||||
if [ "$COUNT" = "0" ]; then
|
||||
update_plugins
|
||||
fi
|
||||
|
||||
while true;
|
||||
do
|
||||
echo "------------------------------------------------"
|
||||
echo "Starting FlaskFarm Python Process (COUNT: ${COUNT})"
|
||||
echo "Config: ${CONFIGFILE}"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
python main.py --repeat ${COUNT} --config ${CONFIGFILE}
|
||||
RESULT=$?
|
||||
|
||||
echo "------------------------------------------------"
|
||||
echo "PYTHON EXIT CODE : ${RESULT}"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
if [ "$RESULT" = "1" ]; then
|
||||
echo 'Restarting... (RESULT=1)'
|
||||
update_plugins
|
||||
else
|
||||
echo "Exiting... (RESULT=${RESULT})"
|
||||
break
|
||||
fi
|
||||
COUNT=`expr $COUNT + 1`
|
||||
done
|
||||
-101
@@ -1,101 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# pyenv 초기화 (Warp/iTerm 등 비-인터랙티브 셸에서도 작동하도록)
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
if command -v pyenv &> /dev/null; then
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Python 3.14 + gevent fork 경고 억제
|
||||
export GEVENT_NOWAITPID=1
|
||||
export PYTHONWARNINGS="ignore::DeprecationWarning"
|
||||
|
||||
# Ctrl+C (SIGINT) 한 번에 종료되도록 설정
|
||||
cleanup() {
|
||||
echo ""
|
||||
echo "Stopping FlaskFarm..."
|
||||
# Python 프로세스 종료
|
||||
if [ -n "$PYTHON_PID" ]; then
|
||||
kill -TERM $PYTHON_PID 2>/dev/null
|
||||
sleep 0.5
|
||||
kill -9 $PYTHON_PID 2>/dev/null
|
||||
fi
|
||||
# 모든 자식 프로세스 종료
|
||||
pkill -P $$ 2>/dev/null
|
||||
exit 0
|
||||
}
|
||||
trap cleanup SIGINT SIGTERM
|
||||
|
||||
CONFIGFILE="data/config_mac.yaml"
|
||||
COUNT=0
|
||||
|
||||
# 🌐 Camoufox 브라우저 캐시 경로 설정 및 유지
|
||||
# macOS에서는 /Users/yommi/Library/Caches/camoufox가 기본값이나, 프로젝트 data 폴더로 강제 리다이렉션
|
||||
CAMOUFOX_DEFAULT_DIR="$HOME/Library/Caches/camoufox"
|
||||
CAMOUFOX_PERSISTENT_DIR="$(pwd)/data/.camoufox"
|
||||
|
||||
# 심볼릭 링크를 통해 data 폴더와 동기화
|
||||
if [ ! -L "$CAMOUFOX_DEFAULT_DIR" ]; then
|
||||
echo "Configuring Camoufox persistence link..."
|
||||
mkdir -p "$CAMOUFOX_PERSISTENT_DIR"
|
||||
if [ -d "$CAMOUFOX_DEFAULT_DIR" ] && [ ! -L "$CAMOUFOX_DEFAULT_DIR" ]; then
|
||||
cp -R "$CAMOUFOX_DEFAULT_DIR/" "$CAMOUFOX_PERSISTENT_DIR/" 2>/dev/null
|
||||
rm -rf "$CAMOUFOX_DEFAULT_DIR"
|
||||
fi
|
||||
mkdir -p "$(dirname "$CAMOUFOX_DEFAULT_DIR")"
|
||||
ln -s "$CAMOUFOX_PERSISTENT_DIR" "$CAMOUFOX_DEFAULT_DIR"
|
||||
fi
|
||||
|
||||
# 🔧 서버 시작 전에 플러그인 업데이트 및 브라우저 확인
|
||||
update_plugins() {
|
||||
# Camoufox 브라우저 체크 (실제 설치된 폴더 확인)
|
||||
if [ ! -d "$CAMOUFOX_DEFAULT_DIR/Camoufox.app" ]; then
|
||||
echo "Fetching Camoufox binaries to $CAMOUFOX_PERSISTENT_DIR..."
|
||||
camoufox fetch
|
||||
fi
|
||||
|
||||
PLUGINS_DIR="data/plugins"
|
||||
if [ -d "$PLUGINS_DIR" ]; then
|
||||
for dir in "$PLUGINS_DIR"/*/; do
|
||||
if [ -d "$dir/.git" ]; then
|
||||
echo "Updating plugin: $dir"
|
||||
git -C "$dir" reset --hard HEAD 2>/dev/null
|
||||
git -C "$dir" pull 2>/dev/null & # 병렬 실행
|
||||
fi
|
||||
done
|
||||
wait # 모든 git pull 완료 대기
|
||||
fi
|
||||
}
|
||||
|
||||
# 첫 실행 시 또는 --update 옵션일 때만
|
||||
if [ "$COUNT" = "0" ]; then
|
||||
update_plugins
|
||||
fi
|
||||
|
||||
while true;
|
||||
do
|
||||
echo "------------------------------------------------"
|
||||
echo "Starting FlaskFarm Python Process (COUNT: ${COUNT})"
|
||||
echo "Config: ${CONFIGFILE}"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
python main.py --repeat ${COUNT} --config ${CONFIGFILE} &
|
||||
PYTHON_PID=$!
|
||||
wait $PYTHON_PID
|
||||
RESULT=$?
|
||||
|
||||
echo "------------------------------------------------"
|
||||
echo "PYTHON EXIT CODE : ${RESULT}"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
if [ "$RESULT" = "1" ]; then
|
||||
echo 'Restarting... (RESULT=1)'
|
||||
update_plugins
|
||||
else
|
||||
echo "Exiting... (RESULT=${RESULT})"
|
||||
break
|
||||
fi
|
||||
COUNT=$(expr $COUNT + 1)
|
||||
done
|
||||
@@ -1,32 +0,0 @@
|
||||
# Gunicorn 최적화 설정 (Bottleproof v2)
|
||||
import multiprocessing
|
||||
import os
|
||||
|
||||
# 1. 네트워크 설정
|
||||
bind = "0.0.0.0:9099"
|
||||
backlog = 2048
|
||||
|
||||
# 2. 프로세스 관리
|
||||
# GeventWebSocketWorker: SocketIO(WebSocket) 지원을 위해 필수
|
||||
worker_class = "geventwebsocket.gunicorn.workers.GeventWebSocketWorker"
|
||||
workers = 1 # SocketIO 세션 일관성을 위해 1개 권장 (Redis message queue 미사용 시)
|
||||
worker_connections = 1000
|
||||
timeout = 600
|
||||
keepalive = 5
|
||||
|
||||
# 3. PID 관리 (정밀한 프로세스 제어를 위해 추가)
|
||||
pidfile = "data/gunicorn.pid"
|
||||
|
||||
# 4. 로깅 설정
|
||||
# data/log 폴더 자동 생성 보장
|
||||
log_dir = "data/log"
|
||||
if not os.path.exists(log_dir):
|
||||
os.makedirs(log_dir, exist_ok=True)
|
||||
|
||||
accesslog = os.path.join(log_dir, "gunicorn_access.log")
|
||||
errorlog = os.path.join(log_dir, "gunicorn_error.log")
|
||||
loglevel = "info"
|
||||
capture_output = True
|
||||
|
||||
# 5. 개발 편의성
|
||||
reload = False # 운영 환경에서는 False
|
||||
@@ -0,0 +1,7 @@
|
||||
title: "유튜브 다운로더"
|
||||
version: "0.1.0"
|
||||
package_name: "youtube-dl"
|
||||
developer: "flaskfarm"
|
||||
description: "유튜브 다운로드"
|
||||
home: "https://gitea.yommi.duckdns.org/ff_plugins/youtube-dl"
|
||||
more: "https://gitea.yommi.duckdns.org/ff_plugins/youtube-dl/raw/branch/main/README.md"
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -1,70 +0,0 @@
|
||||
try:
|
||||
import yaml
|
||||
except:
|
||||
import os
|
||||
try:
|
||||
os.system("pip install pyyaml")
|
||||
except:
|
||||
pass
|
||||
|
||||
from .init_main import Framework
|
||||
from .version import VERSION
|
||||
|
||||
# 2024.06.13
|
||||
# 잘못된 설계로 인해 import 만으로 초기화 되버려 lib을 사용할 수 없다.
|
||||
# 분리.
|
||||
|
||||
F = None
|
||||
frame = None
|
||||
logger = None
|
||||
app = None
|
||||
celery = None
|
||||
db = None
|
||||
scheduler = None
|
||||
socketio = None
|
||||
rd = None
|
||||
path_app_root = None
|
||||
path_data = None
|
||||
get_logger = None
|
||||
SystemModelSetting = None
|
||||
get_cache = None
|
||||
|
||||
def initiaize():
|
||||
global F
|
||||
global frame
|
||||
global logger
|
||||
global app
|
||||
global celery
|
||||
global db
|
||||
global scheduler
|
||||
global socketio
|
||||
global path_app_root
|
||||
global path_data
|
||||
global get_logger
|
||||
global SystemModelSetting
|
||||
global get_cache
|
||||
|
||||
F = Framework.get_instance()
|
||||
frame = F
|
||||
logger = frame.logger
|
||||
app = frame.app
|
||||
celery = frame.celery
|
||||
db = frame.db
|
||||
scheduler = frame.scheduler
|
||||
socketio = frame.socketio
|
||||
rd = frame.rd
|
||||
path_app_root = frame.path_app_root
|
||||
path_data = frame.path_data
|
||||
get_logger = frame.get_logger
|
||||
|
||||
frame.initialize_system()
|
||||
from system.setup import SystemModelSetting as SS
|
||||
SystemModelSetting = SS
|
||||
frame.initialize_plugin()
|
||||
return frame
|
||||
|
||||
from flask_login import login_required
|
||||
from support import d
|
||||
|
||||
from .init_declare import User, check_api
|
||||
from .scheduler import Job
|
||||
@@ -1,73 +0,0 @@
|
||||
import redis
|
||||
|
||||
class _RedisManager:
|
||||
_instance = None
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if not cls._instance:
|
||||
cls._instance = super().__new__(cls)
|
||||
return cls._instance
|
||||
|
||||
def __init__(self, host='localhost', port=6379):
|
||||
if hasattr(self, 'redis_client'):
|
||||
return
|
||||
|
||||
try:
|
||||
self.redis_client = redis.Redis(host=host, port=port, db=1, decode_responses=True)
|
||||
self.redis_client.ping()
|
||||
self.is_redis = True
|
||||
except redis.exceptions.ConnectionError:
|
||||
self.is_redis = False
|
||||
self.cache_backend = {} # Redis 실패 시 메모리 캐시 사용
|
||||
|
||||
def set(self, key, value, ex=None):
|
||||
if self.is_redis:
|
||||
self.redis_client.set(key, value, ex=ex)
|
||||
else:
|
||||
self.cache_backend[key] = value
|
||||
|
||||
def get(self, key):
|
||||
if self.is_redis:
|
||||
return self.redis_client.get(key)
|
||||
else:
|
||||
return self.cache_backend.get(key)
|
||||
|
||||
def delete(self, key):
|
||||
if self.is_redis:
|
||||
self.redis_client.delete(key)
|
||||
else:
|
||||
if key in self.cache_backend:
|
||||
del self.cache_backend[key]
|
||||
|
||||
|
||||
#_redis_manager_instance = _RedisManager()
|
||||
|
||||
class NamespacedCache:
|
||||
def __init__(self, namespace):
|
||||
self._manager = _RedisManager._instance
|
||||
self.namespace = namespace
|
||||
|
||||
def _make_key(self, key):
|
||||
# 'plugin_name:key' 형식으로 실제 키를 생성
|
||||
return f"{self.namespace}:{key}"
|
||||
|
||||
def set(self, key, value, ex=None):
|
||||
full_key = self._make_key(key)
|
||||
self._manager.set(full_key, value, ex=ex)
|
||||
|
||||
def get(self, key):
|
||||
full_key = self._make_key(key)
|
||||
return self._manager.get(full_key)
|
||||
|
||||
def delete(self, key):
|
||||
full_key = self._make_key(key)
|
||||
self._manager.delete(full_key)
|
||||
|
||||
|
||||
def get_cache(plugin_name: str) -> NamespacedCache:
|
||||
"""
|
||||
플러그인 이름을 기반으로 네임스페이스가 적용된 캐시 객체를 반환합니다.
|
||||
"""
|
||||
if not plugin_name:
|
||||
raise ValueError("플러그인 이름은 필수입니다.")
|
||||
return NamespacedCache(plugin_name)
|
||||
@@ -1,105 +0,0 @@
|
||||
import os
|
||||
from functools import wraps
|
||||
|
||||
from flask import abort, request
|
||||
|
||||
|
||||
def check_api(original_function):
|
||||
@wraps(original_function)
|
||||
def wrapper_function(*args, **kwargs): #1
|
||||
from framework import F
|
||||
|
||||
#logger.debug('CHECK API... {} '.format(original_function.__module__))
|
||||
#logger.warning(request.url)
|
||||
#logger.warning(request.form)
|
||||
try:
|
||||
if F.SystemModelSetting.get_bool('use_apikey'):
|
||||
try:
|
||||
d = request.get_json()
|
||||
except Exception:
|
||||
d = request.form.to_dict() if request.method == 'POST' else request.args.to_dict()
|
||||
apikey = d.get('apikey')
|
||||
if apikey is None or apikey != F.SystemModelSetting.get('apikey'):
|
||||
F.logger.warning('CHECK API : ABORT no match ({})'.format(apikey))
|
||||
F.logger.warning(request.environ.get('HTTP_X_REAL_IP', request.remote_addr))
|
||||
abort(403)
|
||||
return
|
||||
except Exception as e:
|
||||
F.logger.warning('CHECK API : ABORT exception')
|
||||
abort(403)
|
||||
return
|
||||
return original_function(*args, **kwargs) #2
|
||||
return wrapper_function
|
||||
|
||||
# Support를 logger 생성전에 쓰지 않기 위해 중복 선언
|
||||
import logging
|
||||
|
||||
|
||||
class CustomFormatter(logging.Formatter):
|
||||
"""Logging Formatter to add colors and count warning / errors"""
|
||||
|
||||
grey = "\x1b[38;21m"
|
||||
yellow = "\x1b[33;21m"
|
||||
red = "\x1b[31;21m"
|
||||
bold_red = "\x1b[31;1m"
|
||||
reset = "\x1b[0m"
|
||||
green = "\x1B[32m"
|
||||
# pathname filename
|
||||
#format = "[%(asctime)s|%(name)s|%(levelname)s - %(message)s (%(filename)s:%(lineno)d)"
|
||||
|
||||
__format = '[{yellow}%(asctime)s{reset}|{color}%(levelname)s{reset}|{green}%(name)s{reset}|%(pathname)s:%(lineno)s] {color}%(message)s{reset}' if os.environ.get('LOGGER_PATHNAME', "False") == "True" else '[{yellow}%(asctime)s{reset}|{color}%(levelname)s{reset}|{green}%(name)s{reset}|%(filename)s:%(lineno)s] {color}%(message)s{reset}'
|
||||
|
||||
FORMATS = {
|
||||
logging.DEBUG: __format.format(color=grey, reset=reset, yellow=yellow, green=green),
|
||||
logging.INFO: __format.format(color=green, reset=reset, yellow=yellow, green=green),
|
||||
logging.WARNING: __format.format(color=yellow, reset=reset, yellow=yellow, green=green),
|
||||
logging.ERROR: __format.format(color=red, reset=reset, yellow=yellow, green=green),
|
||||
logging.CRITICAL: __format.format(color=bold_red, reset=reset, yellow=yellow, green=green)
|
||||
}
|
||||
|
||||
def format(self, record):
|
||||
log_fmt = self.FORMATS.get(record.levelno)
|
||||
formatter = logging.Formatter(log_fmt)
|
||||
return formatter.format(record)
|
||||
|
||||
|
||||
|
||||
class User:
|
||||
def __init__(self, user_id, email=None, passwd_hash=None, authenticated=False):
|
||||
self.user_id = user_id
|
||||
self.email = email
|
||||
self.passwd_hash = passwd_hash
|
||||
self.authenticated = authenticated
|
||||
|
||||
def __repr__(self):
|
||||
r = {
|
||||
'user_id': self.user_id,
|
||||
'email': self.email,
|
||||
'passwd_hash': self.passwd_hash,
|
||||
'authenticated': self.authenticated,
|
||||
}
|
||||
return str(r)
|
||||
|
||||
def can_login(self, passwd_hash):
|
||||
#from support import SupportAES
|
||||
#tmp = SupportAES.decrypt(self.passwd_hash)
|
||||
import hashlib
|
||||
enc = hashlib.md5()
|
||||
enc.update(passwd_hash.encode())
|
||||
hash = enc.hexdigest()
|
||||
#return True
|
||||
return self.passwd_hash == hash
|
||||
|
||||
def is_active(self):
|
||||
return True
|
||||
|
||||
def get_id(self):
|
||||
return self.user_id
|
||||
|
||||
def is_authenticated(self):
|
||||
return self.authenticated
|
||||
|
||||
def is_anonymous(self):
|
||||
return False
|
||||
|
||||
|
||||
@@ -1,574 +0,0 @@
|
||||
import logging
|
||||
import logging.handlers
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
|
||||
import redis
|
||||
import yaml
|
||||
from flask import Flask
|
||||
from flask_cors import CORS
|
||||
from flask_login import LoginManager, login_required
|
||||
from flask_socketio import SocketIO
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from pytz import timezone, utc
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
|
||||
from .init_declare import CustomFormatter, check_api
|
||||
|
||||
|
||||
class Framework:
|
||||
__instance = None
|
||||
|
||||
@classmethod
|
||||
def get_instance(cls):
|
||||
if cls.__instance == None:
|
||||
cls.__instance = Framework()
|
||||
return cls.__instance
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self.logger = None
|
||||
self.app = None
|
||||
self.celery = None
|
||||
self.db = None
|
||||
self.scheduler = None
|
||||
self.socketio = None
|
||||
self.rd = None
|
||||
self.path_app_root = None
|
||||
self.path_data = None
|
||||
self.users = {}
|
||||
self.get_cache = None
|
||||
|
||||
self.__level_unset_logger_list = []
|
||||
self.__logger_list = []
|
||||
self.all_log_filehandler = None
|
||||
self.__exit_code = -1
|
||||
self.login_manager = None
|
||||
#self.plugin_instance_list = {}
|
||||
#self.plugin_menus = {}
|
||||
|
||||
# 그냥 F. 로 접근 하게....
|
||||
self.SystemModelSetting = None
|
||||
self.Job = None
|
||||
self.login_required = login_required
|
||||
self.check_api = check_api
|
||||
self.__initialize()
|
||||
|
||||
|
||||
def __initialize(self):
|
||||
os.environ["PYTHONUNBUFFERED"] = "1"
|
||||
os.environ['FF'] = "true"
|
||||
os.environ['FF_PYTHON'] = sys.executable
|
||||
self.__config_initialize("first")
|
||||
self.__make_default_dir()
|
||||
|
||||
self.logger = self.get_logger(__package__)
|
||||
self.get_logger('support')
|
||||
import support
|
||||
|
||||
self.__prepare_starting()
|
||||
self.app = Flask(__name__)
|
||||
self.app.wsgi_app = ProxyFix(self.app.wsgi_app, x_proto=1)
|
||||
self.__config_initialize('flask')
|
||||
|
||||
self.__init_db()
|
||||
|
||||
if True or self.config['run_flask']:
|
||||
from .scheduler import Job, Scheduler
|
||||
self.scheduler = Scheduler(self)
|
||||
self.Job = Job
|
||||
|
||||
if self.config['use_gevent']:
|
||||
self.socketio = SocketIO(self.app, cors_allowed_origins="*")
|
||||
else:
|
||||
self.socketio = SocketIO(self.app, cors_allowed_origins="*", async_mode='threading')
|
||||
|
||||
CORS(self.app)
|
||||
|
||||
self.login_manager = LoginManager()
|
||||
self.login_manager.init_app(self.app)
|
||||
self.login_manager.login_view = "/system/login"
|
||||
|
||||
self.celery = self.__init_celery()
|
||||
|
||||
from flask_dropzone import Dropzone
|
||||
self.app.config.update(
|
||||
DROPZONE_MAX_FILE_SIZE = 102400,
|
||||
DROPZONE_TIMEOUT = 5*60*1000,
|
||||
DROPZONE_ALLOWED_FILE_CUSTOM = True,
|
||||
DROPZONE_ALLOWED_FILE_TYPE = "image/*, audio/*, video/*, text/*, application/*, *.*",
|
||||
)
|
||||
self.dropzone = Dropzone(self.app)
|
||||
|
||||
|
||||
|
||||
def __init_db(self):
|
||||
# https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/config/#flask_sqlalchemy.config.SQLALCHEMY_BINDS
|
||||
# 어떤 편법도 불가. db를 사용하지 않아도 파일이 생김.
|
||||
db_path = os.path.join(self.config['path_data'], 'db', 'system.db')
|
||||
self.app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{db_path}?check_same_thread=False' # 3.0에서 필수
|
||||
self.app.config['SQLALCHEMY_BINDS'] = {'system':f'sqlite:///{db_path}?check_same_thread=False'}
|
||||
self.app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
_ = os.path.join(self.config['path_data'], 'plugins')
|
||||
plugins = []
|
||||
if os.path.exists(_):
|
||||
plugins = os.listdir(_)
|
||||
|
||||
if self.config['path_dev'] != None:
|
||||
if type(self.config['path_dev']) == type(''):
|
||||
plugin_path_list = [self.config['path_dev']]
|
||||
elif type(self.config['path_dev']) == type([]):
|
||||
plugin_path_list = self.config['path_dev']
|
||||
for __ in plugin_path_list:
|
||||
if os.path.exists(__):
|
||||
plugins += os.listdir(__)
|
||||
|
||||
for package_name in plugins:
|
||||
db_path = os.path.join(self.config['path_data'], 'db', f'{package_name}.db')
|
||||
self.app.config['SQLALCHEMY_BINDS'][package_name] = f'sqlite:///{db_path}?check_same_thread=False'
|
||||
self.db = SQLAlchemy(self.app, session_options={"autoflush": False, "expire_on_commit": False})
|
||||
#with self.app.app_context():
|
||||
# self.db.session.expunge_all()
|
||||
|
||||
|
||||
def __init_celery(self):
|
||||
redis_port = 6379
|
||||
try:
|
||||
if self.config['use_celery'] == False:
|
||||
raise Exception('use_celery=False')
|
||||
from celery import Celery
|
||||
redis_port = os.environ.get('REDIS_PORT', None)
|
||||
if redis_port == None:
|
||||
redis_port = self.config.get('redis_port', None)
|
||||
if redis_port == None:
|
||||
redis_port = '6379'
|
||||
self.config['redis_port'] = redis_port
|
||||
self.rd = redis.StrictRedis(host='localhost', port=redis_port, db=0)
|
||||
if self.config['use_celery'] == False:
|
||||
raise Exception('no celery')
|
||||
|
||||
self.app.config['CELERY_BROKER_URL'] = 'redis://localhost:%s/0' % redis_port
|
||||
self.app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost:%s/0' % redis_port
|
||||
celery = Celery(self.app.name, broker=self.app.config['CELERY_BROKER_URL'], backend=self.app.config['CELERY_RESULT_BACKEND'])
|
||||
celery.conf['CELERY_ENABLE_UTC'] = False
|
||||
celery.conf.update(
|
||||
task_serializer='pickle',
|
||||
result_serializer='pickle',
|
||||
accept_content=['pickle'],
|
||||
timezone='Asia/Seoul'
|
||||
)
|
||||
from celery import bootsteps
|
||||
from click import Option
|
||||
celery.user_options['worker'].add(Option(('--config_filepath',), help=''),)
|
||||
celery.user_options['worker'].add(Option(('--running_type',), help=''),)
|
||||
class CustomArgs(bootsteps.Step):
|
||||
def __init__(self, worker, config_filepath=None, running_type=None, **options):
|
||||
from . import F
|
||||
F.logger.info(f"celery config_filepath: {config_filepath}")
|
||||
F.logger.info(f"celery running_type: {running_type}")
|
||||
#F.logger.info(f"celery running_type: {options}")
|
||||
celery.steps['worker'].add(CustomArgs)
|
||||
|
||||
except Exception as e:
|
||||
if self.config['use_celery']:
|
||||
self.logger.error('CELERY!!!')
|
||||
self.logger.error(f'Exception:{str(e)}')
|
||||
self.logger.error(traceback.format_exc())
|
||||
else:
|
||||
self.logger.info("use_celery = False")
|
||||
|
||||
def dummy_func():
|
||||
pass
|
||||
|
||||
class celery(object):
|
||||
class task(object):
|
||||
def __init__(self, *args, **kwargs):
|
||||
if len(args) > 0:
|
||||
self.f = args[0]
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
if len(args) > 0 and type(args[0]) == type(dummy_func):
|
||||
return args[0]
|
||||
self.f(*args, **kwargs)
|
||||
try:
|
||||
from .init_cache_manager import _RedisManager, get_cache
|
||||
_RedisManager(host='localhost', port=redis_port)
|
||||
self.get_cache = get_cache
|
||||
except Exception as e:
|
||||
self.logger.error(f"get_cache import error: {str(e)}")
|
||||
self.get_cache = None
|
||||
|
||||
return celery
|
||||
|
||||
|
||||
def initialize_system(self):
|
||||
from system.setup import P
|
||||
SystemInstance = P
|
||||
try:
|
||||
with self.app.app_context():
|
||||
self.db.create_all()
|
||||
except Exception as e:
|
||||
self.logger.error('CRITICAL db.create_all()!!!')
|
||||
self.logger.error(f'Exception:{str(e)}')
|
||||
self.logger.error(traceback.format_exc())
|
||||
self.SystemModelSetting = SystemInstance.ModelSetting
|
||||
if self.config['run_flask']:
|
||||
SystemInstance.plugin_load()
|
||||
self.app.register_blueprint(SystemInstance.blueprint)
|
||||
self.config['flag_system_loading'] = True
|
||||
self.__config_initialize('member')
|
||||
self.__config_initialize('system_loading_after')
|
||||
self.set_level(self.SystemModelSetting.get_int('log_level'))
|
||||
|
||||
|
||||
def initialize_plugin(self):
|
||||
from system.setup import P as SP
|
||||
|
||||
from .init_web import jinja_initialize
|
||||
jinja_initialize(self.app)
|
||||
|
||||
from .init_plugin import PluginManager
|
||||
self.PluginManager = PluginManager
|
||||
PluginManager.plugin_update()
|
||||
PluginManager.plugin_init()
|
||||
PluginManager.plugin_menus['system'] = {'menu':SP.menu, 'match':False}
|
||||
|
||||
from .init_menu import MenuManager
|
||||
MenuManager.init_menu()
|
||||
self.logger.info("메뉴 구성 완료")
|
||||
|
||||
if self.config['run_flask']:
|
||||
if self.config.get('port') == None:
|
||||
self.config['port'] = self.SystemModelSetting.get_int('port')
|
||||
|
||||
from . import init_route, log_viewer
|
||||
|
||||
self.__make_default_logger()
|
||||
self.__config_initialize("last")
|
||||
self.config['loading_completed'] = True
|
||||
self.logger.info('### LAST')
|
||||
self.logger.info(f"### PORT: {self.config.get('port')}")
|
||||
self.logger.info('### Now you can access App by webbrowser!!')
|
||||
|
||||
|
||||
def __prepare_starting(self):
|
||||
# 여기서 monkey.patch시 너무 늦다고 문제 발생
|
||||
pass
|
||||
|
||||
|
||||
###################################################
|
||||
# 환경
|
||||
###################################################
|
||||
def __config_initialize(self, mode):
|
||||
if mode == "first":
|
||||
self.config = {}
|
||||
self.config['loading_completed'] = False
|
||||
self.config['os'] = platform.system()
|
||||
self.config['flag_system_loading'] = False
|
||||
#self.config['run_flask'] = True if sys.argv[0].endswith('main.py') else False
|
||||
self.config['run_celery'] = True if sys.argv[0].find('celery') != -1 else False
|
||||
self.config['run_flask'] = not self.config['run_celery']
|
||||
self.config['path_app'] = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
if self.config['os'] == 'Windows' and self.config['path_app'][0] != '/':
|
||||
self.config['path_app'] = self.config['path_app'][0].upper() + self.config['path_app'][1:]
|
||||
self.path_app_root = self.config['path_app']
|
||||
self.config['path_working'] = os.getcwd()
|
||||
if os.environ.get('RUNNING_TYPE', None) != None:
|
||||
self.config['running_type'] = os.environ.get('RUNNING_TYPE')
|
||||
self.config['export_filepath'] = os.path.join(self.config['path_app'], 'export.sh')
|
||||
self.config['exist_export'] = os.path.exists(self.config['export_filepath'])
|
||||
self.config['recent_version'] = '--'
|
||||
from .version import VERSION
|
||||
self.config['version'] = VERSION
|
||||
self.__process_args()
|
||||
self.__load_config()
|
||||
self.__init_define()
|
||||
self.config['menu_yaml_filepath'] = os.path.join(self.config['path_data'], 'db', 'menu.yaml')
|
||||
self.config['notify_yaml_filepath'] = os.path.join(self.config['path_data'], 'db', 'notify.yaml')
|
||||
if 'running_type' not in self.config:
|
||||
self.config['running_type'] = 'native'
|
||||
self.pip_install()
|
||||
elif mode == "flask":
|
||||
self.app.secret_key = os.urandom(24)
|
||||
self.app.config['TEMPLATES_AUTO_RELOAD'] = True
|
||||
self.app.config['JSON_AS_ASCII'] = False
|
||||
elif mode == 'system_loading_after':
|
||||
pass
|
||||
elif mode == 'last':
|
||||
db_foder = os.path.join(self.config['path_data'], 'db')
|
||||
for name in os.listdir(db_foder):
|
||||
if name.endswith('.db'):
|
||||
db_filepath = os.path.join(db_foder, name)
|
||||
try:
|
||||
if os.stat(db_filepath).st_size == 0:
|
||||
os.remove(db_filepath)
|
||||
self.logger.debug(f"REMOVE {db_filepath}")
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def __init_define(self):
|
||||
self.config['DEFINE'] = {}
|
||||
# 이건 필요 없음
|
||||
self.config['DEFINE']['GIT_VERSION_URL'] = 'https://raw.githubusercontent.com/flaskfarm/flaskfarm/main/lib/framework/version.py'
|
||||
self.config['DEFINE']['CHANGELOG'] = 'https://github.com/flaskfarm/flaskfarm'
|
||||
|
||||
def __process_args(self):
|
||||
# celery 에서 args 처리시 문제 발생.
|
||||
if self.config['run_flask']:
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--config', default='.', help='config filepath. Default: {current folder}/config.yaml')
|
||||
parser.add_argument('--repeat', default=0, type=int, help=u'Do not set. This value is set by automatic')
|
||||
args = parser.parse_args()
|
||||
self.config['arg_repeat'] = args.repeat
|
||||
self.config['arg_config'] = args.config
|
||||
else:
|
||||
# 아주 안좋은 구조..
|
||||
# celery user_options으로 configfilepath를 받은 후 처리해야하나, 로그파일 경로 등에서 데이터 폴더 위치를 미리 사용하는 경우가 많다.
|
||||
# sys.argv에서 데이터 경로를 바로 가져와서 사용.
|
||||
self.config['arg_repeat'] = 0
|
||||
#self.config['arg_config'] = sys.argv[-1].split('=')[-1]
|
||||
#self.config['arg_config'] = sys.argv[-1].split('=')[-1]
|
||||
for tmp in sys.argv:
|
||||
if tmp.startswith('--config_filepath'):
|
||||
self.config['arg_config'] = tmp.split('=')[1]
|
||||
#break
|
||||
elif tmp.startswith('--running_type'):
|
||||
self.config['running_type'] = tmp.split('=')[1]
|
||||
|
||||
#self.config['arg_config'] =
|
||||
|
||||
def __load_config(self):
|
||||
#if self.config['run_flask']:
|
||||
if self.config['arg_config'] == '.':
|
||||
#self.config['config_filepath'] = os.path.join(self.path_app_root, 'config.yaml')
|
||||
self.config['config_filepath'] = os.path.join(self.config['path_working'], 'config.yaml')
|
||||
else:
|
||||
self.config['config_filepath'] = self.config['arg_config']
|
||||
if os.path.exists(self.config['config_filepath']) == False:
|
||||
if self.config.get('running_type', '').startswith('docker'):
|
||||
with open(self.config['config_filepath'], 'w', encoding='utf8') as f:
|
||||
yaml.dump({'path_data':'/data'}, f, default_flow_style=False, allow_unicode=True)
|
||||
else:
|
||||
shutil.copy(
|
||||
os.path.join(self.path_app_root, 'files', 'config.yaml.template'),
|
||||
self.config['config_filepath']
|
||||
)
|
||||
with open(self.config['config_filepath'], encoding='utf8') as file:
|
||||
data = yaml.load(file, Loader=yaml.FullLoader)
|
||||
for key, value in data.items():
|
||||
if key == 'running_type' and value not in ['termux', 'entware']:
|
||||
continue
|
||||
self.config[key] = value
|
||||
|
||||
if self.config['path_data'] == '.':
|
||||
self.config['path_data'] = self.config['path_working']
|
||||
# 예외적으로 현재폴더가 app일 경우 지저분해지는 것을 방지하기 위해 data 로 지정
|
||||
if self.config['path_data'] == self.config['path_working']:
|
||||
self.config['path_data'] = os.path.join(self.config['path_working'], 'data')
|
||||
self.path_data = self.config['path_data']
|
||||
|
||||
if self.config.get('use_gevent') == None:
|
||||
self.config['use_gevent'] = True
|
||||
if self.config.get('use_celery') == None:
|
||||
self.config['use_celery'] = True
|
||||
if self.config.get('debug') == None:
|
||||
self.config['debug'] = False
|
||||
if self.config.get('plugin_update') == None:
|
||||
self.config['plugin_update'] = True
|
||||
# 2022-11-20
|
||||
if self.config['debug']:
|
||||
self.config['plugin_update'] = False
|
||||
if self.config.get('plugin_loading_only_devpath') == None:
|
||||
self.config['plugin_loading_only_devpath'] = False
|
||||
if self.config.get('plugin_loading_list') == None:
|
||||
self.config['plugin_loading_list'] = []
|
||||
if self.config.get('plugin_except_list') == None:
|
||||
self.config['plugin_except_list'] = []
|
||||
if self.config.get('path_dev') == None:
|
||||
self.config['path_dev'] = None
|
||||
|
||||
|
||||
def __make_default_dir(self):
|
||||
os.makedirs(self.config['path_data'], exist_ok=True)
|
||||
tmp = os.path.join(self.config['path_data'], 'tmp')
|
||||
try:
|
||||
import shutil
|
||||
if os.path.exists(tmp):
|
||||
shutil.rmtree(tmp)
|
||||
except:
|
||||
pass
|
||||
sub = ['db', 'log', 'tmp']
|
||||
for item in sub:
|
||||
tmp = os.path.join(self.config['path_data'], item)
|
||||
os.makedirs(tmp, exist_ok=True)
|
||||
|
||||
###################################################
|
||||
|
||||
|
||||
|
||||
|
||||
###################################################
|
||||
# 로그
|
||||
###################################################
|
||||
def get_logger(self, name, from_command=False):
|
||||
logger = logging.getLogger(name)
|
||||
if not logger.handlers:
|
||||
level = logging.DEBUG
|
||||
try:
|
||||
if self.config['flag_system_loading']:
|
||||
try:
|
||||
#from system import SystemModelSetting
|
||||
level = self.SystemModelSetting.get_int('log_level')
|
||||
except:
|
||||
level = logging.DEBUG
|
||||
if self.__level_unset_logger_list is not None:
|
||||
for item in self.__level_unset_logger_list:
|
||||
item.setLevel(level)
|
||||
self.__level_unset_logger_list = None
|
||||
else:
|
||||
self.__level_unset_logger_list.append(logger)
|
||||
if name.startswith('apscheduler'):
|
||||
level = logging.CRITICAL
|
||||
else:
|
||||
self.__logger_list.append(logger)
|
||||
except:
|
||||
pass
|
||||
logger.setLevel(level)
|
||||
def customTime(*args):
|
||||
utc_dt = utc.localize(datetime.utcnow())
|
||||
my_tz = timezone("Asia/Seoul")
|
||||
converted = utc_dt.astimezone(my_tz)
|
||||
return converted.timetuple()
|
||||
|
||||
if from_command == False:
|
||||
file_formatter = logging.Formatter(u'[%(asctime)s|%(levelname)s|%(name)s|%(filename)s:%(lineno)s] %(message)s')
|
||||
else:
|
||||
file_formatter = logging.Formatter(u'[%(asctime)s] %(message)s')
|
||||
|
||||
file_formatter.converter = customTime
|
||||
file_max_bytes = 1 * 1024 * 1024
|
||||
fileHandler = logging.handlers.RotatingFileHandler(filename=os.path.join(self.path_data, 'log', f'{name}.log'), maxBytes=file_max_bytes, backupCount=5, encoding='utf8', delay=True)
|
||||
fileHandler.setFormatter(file_formatter)
|
||||
logger.addHandler(fileHandler)
|
||||
if name == 'framework' and self.all_log_filehandler == None:
|
||||
self.all_log_filehandler = logging.handlers.RotatingFileHandler(filename=os.path.join(self.path_data, 'log', f'all.log'), maxBytes=5*1024*1024, backupCount=5, encoding='utf8', delay=True)
|
||||
self.all_log_filehandler.setFormatter(file_formatter)
|
||||
|
||||
if from_command == False:
|
||||
streamHandler = logging.StreamHandler()
|
||||
streamHandler.setFormatter(CustomFormatter())
|
||||
logger.addHandler(streamHandler)
|
||||
|
||||
if self.all_log_filehandler != None:
|
||||
logger.addHandler(self.all_log_filehandler)
|
||||
|
||||
return logger
|
||||
|
||||
|
||||
def __make_default_logger(self):
|
||||
self.get_logger('apscheduler.scheduler')
|
||||
self.get_logger('apscheduler.executors.default')
|
||||
try: logging.getLogger('socketio').setLevel(logging.ERROR)
|
||||
except: pass
|
||||
try: logging.getLogger('engineio').setLevel(logging.ERROR)
|
||||
except: pass
|
||||
try: logging.getLogger('apscheduler.scheduler').setLevel(logging.ERROR)
|
||||
except: pass
|
||||
try: logging.getLogger('apscheduler.executors.default').setLevel(logging.ERROR)
|
||||
except: pass
|
||||
try: logging.getLogger('werkzeug').setLevel(logging.ERROR)
|
||||
except: pass
|
||||
|
||||
def set_level(self, level):
|
||||
try:
|
||||
for l in self.__logger_list:
|
||||
l.setLevel(int(level))
|
||||
self.__make_default_logger()
|
||||
except:
|
||||
pass
|
||||
###################################################
|
||||
|
||||
|
||||
def start(self):
|
||||
host = '0.0.0.0'
|
||||
for i in range(5):
|
||||
try:
|
||||
#self.logger.debug(d(self.config))
|
||||
# allow_unsafe_werkzeug=True termux nohup 실행시 필요함
|
||||
#if self.config['running_type'] == 'termux':
|
||||
# self.socketio.run(self.app, host=host, port=self.config['port'], debug=self.config['debug'], use_reloader=self.config['debug'], allow_unsafe_werkzeug=True)
|
||||
#else:
|
||||
self.socketio.run(self.app, host=host, port=self.config['port'], debug=self.config['debug'], use_reloader=self.config['debug'])
|
||||
self.logger.warning(f"EXIT CODE : {self.__exit_code}")
|
||||
# 2021-05-18
|
||||
if self.config['running_type'] in ['termux', 'entware']:
|
||||
os._exit(self.__exit_code)
|
||||
else:
|
||||
if self.__exit_code != -1:
|
||||
sys.exit(self.__exit_code)
|
||||
else:
|
||||
self.logger.warning(f"framework.exit_code is -1")
|
||||
break
|
||||
except Exception as exception:
|
||||
self.logger.error(f"Start ERROR : {str(exception)}")
|
||||
host = '127.0.0.1'
|
||||
time.sleep(10*i)
|
||||
continue
|
||||
except KeyboardInterrupt:
|
||||
self.logger.error('KeyboardInterrupt !!')
|
||||
|
||||
|
||||
#except SystemExit:
|
||||
# return
|
||||
#sys.exit(self.__exit_code)
|
||||
|
||||
|
||||
# system 플러그인에서 콜
|
||||
def restart(self):
|
||||
self.__exit_code = 1
|
||||
self.__app_close()
|
||||
|
||||
def shutdown(self):
|
||||
self.__exit_code = 0
|
||||
self.__app_close()
|
||||
|
||||
def __app_close(self):
|
||||
try:
|
||||
from support import SupportSubprocess
|
||||
SupportSubprocess.all_process_close()
|
||||
from .init_plugin import PluginManager
|
||||
PluginManager.plugin_unload()
|
||||
with self.app.test_request_context():
|
||||
self.socketio.stop()
|
||||
except Exception as e:
|
||||
self.logger.error(f"Exception:{str(e)}")
|
||||
self.logger.error(traceback.format_exc())
|
||||
|
||||
def get_recent_version(self):
|
||||
try:
|
||||
import requests
|
||||
text = requests.get(self.config['DEFINE']['GIT_VERSION_URL']).text
|
||||
self.config['recent_version'] = text.split('=')[1].strip().strip('"')
|
||||
return True
|
||||
except Exception as e:
|
||||
self.logger.error(f'Exception:{str(e)}')
|
||||
self.logger.error(traceback.format_exc())
|
||||
self.config['recent_version'] = '확인 실패'
|
||||
return False
|
||||
|
||||
|
||||
# dev 도커용. package는 setup에 포함.
|
||||
def pip_install(self):
|
||||
try:
|
||||
import json_fix
|
||||
except:
|
||||
os.system('pip install json_fix')
|
||||
@@ -1,144 +0,0 @@
|
||||
import os
|
||||
import shutil
|
||||
import traceback
|
||||
|
||||
from framework import F, logger
|
||||
from support import SupportYaml, d
|
||||
|
||||
|
||||
class MenuManager:
|
||||
menu_map = None
|
||||
|
||||
@classmethod
|
||||
def __load_menu_yaml(cls):
|
||||
try:
|
||||
menu_yaml_filepath = os.path.join(F.config['path_data'], 'db', 'menu.yaml')
|
||||
if os.path.exists(menu_yaml_filepath) == False:
|
||||
shutil.copy(
|
||||
os.path.join(F.config['path_app'], 'files', 'menu.yaml.template'),
|
||||
menu_yaml_filepath
|
||||
)
|
||||
cls.menu_map = SupportYaml.read_yaml(menu_yaml_filepath)
|
||||
except Exception as e:
|
||||
logger.error(f"Exception:{str(e)}")
|
||||
logger.error(traceback.format_exc())
|
||||
cls.menu_map = SupportYaml.read_yaml(os.path.join(F.config['path_app'], 'files', 'menu.yaml.template'))
|
||||
|
||||
|
||||
@classmethod
|
||||
def init_menu(cls):
|
||||
cls.__load_menu_yaml()
|
||||
if cls.__init_menu() == False:
|
||||
cls.menu_map = SupportYaml.read_yaml(os.path.join(F.config['path_app'], 'files', 'menu.yaml.template'))
|
||||
cls.__init_menu()
|
||||
|
||||
@classmethod
|
||||
def __init_menu(cls):
|
||||
try:
|
||||
from .init_plugin import PluginManager
|
||||
plugin_menus = PluginManager.plugin_menus
|
||||
copy_map = []
|
||||
for category in cls.menu_map:
|
||||
if 'uri' in category:
|
||||
if category['uri'] in plugin_menus:
|
||||
plugin_menus[category['uri']]['match'] = True
|
||||
copy_map.append(plugin_menus[category['uri']]['menu'])
|
||||
else:
|
||||
copy_map.append(category)
|
||||
continue
|
||||
cate_count = 0
|
||||
|
||||
tmp_cate_list = []
|
||||
for item in category['list']:
|
||||
if item['uri'] in plugin_menus:
|
||||
plugin_menus[item['uri']]['match'] = True
|
||||
tmp_cate_list.append(plugin_menus[item['uri']]['menu'])
|
||||
cate_count += 1
|
||||
elif item['uri'].startswith('http'):
|
||||
tmp_cate_list.append({
|
||||
'uri': item['uri'],
|
||||
'name': item['name'],
|
||||
'target': item.get('target', '_blank')
|
||||
})
|
||||
cate_count += 1
|
||||
elif (len(item['uri'].split('/')) > 1 and item['uri'].split('/')[0] in plugin_menus) or item['uri'].startswith('javascript') or item['uri'] in ['-']:
|
||||
tmp_cate_list.append({
|
||||
'uri': item['uri'],
|
||||
'name': item.get('name', ''),
|
||||
})
|
||||
cate_count += 1
|
||||
elif item['uri'] == 'setting':
|
||||
# 2024.06.04
|
||||
# 확장설정도 메뉴 구성
|
||||
if len(PluginManager.setting_menus) > 0:
|
||||
set_tmp = item.get('list')
|
||||
if set_tmp:
|
||||
cp = PluginManager.setting_menus.copy()
|
||||
include = []
|
||||
for set_ch in set_tmp:
|
||||
if set_ch.get('uri') and (set_ch.get('uri') == '-' or set_ch.get('uri').startswith('http')):
|
||||
include.append(set_ch)
|
||||
continue
|
||||
|
||||
for i, ps in enumerate(cp):
|
||||
if set_ch.get('plugin') != None and set_ch.get('plugin') == ps.get('plugin'):
|
||||
include.append(ps)
|
||||
del cp[i]
|
||||
break
|
||||
tmp_cate_list.append({
|
||||
'uri': item['uri'],
|
||||
'name': item.get('name', ''),
|
||||
'list': include + cp
|
||||
})
|
||||
|
||||
else:
|
||||
tmp_cate_list.append({
|
||||
'uri': item['uri'],
|
||||
'name': item.get('name', ''),
|
||||
'list': PluginManager.setting_menus
|
||||
})
|
||||
|
||||
if cate_count > 0:
|
||||
copy_map.append({
|
||||
'name': category['name'],
|
||||
'list': tmp_cate_list,
|
||||
'count': cate_count
|
||||
})
|
||||
cls.menu_map = copy_map
|
||||
|
||||
make_dummy_cate = False
|
||||
for name, plugin_menu in plugin_menus.items():
|
||||
#F.logger.info(d(plugin_menu))
|
||||
#if 'uri' not in plugin_menu['menu']:
|
||||
# continue
|
||||
if plugin_menu['match'] == False:
|
||||
if make_dummy_cate == False:
|
||||
make_dummy_cate = True
|
||||
cls.menu_map.insert(len(cls.menu_map)-1, {
|
||||
'name':'미분류', 'count':0, 'list':[]
|
||||
})
|
||||
|
||||
c = cls.menu_map[-2]
|
||||
c['count'] += 1
|
||||
c['list'].append(plugin_menu['menu'])
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"Exception:{str(e)}")
|
||||
logger.error(traceback.format_exc())
|
||||
return False
|
||||
|
||||
#F.logger.warning(d(cls.menu_map))
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_menu_map(cls):
|
||||
return cls.menu_map
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_setting_menu(cls, plugin):
|
||||
from .init_plugin import PluginManager
|
||||
for tmp in PluginManager.setting_menus:
|
||||
if tmp['plugin'] == plugin:
|
||||
return tmp
|
||||
|
||||
@@ -1,381 +0,0 @@
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import zipfile
|
||||
|
||||
import requests
|
||||
from framework import F
|
||||
from support import SupportFile, SupportSubprocess, SupportYaml
|
||||
|
||||
|
||||
class PluginManager:
|
||||
plugin_list = {}
|
||||
plugin_menus = {}
|
||||
setting_menus = []
|
||||
all_package_list = {}
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_plugin_name_list(cls):
|
||||
plugins = []
|
||||
#2019-07-17
|
||||
try:
|
||||
plugin_path = os.path.join(F.config['path_data'], 'plugins')
|
||||
if os.path.exists(plugin_path) == True and os.path.isdir(plugin_path) == True:
|
||||
sys.path.insert(1, plugin_path)
|
||||
tmps = os.listdir(plugin_path)
|
||||
add_plugin_list = []
|
||||
for t in tmps:
|
||||
if t.startswith('_') == False and t.startswith('.') == False and os.path.isdir(os.path.join(plugin_path, t)) and t != 'false' and t != 'tmp':
|
||||
add_plugin_list.append(t)
|
||||
cls.all_package_list[t] = {'pos':'normal', 'path':os.path.join(plugin_path, t), 'loading':(F.config.get('plugin_loading_only_devpath', None) != True)}
|
||||
|
||||
plugins = plugins + add_plugin_list
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
if F.config.get('plugin_loading_only_devpath', None) == True:
|
||||
plugins = []
|
||||
|
||||
# 2018-09-04
|
||||
try:
|
||||
#plugin_path = F.SystemModelSetting.get('plugin_dev_path')
|
||||
plugin_path = F.config['path_dev']
|
||||
plugin_path_list = []
|
||||
if type(plugin_path) == type(''):
|
||||
plugin_path_list = [plugin_path]
|
||||
elif type(plugin_path) == type([]):
|
||||
plugin_path_list = plugin_path
|
||||
|
||||
for __ in plugin_path_list:
|
||||
if __ != None and __ != '':
|
||||
if os.path.exists(__):
|
||||
sys.path.insert(0, __)
|
||||
tmps = os.listdir(__)
|
||||
add_plugin_list = []
|
||||
for t in tmps:
|
||||
if t.startswith('_') == False and t.startswith('.') == False and os.path.isdir(os.path.join(__, t)) and t != 'false' and t != 'tmp':
|
||||
add_plugin_list.append(t)
|
||||
cls.all_package_list[t] = {'pos':'dev', 'path':os.path.join(__, t), 'loading':True}
|
||||
plugins = plugins + add_plugin_list
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
# plugin_loading_list
|
||||
try:
|
||||
plugin_loading_list = F.config.get('plugin_loading_list', None)
|
||||
if plugin_loading_list != None and (type(plugin_loading_list) == type([]) and len(plugin_loading_list)) > 0:
|
||||
new_plugins = []
|
||||
for _ in plugins:
|
||||
if _ in plugin_loading_list:
|
||||
new_plugins.append(_)
|
||||
else:
|
||||
cls.all_package_list[_]['loading'] = False
|
||||
cls.all_package_list[_]['status'] = 'not_include_loading_list'
|
||||
plugins = new_plugins
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
# plugin_except_list
|
||||
try:
|
||||
plugin_except_list = F.config.get('plugin_except_list', None)
|
||||
if plugin_except_list != None and (type(plugin_except_list) == type([]) and len(plugin_except_list)) > 0:
|
||||
new_plugins = []
|
||||
for _ in plugins:
|
||||
if _ not in plugin_except_list:
|
||||
new_plugins.append(_)
|
||||
else:
|
||||
cls.all_package_list[_]['loading'] = False
|
||||
cls.all_package_list[_]['status'] = 'include_except_list'
|
||||
plugins = new_plugins
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
return plugins
|
||||
|
||||
|
||||
|
||||
# menu, blueprint, plugin_info, plugin_load, plugin_unload
|
||||
@classmethod
|
||||
def plugin_init(cls):
|
||||
try:
|
||||
plugins = cls.get_plugin_name_list()
|
||||
plugins = sorted(plugins)
|
||||
|
||||
F.logger.debug(plugins)
|
||||
for plugin_name in plugins:
|
||||
F.logger.info(f'[+] PLUGIN IMPORT Start.. [{plugin_name}]')
|
||||
import_start_time = time.time()
|
||||
entity = cls.all_package_list[plugin_name]
|
||||
try:
|
||||
try:
|
||||
mod = __import__(f'{plugin_name}.setup', fromlist=['setup'])
|
||||
except Exception as e:
|
||||
F.logger.error(f'Exception:{str(e)}')
|
||||
F.logger.error(traceback.format_exc())
|
||||
F.logger.warning(f'[!] NOT normal plugin : [{plugin_name}]')
|
||||
continue
|
||||
|
||||
try:
|
||||
entity['setup_mod'] = mod
|
||||
entity['P'] = getattr(mod, 'P')
|
||||
mod_blue_print = getattr(entity['P'], 'blueprint')
|
||||
if mod_blue_print:
|
||||
F.app.register_blueprint(mod_blue_print)
|
||||
except Exception as exception:
|
||||
F.logger.warning(f'[!] BLUEPRINT not exist : [{plugin_name}]')
|
||||
|
||||
import_elapsed_time = time.time() - import_start_time
|
||||
F.logger.info(f'[+] PLUGIN IMPORT End.. [{plugin_name}] ({import_elapsed_time:.3f}s)')
|
||||
cls.plugin_list[plugin_name] = entity
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
F.logger.debug('no blueprint')
|
||||
cls.all_package_list[plugin_name]['loading'] = False
|
||||
cls.all_package_list[plugin_name]['status'] = 'import fail'
|
||||
cls.all_package_list[plugin_name]['log'] = traceback.format_exc()
|
||||
|
||||
|
||||
if not F.config['run_celery']:
|
||||
try:
|
||||
with F.app.app_context():
|
||||
F.db.create_all()
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
F.logger.debug('db.create_all error')
|
||||
|
||||
if F.config['run_celery']:
|
||||
for key, entity in cls.plugin_list.items():
|
||||
try:
|
||||
mod_plugin_load = getattr(entity['P'], 'plugin_load_celery')
|
||||
if mod_plugin_load:
|
||||
F.logger.info(f'[!] plugin_load_celery start : [{key}]')
|
||||
mod_plugin_load()
|
||||
F.logger.info(f'[!] plugin_load_celery end : [{key}]')
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
if not F.config['run_flask']:
|
||||
return
|
||||
|
||||
for key, entity in cls.plugin_list.items():
|
||||
try:
|
||||
mod_plugin_load = getattr(entity['P'], 'plugin_load')
|
||||
if mod_plugin_load:
|
||||
def func(mod_plugin_load, key):
|
||||
try:
|
||||
load_start_time = time.time()
|
||||
F.logger.info(f'[!] plugin_load threading start : [{key}]')
|
||||
mod_plugin_load()
|
||||
load_elapsed_time = time.time() - load_start_time
|
||||
F.logger.info(f'[!] plugin_load threading end : [{key}] ({load_elapsed_time:.3f}s)')
|
||||
except Exception as e:
|
||||
F.logger.error('### plugin_load exception : %s', key)
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
cls.all_package_list[key]['loading'] = False
|
||||
cls.all_package_list[key]['status'] = 'plugin_load error'
|
||||
cls.all_package_list[key]['log'] = traceback.format_exc()
|
||||
|
||||
if key in cls.plugin_menus:
|
||||
del cls.plugin_menus[key]
|
||||
F.logger.info(f"플러그인 로딩 실패로 메뉴 삭제1 : {key}")
|
||||
from framework.init_menu import MenuManager
|
||||
MenuManager.init_menu()
|
||||
F.logger.info(f"플러그인 로딩 실패로 메뉴 삭제2 : {key}")
|
||||
|
||||
t = threading.Thread(target=func, args=(mod_plugin_load, key))
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
|
||||
except Exception as e:
|
||||
F.logger.debug(f'[!] PLUGIN_LOAD function not exist : [{key}]')
|
||||
|
||||
try:
|
||||
mod_menu = getattr(entity['P'], 'menu')
|
||||
if mod_menu and cls.all_package_list[key]['loading'] != False:
|
||||
cls.plugin_menus[key]= {'menu':mod_menu, 'match':False}
|
||||
setting_menu = getattr(entity['P'], 'setting_menu')
|
||||
if setting_menu != None and cls.all_package_list[key]['loading'] != False:
|
||||
setting_menu['plugin'] = entity['P'].package_name
|
||||
F.logger.info(f"확장 설정 : {key}")
|
||||
cls.setting_menus.append(setting_menu)
|
||||
except Exception as exception:
|
||||
F.logger.debug('no menu')
|
||||
F.logger.debug('### plugin_load threading all start.. : %s ', len(cls.plugin_list))
|
||||
# 모든 모듈을 로드한 이후에 app 등록, table 생성, start
|
||||
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def plugin_unload(cls):
|
||||
for key, entity in cls.plugin_list.items():
|
||||
try:
|
||||
mod_plugin_unload = getattr(entity['P'], 'plugin_unload')
|
||||
if mod_plugin_unload:
|
||||
mod_plugin_unload()
|
||||
except Exception as e:
|
||||
F.logger.error('module:%s', key)
|
||||
F.logger.error(f'Exception:{str(e)}')
|
||||
F.logger.error(traceback.format_exc())
|
||||
try:
|
||||
from system.setup import P
|
||||
P.plugin_unload()
|
||||
except Exception as e:
|
||||
F.logger.error(f'Exception:{str(e)}')
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
@classmethod
|
||||
def plugin_install(cls, plugin_git, zip_url=None, zip_filename=None):
|
||||
plugin_git = plugin_git.strip()
|
||||
is_git = True if plugin_git != None and plugin_git != '' else False
|
||||
ret = {}
|
||||
try:
|
||||
if is_git:
|
||||
name = plugin_git.split('/')[-1]
|
||||
else:
|
||||
name = zip_filename.split('.')[0]
|
||||
|
||||
plugin_all_path = os.path.join(F.config['path_data'], 'plugins')
|
||||
os.makedirs(plugin_all_path, exist_ok=True)
|
||||
plugin_path = os.path.join(plugin_all_path, name)
|
||||
plugin_info = None
|
||||
if os.path.exists(plugin_path):
|
||||
ret['ret'] = 'danger'
|
||||
ret['msg'] = '이미 설치되어 있습니다.'
|
||||
ret['status'] = 'already_exist'
|
||||
return ret
|
||||
|
||||
if plugin_git and plugin_git.startswith('http'):
|
||||
for tag in ['main', 'master']:
|
||||
try:
|
||||
info_url = plugin_git.replace('github.com', 'raw.githubusercontent.com') + f'/{tag}/info.yaml'
|
||||
plugin_info = requests.get(info_url).json()
|
||||
if plugin_info is not None:
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
if zip_filename and zip_filename != '':
|
||||
zip_filepath = os.path.join(F.config['path_data'], 'tmp', zip_filename)
|
||||
extract_filepath = os.path.join(F.config['path_data'], 'tmp', name)
|
||||
if SupportFile.download(zip_url, zip_filepath):
|
||||
with zipfile.ZipFile(zip_filepath, 'r') as zip_ref:
|
||||
zip_ref.extractall(extract_filepath)
|
||||
plugin_info_filepath = os.path.join(extract_filepath, 'info.yaml')
|
||||
if os.path.exists(plugin_info_filepath):
|
||||
plugin_info = SupportYaml.read_yaml(plugin_info_filepath)
|
||||
|
||||
if plugin_info == None:
|
||||
plugin_info = {}
|
||||
|
||||
flag = True
|
||||
tmp = plugin_info.get('require_os', '')
|
||||
if tmp != '' and type(tmp) == type([]) and platform.system() not in tmp:
|
||||
ret['ret'] = 'danger'
|
||||
ret['msg'] = '설치 가능한 OS가 아닙니다.'
|
||||
ret['status'] = 'not_support_os'
|
||||
flag = False
|
||||
|
||||
tmp = plugin_info.get('require_running_type', '')
|
||||
if tmp != '' and type(tmp) == type([]) and F.config['running_type'] not in tmp:
|
||||
ret['ret'] = 'danger'
|
||||
ret['msg'] = '설치 가능한 실행타입이 아닙니다.'
|
||||
ret['status'] = 'not_support_running_type'
|
||||
flag = False
|
||||
|
||||
|
||||
if flag:
|
||||
if plugin_git and plugin_git.startswith('http'):
|
||||
command = ['git', '-C', plugin_all_path, 'clone', plugin_git + '.git', '--depth', '1']
|
||||
log = SupportSubprocess.execute_command_return(command, log=True)
|
||||
F.logger.debug(log)
|
||||
if os.path.exists(plugin_path):
|
||||
ret['ret'] = 'success'
|
||||
ret['msg'] = '정상적으로 설치하였습니다. 재시작시 적용됩니다.<br>' + '<br>'.join(log['log'].split('\n'))
|
||||
else:
|
||||
ret['ret'] = 'danger'
|
||||
ret['msg'] = '설치 실패.<br>' + '<br>'.join(log['log'].split('\n'))
|
||||
if zip_filename and zip_filename != '':
|
||||
|
||||
if os.path.exists(plugin_path) == False:
|
||||
shutil.move(extract_filepath, plugin_path)
|
||||
else:
|
||||
for tmp in os.listdir(extract_filepath):
|
||||
shutil.move(os.path.join(extract_filepath, tmp), plugin_path)
|
||||
log = ''
|
||||
|
||||
# 2021-12-31
|
||||
tmp = plugin_info.get('require_plugin', '')
|
||||
if tmp != '' and type(tmp) == type([]) and len(tmp) > 0:
|
||||
for need_plugin in plugin_info['require_plugin']:
|
||||
if need_plugin['package_name'] in cls.plugin_init:
|
||||
F.logger.debug(f"Dependency 설치 - 이미 설치됨 : {need_plugin['package_name']}")
|
||||
continue
|
||||
else:
|
||||
F.logger.debug(f"Dependency 설치 : {need_plugin['package_name']}")
|
||||
cls.plugin_install(need_plugin['home'], None, None)
|
||||
|
||||
|
||||
#ret['msg'] = '<br>'.join(log)
|
||||
|
||||
except Exception as e:
|
||||
F.logger.error(f'Exception:{str(e)}')
|
||||
F.logger.error(traceback.format_exc())
|
||||
ret['ret'] = 'danger'
|
||||
ret['msg'] = str(e)
|
||||
return ret
|
||||
|
||||
|
||||
@classmethod
|
||||
def plugin_update(cls):
|
||||
try:
|
||||
if os.environ.get('UPDATE_STOP') == 'true':
|
||||
return
|
||||
if os.environ.get('PLUGIN_UPDATE_FROM_PYTHON') == 'false':
|
||||
return
|
||||
if F.config['plugin_update'] != True:
|
||||
return
|
||||
plugins_path = os.path.join(F.config['path_data'], 'plugins')
|
||||
if os.path.exists(plugins_path) == False:
|
||||
return
|
||||
tmps = os.listdir(plugins_path)
|
||||
for t in tmps:
|
||||
plugin_path = os.path.join(plugins_path, t)
|
||||
if t.startswith('_') or t.startswith('.'):
|
||||
continue
|
||||
if os.path.exists(os.path.join(plugin_path, '.git')):
|
||||
command = ['git', '-C', plugin_path, 'reset', '--hard', 'HEAD']
|
||||
ret = SupportSubprocess.execute_command_return(command)
|
||||
F.logger.debug(ret)
|
||||
command = ['git', '-C', plugin_path, 'pull']
|
||||
ret = SupportSubprocess.execute_command_return(command)
|
||||
F.logger.debug(ret)
|
||||
else:
|
||||
F.logger.debug(f"{plugin_path} not git repo")
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_plugin_instance(cls, package_name):
|
||||
try:
|
||||
if cls.all_package_list[package_name]['loading']:
|
||||
return cls.all_package_list[package_name]['P']
|
||||
except:
|
||||
pass
|
||||
@@ -1,160 +0,0 @@
|
||||
import os
|
||||
import traceback
|
||||
|
||||
from flask import (jsonify, redirect, render_template, request,
|
||||
send_from_directory)
|
||||
from flask_login import login_required
|
||||
from framework import F
|
||||
|
||||
|
||||
@F.app.route('/global/ajax/<sub>', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def global_ajax(sub):
|
||||
#logger.debug('/global/ajax/%s', sub)
|
||||
if sub == 'listdir':
|
||||
if 'path' in request.form:
|
||||
#if os.path.isfile(request.form['path']):
|
||||
# return jsonify('')
|
||||
path = request.form['path']
|
||||
if os.path.isfile(path):
|
||||
path = os.path.dirname(path)
|
||||
result_list = os.listdir(path)
|
||||
|
||||
if 'only_dir' in request.form and request.form['only_dir'].lower() == 'true':
|
||||
result_list = [name for name in result_list if os.path.isdir(os.path.join(path, name))]
|
||||
|
||||
result_list.sort()
|
||||
result_list = [f"{x}|{os.path.join(path,x)}" for x in result_list]
|
||||
tmp = os.path.dirname(path)
|
||||
if path != tmp:
|
||||
result_list = [f'..|{tmp}'] + result_list
|
||||
return jsonify(result_list)
|
||||
else:
|
||||
return jsonify(None)
|
||||
elif sub == 'is_available_edit':
|
||||
# globalEditBtn
|
||||
try:
|
||||
if F.PluginManager.all_package_list['flaskcode']['loading']:
|
||||
PP = F.PluginManager.all_package_list['flaskcode']['P']
|
||||
#import flaskcode
|
||||
#from flaskcode.setup import P as PP
|
||||
ret = {'ret':True, 'target':PP.ModelSetting.get('setting_open_target')}
|
||||
return jsonify(ret)
|
||||
else:
|
||||
return jsonify({'ret':False})
|
||||
|
||||
except:
|
||||
return jsonify({'ret':False})
|
||||
elif sub == 'command_modal_hide':
|
||||
from tool import ToolModalCommand
|
||||
ToolModalCommand.modal_close()
|
||||
return jsonify('')
|
||||
elif sub == 'command_modal_input':
|
||||
from tool import ToolModalCommand
|
||||
cmd = request.form['cmd']
|
||||
ToolModalCommand.input_command(cmd)
|
||||
return jsonify('')
|
||||
|
||||
|
||||
|
||||
@F.app.route('/robots.txt')
|
||||
def robot_to_root():
|
||||
return send_from_directory('', 'static/file/robots.txt')
|
||||
|
||||
|
||||
|
||||
|
||||
@F.app.route("/")
|
||||
@F.app.route("/None")
|
||||
@F.app.route("/home")
|
||||
def home():
|
||||
return redirect('/system/home')
|
||||
|
||||
|
||||
@F.app.route("/version")
|
||||
def get_version():
|
||||
from .version import VERSION
|
||||
return VERSION
|
||||
|
||||
@F.app.route("/open/<path:path>")
|
||||
@login_required
|
||||
def open_file(path):
|
||||
return send_from_directory('/', path)
|
||||
|
||||
|
||||
@F.app.route("/file/<path:path>")
|
||||
@F.check_api
|
||||
def file2(path):
|
||||
import platform
|
||||
if platform.system() == 'Windows':
|
||||
path = os.path.splitdrive(path)[1][1:]
|
||||
return send_from_directory('/', path, as_attachment=True)
|
||||
|
||||
|
||||
@F.app.route("/upload", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def upload():
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
f = request.files['file']
|
||||
from werkzeug.utils import secure_filename
|
||||
upload_path = F.SystemModelSetting.get('path_upload')
|
||||
os.makedirs(upload_path, exist_ok=True)
|
||||
f.save(os.path.join(upload_path, secure_filename(f.filename)))
|
||||
return jsonify('success')
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
return jsonify('fail')
|
||||
|
||||
|
||||
@F.app.route("/videojs", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def videojs():
|
||||
data = {}
|
||||
data['play_title'] = request.form['play_title']
|
||||
data['play_source_src'] = request.form['play_source_src']
|
||||
data['play_source_type'] = request.form['play_source_type']
|
||||
if 'play_subtitle_src' in request.form:
|
||||
data['play_subtitle_src'] = request.form['play_subtitle_src']
|
||||
return render_template('videojs.html', data=data)
|
||||
|
||||
@F.app.route("/videojs_drm", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def videojs_drm():
|
||||
data = {}
|
||||
data['play_title'] = request.form['play_title']
|
||||
data['play_source_src'] = request.form['play_source_src']
|
||||
data['play_source_type'] = request.form['play_source_type']
|
||||
if 'play_subtitle_src' in request.form:
|
||||
data['play_subtitle_src'] = request.form['play_subtitle_src']
|
||||
return render_template('videojs_drm.html', data=data)
|
||||
|
||||
@F.app.route("/videojs_discord", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def videojs_og():
|
||||
data = {}
|
||||
"""
|
||||
data['play_title'] = request.form['play_title']
|
||||
data['play_source_src'] = request.form['play_source_src']
|
||||
data['play_source_type'] = request.form['play_source_type']
|
||||
if 'play_subtitle_src' in request.form:
|
||||
data['play_subtitle_src'] = request.form['play_subtitle_src']
|
||||
"""
|
||||
return render_template('videojs_discord.html', data=data)
|
||||
|
||||
|
||||
@F.app.route("/headers", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def headers():
|
||||
from support import d
|
||||
F.logger.info(d(request.headers))
|
||||
return jsonify(d(request.headers))
|
||||
|
||||
|
||||
# 3.10에서 이거 필수
|
||||
@F.socketio.on('connect', namespace=f'/framework')
|
||||
@login_required
|
||||
def connect():
|
||||
pass
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
import re
|
||||
|
||||
from framework import F
|
||||
|
||||
|
||||
def get_menu(full_query):
|
||||
match = re.compile(r'\/(?P<package_name>.*?)\/(?P<module_name>.*?)\/manual\/(?P<sub2>.*?)($|\?)').match(full_query)
|
||||
if match:
|
||||
return match.group('package_name'), match.group('module_name'), f"manual/{match.group('sub2')}"
|
||||
|
||||
match = re.compile(r'\/(?P<menu>.*?)\/manual\/(?P<sub2>.*?)($|\?)').match(full_query)
|
||||
if match:
|
||||
return match.group('menu'), 'manual', match.group('sub2')
|
||||
|
||||
match = re.compile(r'\/(?P<menu>.*?)\/(?P<sub>.*?)\/(?P<sub2>.*?)($|\/|\?)').match(full_query)
|
||||
if match:
|
||||
return match.group('menu'), match.group('sub'), match.group('sub2')
|
||||
|
||||
match = re.compile(r'\/(?P<menu>.*?)\/(?P<sub>.*?)($|\/|\?)').match(full_query)
|
||||
if match:
|
||||
return match.group('menu'), match.group('sub'), None
|
||||
|
||||
match = re.compile(r'\/(?P<menu>.*?)($|\/|\?)').match(full_query)
|
||||
if match:
|
||||
return match.group('menu'), None , None
|
||||
return 'home', None, None
|
||||
|
||||
|
||||
|
||||
def get_theme():
|
||||
return F.SystemModelSetting.get('theme')
|
||||
|
||||
#def get_login_status():
|
||||
# if current_user is None:
|
||||
# return False
|
||||
# return current_user.is_authenticated
|
||||
|
||||
def get_web_title():
|
||||
try:
|
||||
return F.SystemModelSetting.get('web_title')
|
||||
except:
|
||||
return 'Home'
|
||||
|
||||
|
||||
def is_https():
|
||||
return (F.SystemModelSetting.get('ddns').find('https://') != -1)
|
||||
|
||||
|
||||
def jinja_initialize(app):
|
||||
#from .init_menu import get_menu_map, get_plugin_menu
|
||||
from .init_menu import MenuManager
|
||||
app.jinja_env.globals.update(get_menu=get_menu)
|
||||
app.jinja_env.globals.update(get_theme=get_theme)
|
||||
app.jinja_env.globals.update(get_menu_map=MenuManager.get_menu_map)
|
||||
app.jinja_env.globals.update(get_setting_menu=MenuManager.get_setting_menu)
|
||||
app.jinja_env.globals.update(get_web_title=get_web_title)
|
||||
app.jinja_env.globals.update(dropzone=F.dropzone)
|
||||
|
||||
app.jinja_env.filters['get_menu'] = get_menu
|
||||
app.jinja_env.filters['get_theme'] = get_theme
|
||||
app.jinja_env.filters['get_menu_map'] = MenuManager.get_menu_map
|
||||
app.jinja_env.filters['get_setting_menu'] = MenuManager.get_setting_menu
|
||||
app.jinja_env.filters['get_web_title'] = get_web_title
|
||||
|
||||
app.jinja_env.auto_reload = True
|
||||
app.jinja_env.add_extension('jinja2.ext.loopcontrols')
|
||||
@@ -1,137 +0,0 @@
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from flask import request
|
||||
from framework import F
|
||||
from support import SingletonClass
|
||||
|
||||
namespace = 'log'
|
||||
|
||||
@F.socketio.on('connect', namespace='/%s' % namespace)
|
||||
@F.login_required
|
||||
def socket_connect():
|
||||
F.logger.debug('log connect')
|
||||
|
||||
@F.socketio.on('start', namespace='/%s' % namespace)
|
||||
@F.login_required
|
||||
def socket_file(data):
|
||||
try:
|
||||
package = filename = None
|
||||
if 'package' in data:
|
||||
package = data['package']
|
||||
else:
|
||||
filename = data['filename']
|
||||
LogViewer.instance().start(package, filename, request.sid)
|
||||
F.logger.debug('start package:%s filename:%s sid:%s', package, filename, request.sid)
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
@F.socketio.on('disconnect', namespace='/%s' % namespace)
|
||||
def disconnect():
|
||||
try:
|
||||
LogViewer.instance().disconnect(request.sid)
|
||||
F.logger.debug('disconnect sid:%s', request.sid)
|
||||
except Exception as e:
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
|
||||
|
||||
|
||||
class WatchThread(threading.Thread):
|
||||
|
||||
def __init__(self, package, filename):
|
||||
super(WatchThread, self).__init__()
|
||||
self.stop_flag = False
|
||||
self.package = package
|
||||
self.filename = filename
|
||||
self.daemon = True
|
||||
|
||||
def stop(self):
|
||||
self.stop_flag = True
|
||||
|
||||
def run(self):
|
||||
F.logger.debug('WatchThread.. Start %s', self.package)
|
||||
if self.package is not None:
|
||||
logfile = os.path.join(F.config['path_data'], 'log', f'{self.package}.log')
|
||||
key = 'package'
|
||||
value = self.package
|
||||
else:
|
||||
logfile = os.path.join(F.config['path_data'], 'log', self.filename)
|
||||
key = 'filename'
|
||||
value = self.filename
|
||||
if os.path.exists(logfile):
|
||||
with open(logfile, 'r', encoding='utf8') as f:
|
||||
f.seek(0, os.SEEK_END)
|
||||
while not self.stop_flag:
|
||||
line = f.readline()
|
||||
if not line:
|
||||
time.sleep(0.1) # Sleep briefly
|
||||
continue
|
||||
F.socketio.emit("add", {key : value, 'data': line}, namespace='/log')
|
||||
F.logger.debug('WatchThread.. End %s', value)
|
||||
else:
|
||||
F.socketio.emit("add", {key : value, 'data': 'not exist logfile'}, namespace='/log')
|
||||
|
||||
|
||||
class LogViewer(SingletonClass):
|
||||
|
||||
watch_list = {}
|
||||
|
||||
@classmethod
|
||||
def start(cls, package, filename, sid):
|
||||
# 2019-04-02 간만에 봤더니 헷깔려서 적는다
|
||||
# 이 쓰레드는 오픈시 이전 데이타만을 보내는 쓰레드다. 실시간보는거 아님.
|
||||
|
||||
def thread_function():
|
||||
if package is not None:
|
||||
logfile = os.path.join(F.config['path_data'], 'log', f'{package}.log')
|
||||
else:
|
||||
logfile = os.path.join(F.config['path_data'], 'log', filename)
|
||||
if os.path.exists(logfile):
|
||||
ins_file = open(logfile, 'r', encoding='utf8') ## 3)
|
||||
line = ins_file.read()
|
||||
F.socketio.emit("on_start", {'data': line}, namespace='/log')
|
||||
F.logger.debug('on_start end')
|
||||
else:
|
||||
F.socketio.emit("on_start", {'data': 'not exist logfile'}, namespace='/log')
|
||||
|
||||
if package is not None:
|
||||
key = package
|
||||
else:
|
||||
key = filename
|
||||
thread = threading.Thread(target=thread_function, args=())
|
||||
thread.daemon = True
|
||||
thread.start()
|
||||
|
||||
|
||||
if key not in cls.watch_list:
|
||||
cls.watch_list[key] = {}
|
||||
cls.watch_list[key]['sid'] = []
|
||||
cls.watch_list[key]['thread'] = WatchThread(package, filename)
|
||||
cls.watch_list[key]['thread'].start()
|
||||
cls.watch_list[key]['sid'].append(sid)
|
||||
|
||||
@classmethod
|
||||
def disconnect(cls, sid):
|
||||
find = False
|
||||
find_key = None
|
||||
for key, value in cls.watch_list.items():
|
||||
F.logger.debug('key:%s value:%s', key, value)
|
||||
for s in value['sid']:
|
||||
if sid == s:
|
||||
find = True
|
||||
find_key = key
|
||||
value['sid'].remove(s)
|
||||
break
|
||||
if find:
|
||||
break
|
||||
if not find:
|
||||
return
|
||||
if not cls.watch_list[find_key]['sid']:
|
||||
F.logger.debug('thread kill')
|
||||
cls.watch_list[find_key]['thread'].stop()
|
||||
del cls.watch_list[find_key]
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from support import get_logger
|
||||
@@ -1,257 +0,0 @@
|
||||
import threading
|
||||
import traceback
|
||||
from datetime import datetime, timedelta
|
||||
from random import randint
|
||||
|
||||
from apscheduler.jobstores.base import JobLookupError
|
||||
from apscheduler.triggers.cron import CronTrigger
|
||||
from pytz import timezone
|
||||
|
||||
|
||||
class Scheduler(object):
|
||||
job_list = []
|
||||
first_run_check_thread = None
|
||||
def __init__(self, frame):
|
||||
self.frame = frame
|
||||
self.logger = frame.logger
|
||||
try:
|
||||
if frame.config['use_gevent']:
|
||||
from apscheduler.schedulers.gevent import GeventScheduler
|
||||
self.sched = GeventScheduler(timezone='Asia/Seoul')
|
||||
else:
|
||||
raise Exception('')
|
||||
except:
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
self.sched = BackgroundScheduler(timezone='Asia/Seoul')
|
||||
self.sched.start()
|
||||
self.logger.info('SCHEDULER start..')
|
||||
|
||||
def first_run_check_thread_function(self):
|
||||
try:
|
||||
#time.sleep(60)
|
||||
#for i in range(5):
|
||||
flag_exit = True
|
||||
for job_instance in self.job_list:
|
||||
if not job_instance.run:
|
||||
continue
|
||||
if job_instance.count == 0 and not job_instance.is_running and job_instance.is_interval:
|
||||
#if job_instance.count == 0 and not job_instance.is_running:
|
||||
job = self.sched.get_job(job_instance.job_id)
|
||||
if job is not None:
|
||||
self.logger.warning('job_instance : %s', job_instance.plugin)
|
||||
self.logger.warning('XX job re-sched:%s', job)
|
||||
flag_exit = False
|
||||
tmp = randint(1, 20)
|
||||
job.modify(next_run_time=datetime.now(timezone('Asia/Seoul')) + timedelta(seconds=tmp))
|
||||
#break
|
||||
else:
|
||||
pass
|
||||
if flag_exit:
|
||||
self.remove_job("scheduler_check")
|
||||
#time.sleep(30)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Exception:{str(e)}")
|
||||
self.logger.error(traceback.format_exc())
|
||||
|
||||
def shutdown(self):
|
||||
self.sched.shutdown()
|
||||
|
||||
def kill_scheduler(self, job_id):
|
||||
try:
|
||||
self.sched.remove_job(job_id)
|
||||
except JobLookupError as err:
|
||||
self.logger.debug("fail to stop Scheduler: {err}".format(err=err))
|
||||
self.logger.debug(traceback.format_exc())
|
||||
|
||||
|
||||
|
||||
def add_job_instance(self, job_instance, run=True):
|
||||
if self.frame.config['run_flask']:
|
||||
if not self.is_include(job_instance.job_id):
|
||||
job_instance.run = run
|
||||
Scheduler.job_list.append(job_instance)
|
||||
if job_instance.is_interval:
|
||||
self.sched.add_job(job_instance.job_function, 'interval', minutes=job_instance.interval, seconds=job_instance.interval_seconds, id=job_instance.job_id, args=(None))
|
||||
elif job_instance.is_cron:
|
||||
self.sched.add_job(job_instance.job_function, CronTrigger.from_crontab(job_instance.interval), id=job_instance.job_id, args=(None))
|
||||
job = self.sched.get_job(job_instance.job_id)
|
||||
if run and job_instance.is_interval:
|
||||
tmp = randint(5, 20)
|
||||
job.modify(next_run_time=datetime.now(timezone('Asia/Seoul')) + timedelta(seconds=tmp))
|
||||
|
||||
def execute_job(self, job_id):
|
||||
self.logger.debug('execute_job:%s', job_id)
|
||||
job = self.sched.get_job(job_id)
|
||||
tmp = randint(5, 20)
|
||||
job.modify(next_run_time=datetime.now(timezone('Asia/Seoul')) + timedelta(seconds=tmp))
|
||||
|
||||
|
||||
def is_include(self, job_id):
|
||||
job = self.sched.get_job(job_id)
|
||||
return (job is not None)
|
||||
|
||||
def remove_job(self, job_id):
|
||||
try:
|
||||
if self.is_include(job_id):
|
||||
self.sched.remove_job(job_id)
|
||||
job = self.get_job_instance(job_id)
|
||||
if not job.is_running:
|
||||
self.remove_job_instance(job_id)
|
||||
self.logger.debug('remove job_id:%s', job_id)
|
||||
return True
|
||||
except JobLookupError as err:
|
||||
self.logger.debug("fail to remove Scheduler: {err}".format(err=err))
|
||||
self.logger.debug(traceback.format_exc())
|
||||
return False
|
||||
|
||||
|
||||
def get_job_instance(self, job_id):
|
||||
for job in Scheduler.job_list:
|
||||
if job.job_id == job_id:
|
||||
return job
|
||||
|
||||
def is_running(self, job_id):
|
||||
job = self.get_job_instance(job_id)
|
||||
if job is None:
|
||||
return False
|
||||
else:
|
||||
return job.is_running
|
||||
|
||||
# job에서만 호출한다..
|
||||
def remove_job_instance(self, job_id):
|
||||
# function이 실행중일때 제거하면..
|
||||
# 실행중이나 목록에서 빠져버린다..
|
||||
for job in Scheduler.job_list:
|
||||
if job.job_id == job_id:
|
||||
Scheduler.job_list.remove(job)
|
||||
self.logger.debug('remove_job_instance : %s', job_id)
|
||||
break
|
||||
|
||||
|
||||
def get_job_list_info(self):
|
||||
|
||||
ret = []
|
||||
idx = 0
|
||||
job_list = self.sched.get_jobs()
|
||||
#logger.debug('len jobs %s %s', len(jobs), len(Scheduler.job_list))
|
||||
for j in job_list:
|
||||
idx += 1
|
||||
entity = {}
|
||||
entity['no'] = idx
|
||||
entity['id'] = j.id
|
||||
entity['next_run_time'] = j.next_run_time.strftime('%m-%d %H:%M:%S')
|
||||
remain = (j.next_run_time - datetime.now(timezone('Asia/Seoul')))
|
||||
tmp = ''
|
||||
if remain.days > 0:
|
||||
tmp += '%s일 ' % (remain.days)
|
||||
remain = remain.seconds
|
||||
if remain//3600 > 0:
|
||||
tmp += '%s시간 ' % (remain//3600)
|
||||
remain = remain % 3600
|
||||
if remain // 60 > 0:
|
||||
tmp += '%s분 ' % (remain//60)
|
||||
tmp += '%s초' % (remain%60)
|
||||
#entity['remain_time'] = (j.next_run_time - datetime.now(timezone('Asia/Seoul'))).seconds
|
||||
entity['remain_time'] = tmp
|
||||
job = self.get_job_instance(j.id)
|
||||
if job is not None:
|
||||
entity['count'] = job.count
|
||||
entity['plugin'] = job.plugin
|
||||
if job.is_cron:
|
||||
entity['interval'] = job.interval
|
||||
elif job.interval == 9999:
|
||||
entity['interval'] = '항상 실행'
|
||||
entity['remain_time'] = ''
|
||||
else:
|
||||
entity['interval'] = '%s분 %s초' % (job.interval, job.interval_seconds)
|
||||
entity['is_running'] = job.is_running
|
||||
entity['description'] = job.description
|
||||
entity['running_timedelta'] = job.running_timedelta.seconds if job.running_timedelta is not None else '-'
|
||||
if entity['running_timedelta'] != '-':
|
||||
tmp = entity['running_timedelta']
|
||||
_min = entity['running_timedelta'] / 60
|
||||
_sec = entity['running_timedelta'] % 60
|
||||
entity['running_timedelta'] = "%2d분 %2d초" % (_min, _sec)
|
||||
entity['make_time'] = job.make_time.strftime('%m-%d %H:%M:%S')
|
||||
entity['run'] = job.run
|
||||
else:
|
||||
entity['count'] = ''
|
||||
entity['plugin'] = ''
|
||||
entity['interval'] = ''
|
||||
entity['is_running'] = ''
|
||||
entity['description'] = ''
|
||||
entity['running_timedelta'] = ''
|
||||
entity['make_time'] = ''
|
||||
entity['run'] = True
|
||||
|
||||
ret.append(entity)
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Job(object):
|
||||
def __init__(self, plugin, job_id, interval, target_function, description, args=None):
|
||||
self.plugin = plugin
|
||||
self.job_id = job_id
|
||||
self.interval = '%s' % interval
|
||||
self.interval_seconds = randint(1, 59)
|
||||
self.target_function = target_function
|
||||
self.description = description
|
||||
self.is_running = False
|
||||
self.thread = None
|
||||
self.start_time = None
|
||||
self.end_time = None
|
||||
self.running_timedelta = None
|
||||
self.status = None
|
||||
self.count = 0
|
||||
self.make_time = datetime.now(timezone('Asia/Seoul'))
|
||||
if len(self.interval.strip().split(' ')) == 5:
|
||||
self.is_cron = True
|
||||
self.is_interval = False
|
||||
else:
|
||||
self.is_cron = False
|
||||
self.is_interval = True
|
||||
if self.is_interval:
|
||||
if isinstance(self.interval, str):
|
||||
self.interval = int(self.interval)
|
||||
self.args = args
|
||||
# true이고 interval이면 바로 실행
|
||||
# false이면 스케쥴링시간이 되면 실행
|
||||
# add_job_instance에서 true이면 20초 이내에 실행하려고 함.
|
||||
# false이면 넣을 때는 실행하지 않고 다음 주기때 실행
|
||||
self.run = True
|
||||
|
||||
def job_function(self):
|
||||
try:
|
||||
from framework import F
|
||||
self.is_running = True
|
||||
self.start_time = datetime.now(timezone('Asia/Seoul'))
|
||||
if self.args is None:
|
||||
self.thread = threading.Thread(target=self.target_function, args=())
|
||||
else:
|
||||
self.thread = threading.Thread(target=self.target_function, args=self.args)
|
||||
self.thread.daemon = True
|
||||
self.thread.start()
|
||||
F.socketio.emit('notify', {'type':'success', 'msg':f"{self.description}<br>작업을 시작합니다." }, namespace='/framework')
|
||||
self.thread.join()
|
||||
F.socketio.emit('notify', {'type':'success', 'msg':f"{self.description}<br>작업이 종료되었습니다." }, namespace='/framework')
|
||||
self.end_time = datetime.now(timezone('Asia/Seoul'))
|
||||
self.running_timedelta = self.end_time - self.start_time
|
||||
self.status = 'success'
|
||||
if not F.scheduler.is_include(self.job_id):
|
||||
F.scheduler.remove_job_instance(self.job_id)
|
||||
self.count += 1
|
||||
except Exception as e:
|
||||
self.status = 'exception'
|
||||
F.logger.error(f"Exception:{str(e)}")
|
||||
F.logger.error(traceback.format_exc())
|
||||
finally:
|
||||
self.is_running = False
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
BIN
Binary file not shown.
-11
File diff suppressed because one or more lines are too long
-6
File diff suppressed because one or more lines are too long
@@ -1,135 +0,0 @@
|
||||
body {
|
||||
font-size: .850rem;
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
.alert-minimalist {
|
||||
background-color: rgb(241, 242, 240);
|
||||
border-color: rgba(149, 149, 149, 0.3);
|
||||
border-radius: 3px;
|
||||
color: rgb(149, 149, 149);
|
||||
padding: 10px;
|
||||
}
|
||||
.alert-minimalist > [data-notify="icon"] {
|
||||
height: 50px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
.alert-minimalist > [data-notify="title"] {
|
||||
color: rgb(51, 51, 51);
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.alert-minimalist > [data-notify="message"] {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
textarea {
|
||||
font-family: Courier
|
||||
}
|
||||
|
||||
|
||||
.loading { position: fixed; left: 45%; top: 50%; background: #00000000; }
|
||||
|
||||
.table > tbody > tr.collapse > td {
|
||||
background-color: #009fff0d !important;
|
||||
}
|
||||
.tableRowHover tbody tr:not(.tableRowHoverOff):hover td {
|
||||
background-color: #ffff0080 !important;
|
||||
}
|
||||
|
||||
.table > tbody > tr > td { vertical-align: middle; }
|
||||
|
||||
.tab-pane {
|
||||
border-left: 1px solid #ddd;
|
||||
border-right: 1px solid #ddd;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-radius: 0px 0px 5px 5px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.btn-toolbar { text-align: center; }
|
||||
.nav-tabs { margin-bottom: 0; }
|
||||
.navbar-nav li:hover>.dropdown-menu { display: block; }
|
||||
.dropdown-toggle::after { display:none; }
|
||||
.set-left { text-align: left; }
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.set-left { text-align: right; }
|
||||
}
|
||||
|
||||
.badge-sm {
|
||||
min-width: 1.8em;
|
||||
padding: .25em !important;
|
||||
margin-left: .1em;
|
||||
margin-right: .1em;
|
||||
color: white !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
@media all and (min-width: 992px) {
|
||||
.dropdown-menu li{
|
||||
position: relative;
|
||||
}
|
||||
.dropdown-menu .submenu{
|
||||
display: none;
|
||||
position: absolute;
|
||||
left:100%; top:-7px;
|
||||
}
|
||||
.dropdown-menu .submenu-left{
|
||||
right:100%; left:auto;
|
||||
}
|
||||
.dropdown-menu > li:hover{ background-color: #f1f1f1 }
|
||||
.dropdown-menu > li:hover > .submenu{
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
/* ============ desktop view .end// ============ */
|
||||
|
||||
/* ============ small devices ============ */
|
||||
@media (max-width: 991px) {
|
||||
.dropdown-menu .dropdown-menu{
|
||||
margin-left:0.7rem; margin-right:0.7rem; margin-bottom: .5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
margin:-2px;
|
||||
}
|
||||
|
||||
.modal { overflow: scroll !important; }
|
||||
|
||||
/* Mobile Navigation Tightening */
|
||||
@media (max-width: 768px) {
|
||||
#menu_module_div {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
#menu_module_div .nav-pills {
|
||||
margin-bottom: 0 !important;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
#menu_page_div .nav-pills {
|
||||
margin-top: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
|
||||
}
|
||||
#main_container {
|
||||
padding-top: 0 !important;
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
#main_container > .d-inline-block {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
h3 {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
height: 45px;
|
||||
min-height: 45px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.bars-lnk {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.bars-lnk i {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.bars-lnk img {
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
margin-top: -15px;
|
||||
margin-right: 15px;
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.lateral-menu {
|
||||
background-color: #333;
|
||||
color: rgb(144, 144, 144);
|
||||
width: 300px;
|
||||
|
||||
}
|
||||
|
||||
.lateral-menu label {
|
||||
color: rgb(144, 144, 144);
|
||||
}
|
||||
|
||||
.lateral-menu-content {
|
||||
padding-left: 10px;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
font-weight: bold;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.lateral-menu-content .title{
|
||||
padding-top: 15px;
|
||||
font-size: 2em;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.lateral-menu-content-inner {
|
||||
overflow-y: auto;
|
||||
height: 100%;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 50px;
|
||||
padding-right: 10px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#preview {
|
||||
height: 97%;
|
||||
max-height: 97%;
|
||||
border: 1px solid #eee;
|
||||
overflow-y: scroll;
|
||||
width: 55%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
pre {
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
background-color: #f8f8f8;
|
||||
border: 1px solid #dfdfdf;
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 1.5em;
|
||||
padding: 0.125rem 0.3125rem 0.0625rem;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
.modal-wrapper {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
background-color: rgba(51,51,51,0.5);
|
||||
}
|
||||
|
||||
.modal-inner {
|
||||
margin-top: 200px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 600px;
|
||||
height: 225px;
|
||||
background-color: #fff;
|
||||
opacity: 1;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-close-btn {
|
||||
float: right;
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
color: #ff4336;
|
||||
}
|
||||
|
||||
.modal-close-btn:hover {
|
||||
float: right;
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
color: #8d0002;
|
||||
}
|
||||
|
||||
.modal-topbar {
|
||||
clear: both;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.modal-inner .link-area {
|
||||
margin: 10px;
|
||||
height: 170px;
|
||||
|
||||
}
|
||||
|
||||
.modal-inner textarea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.version {
|
||||
color: white;
|
||||
font-size: 0.8em !important;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +0,0 @@
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 318 B |
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="100px" height="100px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
|
||||
<circle cx="50" cy="50" r="31" stroke-width="4" stroke="#e15b64" stroke-dasharray="48.69468613064179 48.69468613064179" fill="none" stroke-linecap="round">
|
||||
<animateTransform attributeName="transform" type="rotate" dur="2.6315789473684212s" repeatCount="indefinite" keyTimes="0;1" values="0 50 50;360 50 50"></animateTransform>
|
||||
</circle>
|
||||
<circle cx="50" cy="50" r="26" stroke-width="4" stroke="#f8b26a" stroke-dasharray="40.840704496667314 40.840704496667314" stroke-dashoffset="40.840704496667314" fill="none" stroke-linecap="round">
|
||||
<animateTransform attributeName="transform" type="rotate" dur="2.6315789473684212s" repeatCount="indefinite" keyTimes="0;1" values="0 50 50;-360 50 50"></animateTransform>
|
||||
</circle>
|
||||
<!-- [ldio] generated by https://loading.io/ --></svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user