修复NeteaseMusic同时点歌会变成同一首的bug

This commit is contained in:
TNTcraftHIM 2020-08-28 16:44:38 +08:00
parent c012a41435
commit 1b55fdaa3f
2 changed files with 5 additions and 15 deletions

View File

@ -282,10 +282,10 @@
}, },
{ {
"name": "neteasemusic", "name": "neteasemusic",
"version": "2.0", "version": "2.1",
"section": "daily", "section": "daily",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "22.6 kb", "size": "22.4 kb",
"supported": true, "supported": true,
"des-short": "网易云点歌", "des-short": "网易云点歌",
"des": "可以在线搜索并且快速点歌歌曲信息齐全支持直接回复点歌。命令nem。" "des": "可以在线搜索并且快速点歌歌曲信息齐全支持直接回复点歌。命令nem。"

View File

@ -14,19 +14,13 @@ from os.path import exists
from collections import defaultdict from collections import defaultdict
from telethon.tl.types import DocumentAttributeAudio from telethon.tl.types import DocumentAttributeAudio
songid = ''
name = ''
proxies = {}
proxynum = 0
@listener(is_plugin=True, outgoing=True, command="nem", @listener(is_plugin=True, outgoing=True, command="nem",
description="网易云搜/点歌。", description="网易云搜/点歌。",
parameters="<指令> <关键词>") parameters="<指令> <关键词>")
async def nem(context): async def nem(context):
global name proxies = {}
global songid proxynum = 0
global proxies
global proxynum
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063', headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","X-Real-IP": "223.252.199.66"} "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","X-Real-IP": "223.252.199.66"}
proxy=[{'http': 'http://music.lolico.me:39000', 'https': 'http://music.lolico.me:39000'},{'http': 'http://xbmmw.xyz:1001', 'https': 'http://xbmmw.xyz:1001'},{'http': 'http://aimer.one:2333', 'https': 'http://aimer.one:2333'}] proxy=[{'http': 'http://music.lolico.me:39000', 'https': 'http://music.lolico.me:39000'},{'http': 'http://xbmmw.xyz:1001', 'https': 'http://xbmmw.xyz:1001'},{'http': 'http://aimer.one:2333', 'https': 'http://aimer.one:2333'}]
@ -271,7 +265,6 @@ async def nem(context):
# 发送请求,获取下载链接 # 发送请求,获取下载链接
def get_real_url(self): def get_real_url(self):
global songid
# 输入歌曲song_id # 输入歌曲song_id
self.song_id = songid self.song_id = songid
# 获取data # 获取data
@ -298,8 +291,6 @@ async def nem(context):
return real_url return real_url
def download(self): def download(self):
global name
global proxies
# 获取下载链接 # 获取下载链接
real_url = self.get_real_url() real_url = self.get_real_url()
if real_url == '': if real_url == '':
@ -373,8 +364,7 @@ async def nem(context):
tag.album = info['album'] tag.album = info['album']
tag.images.remove('') tag.images.remove('')
tag.images.set(3, imagedata, "image/jpeg", u"Cover") tag.images.set(3, imagedata, "image/jpeg", u"Cover")
tag.save( tag.save(version=eyed3.id3.ID3_DEFAULT_VERSION, encoding='utf-8')
name, version=eyed3.id3.ID3_DEFAULT_VERSION, encoding='utf-8')
br = "" br = ""
if imported is True: if imported is True:
br = "#" + str(eyed3.mp3.Mp3AudioFile(name).info.bit_rate[1]) + "kbps " br = "#" + str(eyed3.mp3.Mp3AudioFile(name).info.bit_rate[1]) + "kbps "