def selectSongAction(self, danmu):
        self.log.info('%s 点歌 [%s]' % (danmu['name'], danmu['command']))

        command = danmu['command']
        song = []
        # 按歌曲名-歌手点歌
        if command.find('-') != -1:
            detail = command.split('-')
            if len(detail) == 2:
                song = self.musicDownloader.searchSingle(detail[0], detail[1])
            else:
                # 查询失败
                song = {}
                pass
        # 直接按歌曲名点歌
        else:
            song = self.musicDownloader.searchSingle(danmu['command'])

        if song:
            self.danmu.send('%s点歌成功' % song['name'])
            DownloadQueue.put({
                    'type': 'music',
                    'id': song['id'],
                    'name': song['name'],
                    'singer': song['singer'],
                    'username': danmu['name']
                })
        else:
            # 未找到歌曲
            self.danmu.send('找不到%s' % danmu['command'])
            self.log.info('找不到%s' % danmu['command'])
            pass
 def run(self):
     try:
         # 判断队列是否为空
         if DownloadQueue.empty():
             return
         # 获取新的下载任务
         task = DownloadQueue.get()
         if task and 'type' in task:
             self.download(task)
             PlayQueue.put(task)
             self.log.info('播放列表+1')
     except Exception as e:
         self.log.error(e)
Exemple #3
0
    def run(self):
        try:
            # 判断队列是否为空
            if DownloadQueue.empty():
                return

            # 获取新的下载任务
            task = DownloadQueue.get()
            if task and 'type' in task:
                if task['type'] == 'music':
                    self.musicDownload(task)
                elif task['type'] == 'vedio':
                    pass
        except Exception as e:
            self.log.error(e)
            pass
 def selectSongByIdAction(self, danmu):
     command = danmu['command']
     try:
         song = self.musicDownloader.getInfo(command)
         if song:
             self.danmu.send('%s点歌成功' % song['name'])
             DownloadQueue.put({
                     'type': 'music',
                     'id': song['id'],
                     'name': song['name'],
                     'singer': song['singer'],
                     'username': danmu['name']
                 })
         else:
             # 未找到歌曲
             raise Exception('未找到歌曲')
     except Exception as e:
         self.danmu.send('找不到%s' % danmu['command'])
         self.log.info('找不到%s' % danmu['command'])
 def selectSongByIdAction(self, danmu):
     self.log.info('%s ID [%s]' % (danmu['name'], danmu['command']))
     command = danmu['command']
     try:
         song = self.neteaseMusic.getInfo(command)
         if song:
             self.danmu.send('%s点歌成功' % song['name'])
             DownloadQueue.put({
                 'type': 'id',
                 'info': song,
                 'username': danmu['name'],
                 'time': danmu['time']
             })
         else:
             # 未找到歌曲
             raise Exception('未找到歌曲')
     except Exception as e:
         self.danmu.send('找不到%s' % danmu['command'])
         self.log.info('找不到%s' % danmu['command'])
 def selectMvByIdAction(self, danmu):
     self.log.info('%s MV [%s]' % (danmu['name'], danmu['command']))
     command = danmu['command']
     try:
         mv = self.neteaseMusic.getMv(command)
         if mv:
             self.danmu.send('%s点播成功' % mv['name'])
             DownloadQueue.put({
                 'type': 'mv',
                 'info': mv,
                 'username': danmu['name'],
                 'time': danmu['time']
             })
         else:
             # 未找到歌曲
             raise Exception('未找到MV')
     except Exception as e:
         self.danmu.send('找不到%s' % danmu['command'])
         self.log.info('找不到%s' % danmu['command'])
Exemple #7
0
    def run(self):
        try:
            # 判断队列是否为空
            if DownloadQueue.empty():
                return

            # 获取新的下载任务
            task = DownloadQueue.get()
            if task and 'type' in task:
                if task['type'] == 'music':
                    self.musicDownload(task)
                elif task['type'] == 'vedio':
                    pass
                #酷我音乐
                elif task['type'] == 'kuwo':
                    self.kuwoMusicDownload(task)
        except Exception as e:
            self.log.error(e)
            traceback.print_exc()
            pass
Exemple #8
0
    def order_song(self, danmu):
        """点歌台"""
        # 如果命令全为数字,跳转到id点歌
        if danmu['command'].isdigit():
            song = self._order_song_id(danmu)
        # 否则按照歌名点歌
        else:
            song = self._order_song_name(danmu)

        if song:
            self.danmu.send('%s 点歌成功' % song['name'])
            DownloadQueue.put({
                    'type': 'music',
                    'id': song['id'],
                    'name': song['name'],
                    'singer': song['ar'][0]['name'],
                    'username': danmu['name']
            })
        else:
            self.danmu.send('找不到%s' % danmu['command'])
            self.log.info('找不到%s' % danmu['command'])
Exemple #9
0
    def selectSongKuwoAction(self, danmu):
        self.log.info('%s 点歌 [%s]' % (danmu['name'], danmu['command']))

        command = danmu['command']

        # 按歌曲名点歌
        song = self.kuwoDownloader.getInfo(self.kuwoDownloader.search(command))

        if song:
            self.danmu.send('%s点歌成功' % song['name'])
            DownloadQueue.put({
                'type': 'kuwo',
                'id': song['id'],
                'name': song['name'],
                'singer': song['singer'],
                'username': danmu['name']
            })
        else:
            # 未找到歌曲
            self.danmu.send('找不到%s' % danmu['command'])
            self.log.info('找不到%s' % danmu['command'])