Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.username_label = QLabel()
self.password_label = QLabel()
self.hint_label = QLabel()
self.username_widget = QLineEdit()
self.password_widget = QLineEdit()
self.login_btn = QPushButton()
self.captcha_label = QLabel()
self.captcha_lineedit = QLineEdit()
self.layout = QVBoxLayout()
self.is_remember_chb = QCheckBox(u'记住账号')
self.nm = NetworkManager()
self.ne = ControllerApi.api
self.is_autofill = False
self.is_need_captcha = False
self.captcha_id = 0
self.user_data = 0
self.__set_signal_binding()
self.__set_widgets_prop()
self.__set_layouts_prop()
self.__set_me()
self.fill_content()
def set_playlists_options(self):
playlists = ControllerApi.api.get_user_playlist()
if not ControllerApi.api.is_response_ok(playlists):
return
self.playlists = playlists
self.menu.clear()
for playlist in playlists:
if ControllerApi.api.is_playlist_mine(playlist):
name = playlist['name']
pid = playlist['id']
action = QAction(name, self)
action.triggered.connect(partial(self.add_to_playlist, pid))
self.menu.addAction(action)
def set_playlist_item(self, playlist_model):
self.data = playlist_model
if ControllerApi.api.is_favorite_playlist(playlist_model):
self._icon_label.setObjectName('playlist_img_favorite')
else:
self._icon_label.setObjectName('playlist_img_mine')
metrics = QFontMetrics(self._text_btn.font())
text = metrics.elidedText(playlist_model['name'], Qt.ElideRight,
self._text_btn.width()-40)
self._text_btn.setText(text)
def play_mv_by_mvid(cls, mvid):
mv_model = ControllerApi.api.get_mv_detail(mvid)
if not ControllerApi.api.is_response_ok(mv_model):
return
url_middle = mv_model['url_middle']
clipboard = QApplication.clipboard()
clipboard.setText(url_middle)
cls.view.ui.STATUS_BAR.showMessage(
u"程序已经将视频的播放地址复制到剪切板", 5000)
if platform.system() == "Linux":
ControllerApi.player.pause()
ControllerApi.notify_widget.show_message(
"通知", "正在尝试调用VLC视频播放器播放MV")
try:
subprocess.Popen(['vlc', url_middle, '--play-and-exit', '-f'])
except:
def get_songs(cls):
songs = ControllerApi.api.get_radio_songs()
return songs if songs else []
def show_lyric_while_visible(self, ms):
"""给controller调用的函数"""
if self.isVisible():
if self.has_lyric():
self.sync_lyric(ms)
else:
lyric_model = ControllerApi.api.get_lyric_detail(ControllerApi.state['current_mid'])
if not ControllerApi.api.is_response_ok(lyric_model):
return
if lyric_model:
self.set_lyric(lyric_model)
self.sync_lyric(ms)
else:
self.setText(u'歌曲没有歌词')
def play_specific_song_by_mid(cls, mid):
song = ControllerApi.api.get_song_detail(mid)
if not ControllerApi.api.is_response_ok(song):
return False
ControllerApi.player.play(song)
return True
def get_songs(cls):
if ControllerApi.state['current_mid'] == 0:
ControllerApi.notify_widget.show_message("O.o", "无法寻找相似歌曲")
return []
songs = ControllerApi.api.get_simi_songs(ControllerApi.state['current_mid'])
return songs if songs else []