-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from HisAtri/ur2853956
音乐Tag修改+/api/v1 端点
- Loading branch information
Showing
21 changed files
with
2,254 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.git | ||
.github | ||
tests/ | ||
.deploy_tmp_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
# 基于Python3.9 alpine镜像 | ||
FROM python:3.9.17-alpine3.18 | ||
# 第一阶段:安装GCC | ||
FROM python:3.12.1-alpine as gcc_installer | ||
|
||
# 安装GCC | ||
RUN apk add --no-cache gcc musl-dev | ||
|
||
# 第二阶段:安装Python依赖 | ||
FROM gcc_installer as requirements_installer | ||
|
||
# 设置工作目录 | ||
WORKDIR /app | ||
|
||
# 将源代码复制到Docker镜像中 | ||
COPY ./LrcApi /app | ||
# 只复制 requirements.txt,充分利用 Docker 缓存层 | ||
COPY ./LrcApi/requirements.txt /app/ | ||
|
||
# 安装Python依赖 | ||
RUN pip install --no-user --prefix=/install -r requirements.txt | ||
|
||
# 第三阶段:运行环境 | ||
FROM python:3.12.1-alpine | ||
|
||
# 安装Python项目依赖 | ||
RUN pip install -r /app/requirements.txt | ||
# 设置工作目录 | ||
WORKDIR /app | ||
|
||
# 复制Python依赖 | ||
COPY --from=requirements_installer /install /usr/local | ||
|
||
# 复制项目代码 | ||
COPY ./LrcApi /app | ||
|
||
# 设置启动命令 | ||
CMD ["python", "/app/app.py"] | ||
CMD ["python", "/app/app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env python | ||
# This whole module is just id3 tag part of MusicBrainz Picard | ||
# The idea is to get Musicbrainz's layer on top of mutagen without | ||
# dependancies (like qt) | ||
|
||
import logging | ||
import os | ||
|
||
import mutagen | ||
|
||
from . import file | ||
from . import util | ||
from . import aac | ||
from . import aiff | ||
from . import apev2 | ||
from . import asf | ||
from . import dsf | ||
from . import flac | ||
from . import id3 | ||
from . import mp4 | ||
from . import smf | ||
from . import vorbis | ||
from . import wave | ||
|
||
from .file import Artwork, MetadataItem, NotAppendable, AudioFile | ||
|
||
__version__ = """0.4.3""" | ||
|
||
logger = logging.getLogger("music_tag") | ||
log = logger | ||
|
||
|
||
def _subclass_spider_dfs(kls, _lst=None): | ||
if _lst is None: | ||
_lst = [] | ||
for sub in kls.__subclasses__(): | ||
_subclass_spider_dfs(sub, _lst=_lst) | ||
_lst.append(kls) | ||
return _lst | ||
|
||
|
||
def load_file(file_spec, err='raise'): | ||
if isinstance(file_spec, mutagen.FileType): | ||
mfile = file_spec | ||
filename = mfile.filename | ||
else: | ||
filename = file_spec | ||
if not os.path.exists(filename): | ||
if os.path.exists(os.path.expanduser(os.path.expandvars(filename))): | ||
filename = os.path.expanduser(os.path.expandvars(filename)) | ||
elif os.path.exists(os.path.expanduser(filename)): | ||
filename = os.path.expanduser(filename) | ||
mfile = mutagen.File(filename, easy=False) | ||
|
||
ret = None | ||
|
||
for kls in _subclass_spider_dfs(file.AudioFile): | ||
# print("checking against:", kls, kls.mutagen_kls) | ||
if kls.mutagen_kls is not None and isinstance(mfile, kls.mutagen_kls): | ||
ret = kls(filename, _mfile=mfile) | ||
break | ||
|
||
if ret is None and err == 'raise': | ||
raise NotImplementedError("Mutagen type {0} not implemented" | ||
"".format(type(mfile))) | ||
|
||
return ret | ||
|
||
|
||
__all__ = ['file', 'util', | ||
'aac', 'aiff', 'apev2', 'asf', 'dsf', 'flac', | ||
'id3', 'mp4', 'smf', 'vorbis', 'wave', | ||
'logger', 'log', | ||
'Artwork', 'MetadataItem', 'NotAppendable', | ||
'AudioFile', | ||
'load_file', | ||
] | ||
|
||
## | ||
## EOF | ||
## |
Oops, something went wrong.