UNPKG

mpd-avr-client

Version:
57 lines (50 loc) 2.27 kB
const { parse, join } = require('path'); const { root } = parse(process.cwd()); const mpdConfPath = join(root, 'etc', 'mpd.conf'); const mpdHost = 'localhost'; const mpdPortFallback = '6600'; const getRxRegExp = (hex) => new RegExp(`^TRAFFIC:\\s*\\[\\s*(\\d+)\\s*\\]\\s*>>\\s*${hex}\\s*`, 'im'); const scancodeRegex = /^Event:.* value (.+)$/gm; const tvLaunchProfileTypeTvTypeMap = /** @type {Map<TvLaunchProfileType, TvType>} */ new Map(); tvLaunchProfileTypeTvTypeMap.set('braviaLaunchProfile', 'BRAVIA'); const ledLaunchProfileTypeLedTypeMap = /** @type {Map<LedLaunchProfileType, LedType>} */ new Map(); ledLaunchProfileTypeLedTypeMap.set('goveeLaunchProfile', 'GOVEE'); module.exports = { mpdConfPath, mpdHost, mpdPortFallback, avrRequestDisplayNameRegExp: getRxRegExp('51:46'), avrTurnOnRegExp: getRxRegExp('5f:72:01'), avrStandByRegExp: getRxRegExp('5f:72:00'), avrIsOnRegExp: getRxRegExp('51:90:00'), avrIsStandByRegExp: getRxRegExp('51:90:01'), arrowUpKeyupRegExp: getRxRegExp('51:44:01'), arrowDownKeyupRegExp: getRxRegExp('51:44:02'), arrowLeftKeyupRegExp: getRxRegExp('51:44:03'), arrowRightKeyupRegExp: getRxRegExp('51:44:04'), enterKeyupRegExp: getRxRegExp('51:44:00'), returnKeyupRegExp: getRxRegExp('51:44:0d'), playKeyupRegExp: getRxRegExp('51:44:44'), pauseKeyupRegExp: getRxRegExp('51:44:46'), stopKeyupRegExp: getRxRegExp('51:44:45'), nextKeyupRegExp: getRxRegExp('51:44:4b'), previousKeyupRegExp: getRxRegExp('51:44:4c'), redFunctionKeyupRegExp: getRxRegExp('51:44:72'), greenFunctionKeyupRegExp: getRxRegExp('51:44:73'), yellowFunctionKeyupRegExp: getRxRegExp('51:44:74'), blueFunctionKeyupRegExp: getRxRegExp('51:44:71'), volumeStatusRegExp: getRxRegExp('(51:7A:)((?:[0-9a-fA-F]{2}:?)+)'), mpdPortSettingRegExp: /^port.*"([^"]+)"/, // MPD port playlistFoldersBasePathSettingRegExp: /^music_directory.*"([^"]+)"/, // path to a directory that contains song folders playlistFilesBasePathSettingRegExp: /^playlist_directory.*"([^"]+)"/, // path to a directory that contains .m3u playlist files playOrPauseRegExp: /(play|pause)/i, playRegExp: /play/i, pauseRegExp: /pause/i, stopRegExp: /stop/i, scancodeRegex, tvLaunchProfileTypeTvTypeMap, ledLaunchProfileTypeLedTypeMap, };