Skip to content

Commit daa201b

Browse files
committed
Improved Roku devices parser.
Updated tests.
1 parent ebaf8d2 commit daa201b

File tree

5 files changed

+24
-20
lines changed

5 files changed

+24
-20
lines changed

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/mappings/devices.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,9 @@ public static function get() : array {
223223
'category' => 'tv',
224224
'kernel' => 'Linux',
225225
'platform' => 'Roku OS',
226-
'platformversion' => \mb_substr($value, 5),
226+
'platformversion' => $tokens[++$i] ?? null,
227227
'vendor' => 'Roku',
228-
'device' => 'Roku',
229-
'build' => $tokens[++$i] ?? null
228+
'device' => \mb_substr($value, 5)
230229
]),
231230
'AmigaOneX' => new props('start', fn (string $value) : array => [
232231
'type' => 'human',

src/mappings/platforms.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ public static function get() : array {
303303
[
304304
'type' => 'human',
305305
'category' => 'tv',
306-
'platform' => 'Roku',
306+
'kernel' => 'Linux',
307+
'platform' => 'Roku OS',
307308
'platformversion' => \mb_substr($value, 5),
308309
'app' => $app[0] ?? null,
309310
'appname' => $app[0] ?? null,

tests/devicesTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,9 @@ public function testTvs() : void {
655655
'category' => 'tv',
656656
'kernel' => 'Linux',
657657
'platform' => 'Roku OS',
658-
'platformversion' => 'DVP-12.0',
658+
'platformversion' => '12.0.0.4186-55',
659659
'vendor' => 'Roku',
660-
'device' => 'Roku',
661-
'build' => '12.0.0.4186-55'
660+
'device' => 'DVP-12.0'
662661
],
663662
'Mozilla/5.0 (Linux; Android 7.1.2; AFTMM) AppleWebKit/537.36 (KHTML, like Gecko) Silk/112.5.1 like Chrome/112.0.5615.213 Safari/537.36' => [
664663
'string' => 'Mozilla/5.0 (Linux; Android 7.1.2; AFTMM) AppleWebKit/537.36 (KHTML, like Gecko) Silk/112.5.1 like Chrome/112.0.5615.213 Safari/537.36',

tests/platformsTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,8 @@ public function testOther() : void {
15861586
'vendor' => 'TCL',
15871587
'model' => '32S3750',
15881588
'build' => '12221',
1589-
'platform' => 'Roku',
1589+
'kernel' => 'Linux',
1590+
'platform' => 'Roku OS',
15901591
'platformversion' => '14.0.4',
15911592
'language' => 'en-US',
15921593
'app' => 'Look & Cook',
@@ -1601,7 +1602,8 @@ public function testOther() : void {
16011602
'device' => 'Express',
16021603
'model' => '4K',
16031604
'build' => '12221',
1604-
'platform' => 'Roku',
1605+
'kernel' => 'Linux',
1606+
'platform' => 'Roku OS',
16051607
'platformversion' => '14.0.4',
16061608
'language' => 'en-US',
16071609
'app' => 'Just Dance',
@@ -1615,7 +1617,8 @@ public function testOther() : void {
16151617
'vendor' => 'Roku',
16161618
'model' => 'Express+',
16171619
'build' => '12221',
1618-
'platform' => 'Roku',
1620+
'kernel' => 'Linux',
1621+
'platform' => 'Roku OS',
16191622
'platformversion' => '14.0.4',
16201623
'language' => 'en-US',
16211624
'app' => 'Just Dance',
@@ -1629,7 +1632,8 @@ public function testOther() : void {
16291632
'vendor' => 'Westinghouse',
16301633
'model' => 'WR43UX4210',
16311634
'build' => '12221',
1632-
'platform' => 'Roku',
1635+
'kernel' => 'Linux',
1636+
'platform' => 'Roku OS',
16331637
'platformversion' => '14.0.4',
16341638
'language' => 'en-US',
16351639
'app' => 'Just Dance',
@@ -1643,7 +1647,8 @@ public function testOther() : void {
16431647
'vendor' => 'Hkpro',
16441648
'model' => 'HKP32R01',
16451649
'build' => '12221',
1646-
'platform' => 'Roku',
1650+
'kernel' => 'Linux',
1651+
'platform' => 'Roku OS',
16471652
'platformversion' => '14.0.4',
16481653
'language' => 'es-MX',
16491654
'app' => 'Just Dance',

0 commit comments

Comments
 (0)