Skip to content

Commit

Permalink
✨ feat: 将指令改为mk
Browse files Browse the repository at this point in the history
  • Loading branch information
nichuanfang committed Oct 10, 2023
1 parent e0d63f6 commit 47098a7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ pip install -U music-tool-kit
- 音乐下载

```bash
musictool 网址 [输出] [封面url]
mk 网址 [输出] [封面url]
```

> tips: 输出格式为 歌曲名[-歌手] 输出歌曲格式为 mp3 可选, 封面 url 也可选
- 音乐剪辑

```bash
musictool -clip 输入的文件 开始时间 结束时间
mk -c 输入的文件 开始时间 结束时间
```

> tips: 时间格式为: 00:00:00
- 音乐伴奏提取

```bash
musictool -extract 输入的文件
mk -e 输入的文件
```
File renamed without changes.
19 changes: 12 additions & 7 deletions mtk/__main__.py → mk/__main__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# !/usr/bin/env python3

import sys
import requests
from mtk.mp3_util import MP3
from mk.mp3_util import MP3
from yt_dlp import YoutubeDL

# 提取yt_dlp信息
Expand Down Expand Up @@ -48,6 +47,11 @@ def download(url:str,title:str=None,cover_url:str=None):
mp3.add_title(title)
if cover_url != None:
mp3.add_cover(cover_url)
else:
info = extract_info(url)
if 'thumbnail' in info:
thumbnail = info['thumbnail']
mp3.add_cover(thumbnail)
mp3.save()
else:
info = extract_info(url)
Expand All @@ -57,8 +61,9 @@ def download(url:str,title:str=None,cover_url:str=None):
if cover_url != None:
mp3.add_cover(cover_url)
else:
thumbnail = info['thumbnail']
mp3.add_cover(thumbnail)
if 'thumbnail' in info:
thumbnail = info['thumbnail']
mp3.add_cover(thumbnail)
mp3.save()

print('下载完成!')
Expand All @@ -80,9 +85,9 @@ def main(args=None):
if len(args) == 0:
print('configuration:\n\n'
'---------------------------------------------\n'+
'下载: musictool url [title] [cover_url]\n'+
'剪辑: musictool -clip path start end\n'
'提取伴奏: musictool -extract path\n'
'下载: mk url [title] [cover_url]\n'+
'剪辑: mk -c path start end\n'
'提取伴奏: mk -e path\n'
'---------------------------------------------\n'
)
return
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='music-tool-kit',
version='0.0.9',
version='0.1.1',
description='A tool kit for music download and clip',
long_description_content_type='text/markdown',
long_description=readme,
Expand All @@ -18,6 +18,7 @@
license='MIT',
platforms='any',
keywords=[
'mk'
'mtk'
'music',
'musictool',
Expand All @@ -28,13 +29,13 @@
],
packages=find_packages(exclude=['tests']),
package_data={
'mtk': ['*.txt'],
'mk': ['*.txt'],
},
require_python='>=3.8',
install_requires=requirements,
entry_points={
'console_scripts': [
'musictool = mtk.__main__:main',
'mk = mk.__main__:main',
]
},
classifiers=[
Expand Down

0 comments on commit 47098a7

Please sign in to comment.