mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Code adapted to the new interface of stf-device-db.
This commit is contained in:
parent
f741136aed
commit
760e09290f
5 changed files with 11 additions and 5 deletions
|
@ -14,22 +14,23 @@ var datautil = module.exports = Object.create(null)
|
|||
|
||||
datautil.applyData = function(device) {
|
||||
var model = device.model
|
||||
var name = device.name
|
||||
|
||||
if (model) {
|
||||
var match = deviceData[model]
|
||||
var match = deviceData.find({model: model, name: name})
|
||||
|
||||
if (!match) {
|
||||
if (aliases[model]) {
|
||||
match = deviceData[aliases[model]]
|
||||
match = deviceData.find({model: aliases[model], name: name})
|
||||
}
|
||||
else {
|
||||
if (!match) {
|
||||
model = model.replace(/ /g, '_')
|
||||
match = deviceData[model]
|
||||
match = deviceData.find({model: model, name: name})
|
||||
|
||||
if (!match) {
|
||||
model = model.replace(/_/g, '')
|
||||
match = deviceData[model]
|
||||
match = deviceData.find({model: model, name: name})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +38,7 @@ datautil.applyData = function(device) {
|
|||
|
||||
if (match) {
|
||||
device.name = match.name.id
|
||||
device.model = match.name.long
|
||||
device.releasedAt = match.date
|
||||
device.image = model + '.jpg' // TODO: check for icon/photo file existence
|
||||
device.cpu = match.cpu
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue