自己刷抖音时训练的模型不行呀,推荐给我的都是一些沙雕视频,都是抠脚大汉,很少漂亮的小姐姐,但是自己刷抖音训练的话又太耗时间了,刚看看了 ADB ,发现这个简直就是宝库,想着就要不就使用 ADB 来帮我训练一下,省的我手动训练了。
关于 ADB,可以看我之前的文章,ADB 实用笔记
首先使用 Node.js 封装下 ADB 的命令,为了兼容连接多台设备的问题,可以使用一个标志位,同时每次使用的时候使用 use 方法来指定对应的设备,call 方法作为所有调用命令的基础方法:
const { exec } = require(‘child_process’)
const path = require(‘path’)
let currentDeviceName = ‘’
let isVerbose = false
const call = (code) => {
return new Promise((resolve, reject) => {
const command = adb ${currentDeviceName ?
-s ${currentDeviceName}: ''} ${code}
if (isVerbose) console.log(command, '\n')
exec(command, (err, stdout, stderr) => {
if (err) reject(new Error(err + ''))
resolve(stdout)
})
})
}
const use = (device) => currentDeviceName = device.name
const verbose = (value) => isVerbose = value
复制代码添加对应的设备查询方法,并通过解析字符串的形式来将设备保存为数组:
const rawDevices = () => call(‘devices’)
const devices = async () => {
return (await rawDevices())
.split(/\n/)
.map(line =