def __init__(self, douban, history, keys): # 线程锁 self.lock_start = False # 播放锁,play之前需要加 self.lock_rate = False # 加心锁 self.lock_loop = False # 循环锁 self.lock_muted = False # 静音锁 self.lock_pause = True # 暂停锁 self.q = False # 退出 self.songtime = 0 # 歌曲时间 self.playingsong = None # 当前播放歌曲 # state 0 1 2 3 4 # main lrc help history quit self.state = 0 self.history = history self.douban = douban # default volume self._volume = douban.login_data['volume'] # player controler self._player_exit_event = threading.Event() self.player = player.MPlayer(self._player_exit_event, self._volume) # 快捷键配置 self.KEYS = keys # 桌面通知 self.noti = notification.Notify() # 存储歌曲信息 self.lines = self.douban.channels self._channel = self.douban.login_data['channel'] self.playingsong = None self.playlist = None self.find_lrc = False self.lrc_dict = {} # 歌词 super(Win, self).__init__(self.lines) self.TITLE += color_func(self.c['TITLE']['doubanfm'])(' Douban Fm ') self.TITLE += '\ ' + \ color_func(self.c['TITLE']['username'])(self.douban.login_data['user_name']) + \ ' >>\r' # 启动自动播放 self.markline = self.displayline = self._channel self.lock_start = True self.SUFFIX_SELECTED = '正在加载请稍后...' self.display() self.thread(self.play) # 播放控制 self.thread(self.watchdog) # 播放器守护线程 self.thread(self.display_time) # 时间显示 self.run()
def __init__(self, douban): # 线程锁 self.lock_start = False # 播放锁,play之前需要加 self.lock_rate = False # 加心锁 self.lock_loop = False # 循环锁 self.lock_muted = False # 静音锁 self.lock_pause = True # 暂停锁 self.q = False # 退出 self.songtime = 0 # 歌曲时间 self.playingsong = None # 当前播放歌曲 # state 0 1 2 3 4 # main lrc help history quit self.state = 0 self.history = config.get_history() self.douban = douban # default volume self._volume = douban.default_volume # player controler self._player_exit_event = threading.Event() self.player = player.MPlayer(self._player_exit_event, self._volume) # 快捷键配置 config.get_config(self.KEYS) self.TITLE += \ color_func(c['TITLE']['doubanfm'])(' Douban Fm ') \ if not self.douban.lastfm\ else color_func(c['TITLE']['doubanfm'])(' Last.fm ') self.TITLE += '\ ' + \ color_func(c['TITLE']['username'])(self.douban.user_name) + \ ' >>\r' # 桌面通知 self._tempdir = tempfile.mkdtemp() self.cover_file = None self.has_cover = False # 存储歌曲信息 self._lines = self.douban.channels self._channel = self.douban.default_channel self.playingsong = None self.playlist = None self.find_lrc = False self.lrc_dict = {} # 歌词 super(Win, self).__init__(self._lines) # 启动自动播放 self.markline = self.displayline = self._channel self.lock_start = True self.SUFFIX_SELECTED = '正在加载请稍后...' self.display() self.thread(self.play) # 播放控制 self.thread(self.watchdog) # 播放器守护线程 self.thread(self.display_time) # 时间显示 self.run()