def setFileStaticInfoView(): l = globalVars.app.hMainView.shadowList if globalVars.eventProcess.playingList == constants.PLAYLIST: t = listManager.getTuple(constants.PLAYLIST) else: t = globalVars.listInfo.playingTmp l.SetString(0, _("ファイル名") + ":" + t[constants.ITEM_NAME]) l.SetString(1, _("場所") + ":" + t[constants.ITEM_PATH]) l.SetString(2, _("タイトル") + ":" + t[constants.ITEM_TITLE]) l.SetString(3, _("アルバム") + ":" + t[constants.ITEM_ALBUM]) l.SetString(4, _("アーティスト") + ":" + t[constants.ITEM_ARTIST]) l.SetString(5, _("アルバムアーティスト") + ":" + t[constants.ITEM_ALBUMARTIST]) if t[constants.ITEM_LENGTH] == None: length = "" else: hour = t[constants.ITEM_LENGTH] // 3600 min = (t[constants.ITEM_LENGTH] - hour * 3600) // 60 sec = t[constants.ITEM_LENGTH] - hour * 3600 - min * 60 if hour == 0: sHour = "" else: sHour = str(int(hour)) + _("時間") + " " if min == 0: sMin = "" else: sMin = str(int(min)) + _("分") + " " if sec == 0: sSec = "" else: sSec = str(int(sec)) + _("秒") length = sHour + sMin + sSec l.SetString(6, _("合計") + ":" + length) if t[constants.ITEM_TITLE] != "": globalVars.app.hMainView.hFrame.SetTitle("LAMP - " + str(t[constants.ITEM_TITLE])) else: globalVars.app.hMainView.hFrame.SetTitle("LAMP - " + str(t[constants.ITEM_NAME]))
def play(self, listPorQ=constants.PLAYLIST): if not globalVars.play.isDeviceOk(): return False #デバイス異常時は処理を中止 if globalVars.play.getStatus() == PLAYER_STATUS_DEVICEERROR: return False t = listManager.getTuple(listPorQ, True) if listPorQ == constants.QUEUE: globalVars.listInfo.playingTmp = t #キュー再生の時はタプルを一時退避 sc = None if re.search("https?://.+\..+", t[constants.ITEM_PATH]) != None: #URLの場合は中にURLがないか確認 sc = self.inUrlCheck(t[constants.ITEM_PATH]) if sc == None: sc = t[constants.ITEM_PATH] if globalVars.play.setSource(sc): ret = globalVars.play.play() else: ret = False if ret: self.errorSkipCount = 0 #エラースキップのカウンタをリセット self.playingList = listPorQ if ret: view_manager.buttonSetPause() listManager.setTag(listPorQ) globalVars.app.hMainView.menu.hFunctionMenu.Enable( menuItemsStore.getRef("ABOUT_PLAYING"), True) self.refreshTagInfo() globalVars.app.hMainView.tagInfoTimer.Start(10000) view_manager.setFileStaticInfoView() #スクリーンリーダ用リストとウィンドウ情報更新 if not ret: view_manager.buttonSetPlay() globalVars.app.hMainView.menu.hFunctionMenu.Enable( menuItemsStore.getRef("ABOUT_PLAYING"), False) view_manager.clearStaticInfoView() #スクリーンリーダ用リストとウィンドウ情報更新 view_manager.changeListLabel(globalVars.app.hMainView.playlistView) view_manager.changeListLabel(globalVars.app.hMainView.queueView) return ret
def setFileInfo(self): if globalVars.eventProcess.playingList == constants.PLAYLIST: t = listManager.getTuple(constants.PLAYLIST) else: t = globalVars.listInfo.playingTmp if t[constants.ITEM_TITLE] == "": self.fileInfo = [t[constants.ITEM_NAME]] else: self.fileInfo = [t[constants.ITEM_TITLE]] self.fileInfo += [ t[constants.ITEM_PATH], t[constants.ITEM_ARTIST], t[constants.ITEM_ALBUM], t[constants.ITEM_ALBUMARTIST] ] if t[constants.ITEM_LENGTH] == None: self.fileInfo.append(0) else: self.fileInfo.append(t[constants.ITEM_LENGTH])
def refreshTagInfo(self, evt=None): if evt == None: self.tagInfoProcess = 0 if self.playingList == None: globalVars.app.hMainView.viewTitle.SetLabel("") globalVars.app.hMainView.viewTagInfo.SetLabel("") else: if self.playingList == constants.PLAYLIST: t = listManager.getTuple(constants.PLAYLIST) else: t = globalVars.listInfo.playingTmp try: if t[constants.ITEM_TITLE] == "": title = t[constants.ITEM_NAME] # ファイル名 else: title = t[constants.ITEM_TITLE] # タイトル except IndexError: title = "" if self.tagInfoProcess == 0: # アルバム名表示 try: if t[constants.ITEM_ALBUM] == "": album = _("情報なし") else: album = t[constants.ITEM_ALBUM] except IndexError: album = "" globalVars.app.hMainView.viewTitle.SetLabel(title) globalVars.app.hMainView.viewTagInfo.SetLabel("💿 " + album) self.tagInfoProcess = 1 elif self.tagInfoProcess == 1: # アーティスト情報表示 try: if t[constants.ITEM_ARTIST] == "": artist = _("情報なし") else: artist = t[constants.ITEM_ARTIST] except IndexError: artist = "" globalVars.app.hMainView.viewTitle.SetLabel(title) globalVars.app.hMainView.viewTagInfo.SetLabel("👤 " + artist) self.tagInfoProcess = 2 elif self.tagInfoProcess == 2: # アルバムアーティスト表示 try: if t[constants.ITEM_ALBUMARTIST] == "": albumArtist = _("情報なし") else: albumArtist = t[constants.ITEM_ALBUMARTIST] except IndexError: albumArtist = "" globalVars.app.hMainView.viewTitle.SetLabel(title) globalVars.app.hMainView.viewTagInfo.SetLabel("💿👤 " + albumArtist) self.tagInfoProcess = 0
def OnMenuSelect(self, event): """メニュー項目が選択されたときのイベントハンドら。""" #ショートカットキーが無効状態のときは何もしない if not self.parent.shortcutEnable: event.Skip() return selected = event.GetId() #メニュー識別しの数値が出る if selected == menuItemsStore.getRef("FILE_OPEN"): d = views.mkOpenDialog.Dialog("fileOpenDialog") d.Initialize(0) #0=ファイルダイアログ rtnCode = d.Show() if rtnCode == d.PLAYLIST: listManager.addItems([d.GetValue()], globalVars.app.hMainView.playlistView) elif rtnCode == d.QUEUE: listManager.addItems([d.GetValue()], globalVars.app.hMainView.queueView) else: return elif selected == menuItemsStore.getRef("DIR_OPEN"): d = views.mkOpenDialog.Dialog("directoryOpenDialog") d.Initialize(1) #1=フォルダダイアログ rtnCode = d.Show() if rtnCode == d.PLAYLIST: listManager.addItems([d.GetValue()], globalVars.app.hMainView.playlistView) elif rtnCode == d.QUEUE: listManager.addItems([d.GetValue()], globalVars.app.hMainView.queueView) else: return elif selected == menuItemsStore.getRef("URL_OPEN"): d = views.mkOpenDialog.Dialog("urlOpenDialog") d.Initialize(2) #2=URLダイアログ rtnCode = d.Show() if rtnCode == d.PLAYLIST: listManager.addItems([d.GetValue()], globalVars.app.hMainView.playlistView) elif rtnCode == d.QUEUE: listManager.addItems([d.GetValue()], globalVars.app.hMainView.queueView) else: return elif selected == menuItemsStore.getRef("M3U_OPEN"): m3uManager.loadM3u() elif selected == menuItemsStore.getRef("NEW_M3U8_SAVE"): m3uManager.saveM3u8() elif selected == menuItemsStore.getRef("M3U8_SAVE"): m3uManager.saveM3u8(globalVars.listInfo.playlistFile) elif selected == menuItemsStore.getRef("M3U_ADD"): m3uManager.loadM3u(None, m3uManager.ADD) elif selected == menuItemsStore.getRef("M3U_CLOSE"): m3uManager.closeM3u() elif selected == menuItemsStore.getRef("EXIT"): self.parent.hFrame.Close() #機能メニューのイベント elif selected >= constants.FILTER_LIST_MENU and selected < constants.FILTER_LIST_MENU + 500: globalVars.filter.get(selected - constants.FILTER_LIST_MENU).setEnable( event.IsChecked()) elif selected == menuItemsStore.getRef("FILTER_SETTING"): d = filterSettingDialog.Dialog(*globalVars.filter.getDic()) d.Initialize() if d.Show() == wx.ID_CANCEL: return globalVars.filter.loadDic(*d.GetValue()) elif selected == menuItemsStore.getRef("SET_SLEEPTIMER"): globalVars.sleepTimer.set() elif selected == menuItemsStore.getRef("SET_EFFECTOR"): effector.effector() elif selected == menuItemsStore.getRef("SET_CURSOR_PLAYING"): if globalVars.eventProcess.playingList == constants.PLAYLIST: p = self.parent.playlistView p.Focus(p.getPointer()) p.Select(-1, 0) p.Select(p.getPointer()) else: globalVars.app.hMainView.notification.show( _("プレイリスト上の項目を再生していません。"), 2) elif selected == menuItemsStore.getRef("ABOUT_PLAYING"): if globalVars.eventProcess.playingList == constants.PLAYLIST: listManager.infoDialog(listManager.getTuple( constants.PLAYLIST)) else: listManager.infoDialog(globalVars.listInfo.playingTmp) elif selected == menuItemsStore.getRef("SHOW_NET_CONTROLLER"): globalVars.lampController.showController() elif selected == menuItemsStore.getRef("SHOW_NET_FILE_MANAGER"): netFileManager.run() # 操作メニューのイベント elif selected == menuItemsStore.getRef("PLAY_PAUSE"): globalVars.eventProcess.playButtonControl() elif selected == menuItemsStore.getRef("STOP"): globalVars.eventProcess.stop() elif selected == menuItemsStore.getRef("PREVIOUS_TRACK"): globalVars.eventProcess.previousBtn() elif selected == menuItemsStore.getRef("NEXT_TRACK"): globalVars.eventProcess.nextFile(button=True) elif selected == menuItemsStore.getRef("VOLUME_100"): globalVars.eventProcess.changeVolume(vol=100) elif selected == menuItemsStore.getRef("VOLUME_UP"): globalVars.eventProcess.changeVolume(+1) elif selected == menuItemsStore.getRef("VOLUME_DOWN"): globalVars.eventProcess.changeVolume(-1) elif selected == menuItemsStore.getRef("MUTE"): globalVars.eventProcess.mute() elif selected == menuItemsStore.getRef("FAST_FORWARD"): globalVars.play.fastForward() elif selected == menuItemsStore.getRef("REWIND"): globalVars.play.rewind() elif selected == menuItemsStore.getRef("SAY_TIME"): pos = globalVars.play.getPosition() if pos == -1: time = _("情報がありません") else: hour = pos // 3600 min = (pos - hour * 3600) // 60 sec = int(pos - hour * 3600 - min * 60) if hour == 0: sHour = "" else: sHour = str(int(hour)) + _("時間") + " " if min == 0: sMin = "" else: sMin = str(int(min)) + _("分") + " " time = sHour + sMin + str(int(sec)) + _("秒") globalVars.app.say(time) elif selected == menuItemsStore.getRef("SKIP"): globalVars.eventProcess.skip(settings.getSkipInterval()[0]) elif selected == menuItemsStore.getRef("REVERSE_SKIP"): globalVars.eventProcess.skip(settings.getSkipInterval()[0], False) elif selected == menuItemsStore.getRef("SKIP_INTERVAL_INCREASE"): globalVars.eventProcess.setSkipInterval() elif selected == menuItemsStore.getRef("SKIP_INTERVAL_DECREASE"): globalVars.eventProcess.setSkipInterval(False) elif selected == menuItemsStore.getRef("REPEAT_LOOP"): globalVars.eventProcess.repeatLoopCtrl() elif selected == menuItemsStore.getRef("REPEAT_LOOP_NONE"): globalVars.eventProcess.repeatLoopCtrl(0) elif selected == menuItemsStore.getRef("RL_REPEAT"): globalVars.eventProcess.repeatLoopCtrl(1) elif selected == menuItemsStore.getRef("RL_LOOP"): globalVars.eventProcess.repeatLoopCtrl(2) elif selected == menuItemsStore.getRef("SHUFFLE"): globalVars.eventProcess.shuffleSw() elif selected == menuItemsStore.getRef("MANUAL_SONG_FEED"): globalVars.eventProcess.setSongFeed() elif selected >= constants.DEVICE_LIST_MENU and selected < constants.DEVICE_LIST_MENU + 500: if selected == constants.DEVICE_LIST_MENU: globalVars.play.setDevice(PLAYER_DEFAULT_SPEAKER) else: globalVars.play.setDevice(selected - constants.DEVICE_LIST_MENU) elif selected >= constants.PLAYLIST_HISTORY and selected < constants.PLAYLIST_HISTORY + 20: m3uManager.loadM3u( globalVars.m3uHistory.getList()[selected - constants.PLAYLIST_HISTORY]) elif selected == menuItemsStore.getRef("SET_STARTUPLIST"): startupListSetter.run() elif selected == menuItemsStore.getRef("FILE_ASSOCIATE"): fileAssocDialog.assocDialog() elif selected == menuItemsStore.getRef("SET_SENDTO"): sendToManager.sendToCtrl("LAMP") elif selected == menuItemsStore.getRef("SET_KEYMAP"): if self.setKeymap("MainView", _("ショートカットキーの設定"), filter=keymap.KeyFilter().SetDefault( False, False)): #ショートカットキーの変更適用とメニューバーの再描画 self.parent.menu.InitShortcut() self.parent.menu.ApplyShortcut(self.parent.hFrame) self.parent.menu.Apply(self.parent.hFrame) elif selected == menuItemsStore.getRef("SET_HOTKEY"): if self.setKeymap("HOTKEY", _("グローバルホットキーの設定"), self.parent.hotkey, filter=self.parent.hotkey.filter): #変更適用 self.parent.hotkey.UnSet("HOTKEY", self.parent.hFrame) self.parent.applyHotKey() elif selected == menuItemsStore.getRef("ENVIRONMENT"): d = setting_dialog.settingDialog("environment_dialog") d.Initialize() d.Show() elif selected == menuItemsStore.getRef("HELP"): if os.path.exists("./readme.txt"): subprocess.Popen("start ./readme.txt", shell=True) else: dialog(_("ヘルプ"), _("ヘルプファイルが見つかりません。")) elif selected == menuItemsStore.getRef("CHECK_UPDATE"): update.checkUpdate() elif selected == menuItemsStore.getRef("VERSION_INFO"): versionDialog.versionDialog()