Skip to content

Patch 2025.04.2#21231

Merged
PopeyeTheSai10r merged 24 commits into
masterfrom
patch-2025.04.2
Apr 23, 2025
Merged

Patch 2025.04.2#21231
PopeyeTheSai10r merged 24 commits into
masterfrom
patch-2025.04.2

Conversation

@freearhey
Copy link
Copy Markdown
Collaborator

@freearhey freearhey commented Apr 16, 2025

Added a new script playlist:edit which should speed up the process of marking up links in playlists.

Example:

npm run playlist:edit streams/cn.m3u

> playlist:edit
> tsx scripts/commands/playlist/edit.ts streams/cn.m3u

loading data from api...
loading streams...
found 768 streams (including 455 without ID)
creating search index...
starting...

...
? Select channel ID for "云南卫视" (https://hwapi.yunshicloud.com/8xughf/e0bx15.m3u8): (Use arrow keys)
❯ YunnanSatelliteTV.cn (Yunnan Satellite TV, 云南卫视)
  Type...
  Skip

Test results:

npm test

> test
> jest --runInBand

 PASS  tests/commands/playlist/test.test.ts (8.436 s)
 PASS  tests/commands/playlist/format.test.ts (5.024 s)
 PASS  tests/commands/report/create.test.ts
 PASS  tests/commands/playlist/validate.test.ts
 PASS  tests/commands/playlist/generate.test.ts
 PASS  tests/commands/playlist/edit.test.ts
 PASS  tests/commands/playlist/update.test.ts
 PASS  tests/commands/readme/update.test.ts
 PASS  tests/commands/api/generate.test.ts

Test Suites: 9 passed, 9 total
Tests:       10 passed, 10 total
Snapshots:   0 total
Time:        27.31 s
Ran all test suites.

Test results (Windows 10 via VM):

npm test

> test
> jest --runInBand

 PASS  tests/commands/playlist/test.test.ts (15.139 s)
 PASS  tests/commands/playlist/format.test.ts (8.155 s)
 PASS  tests/commands/playlist/validate.test.ts (6.234 s)
 PASS  tests/commands/playlist/generate.test.ts
 PASS  tests/commands/playlist/edit.test.ts
 PASS  tests/commands/playlist/update.test.ts
 PASS  tests/commands/report/create.test.ts
 PASS  tests/commands/api/generate.test.ts
 PASS  tests/commands/readme/update.test.ts

Test Suites: 9 passed, 9 total
Tests:       10 passed, 10 total
Snapshots:   0 total
Time:        49.373 s
Ran all test suites.

@freearhey freearhey mentioned this pull request Apr 17, 2025
@PopeyeTheSai10r
Copy link
Copy Markdown
Contributor

Some of the tests are not passing on my windows vm.

 FAIL  tests/commands/api/generate.test.ts
  ● can create streams.json

    Command failed: DATA_DIR=tests/__data__/input/data STREAMS_DIR=tests/__data__/input/api_generate API_DIR=tests/__data__/output/.api npm run api:generate
    'DATA_DIR' is not recognized as an internal or external command,
    operable program or batch file.

       7 |
       8 | it('can create streams.json', () => {
    >  9 |   execSync(
         |           ^
      10 |     'DATA_DIR=tests/__data__/input/data STREAMS_DIR=tests/__data__/input/api_generate API_DIR=tests/__data__/output/.api npm run api:generate',
      11 |     { encoding: 'utf8' }
      12 |   )

      at Object.<anonymous> (tests/commands/api/generate.test.ts:9:11)

'DATA_DIR' is not recognized as an internal or external command,
operable program or batch file.
 FAIL  tests/commands/readme/update.test.ts
  ● can update readme.md

    Command failed: DATA_DIR=tests/__data__/input/data LOGS_DIR=tests/__data__/input/readme_update README_DIR=tests/__data__/output/.readme npm run readme:update
    'DATA_DIR' is not recognized as an internal or external command,
    operable program or batch file.

      15 |   )
      16 |
    > 17 |   execSync(
         |           ^
      18 |     'DATA_DIR=tests/__data__/input/data LOGS_DIR=tests/__data__/input/readme_update README_DIR=tests/__data__/output/.readme npm run readme:update',
      19 |     { encoding: 'utf8' }
      20 |   )

      at Object.<anonymous> (tests/commands/readme/update.test.ts:17:11)

'ROOT_DIR' is not recognized as an internal or external command,
operable program or batch file.
 FAIL  tests/commands/playlist/test.test.ts
  ● shows an error if the playlist contains a broken link

    expect(received).toContain(expected) // indexOf

    Expected substring: "playlist_test/ag.m3u"
    Received string:    ""

      14 |   } catch (error) {
      15 |     expect((error as ExecError).status).toBe(1)
    > 16 |     expect((error as ExecError).stdout).toContain('playlist_test/ag.m3u')
         |                                         ^
      17 |     expect((error as ExecError).stdout).toContain('2 problems (1 errors, 1 warnings)')
      18 |   }
      19 | })

      at Object.<anonymous> (tests/commands/playlist/test.test.ts:16:41)

@freearhey freearhey marked this pull request as draft April 22, 2025 00:03
@freearhey freearhey marked this pull request as ready for review April 22, 2025 00:47
@freearhey
Copy link
Copy Markdown
Collaborator Author

@PopeyeTheSai10r Please check again, it should work now.

@PopeyeTheSai10r
Copy link
Copy Markdown
Contributor

Still running into some issues. The log is really long so I copied some snippets.

Logs
FAIL  tests/commands/playlist/format.test.ts (22.436 s)
 playlist:format  can format playlists

  ENOENT: no such file or directory, open 'C:\iptv\tests\__data__\output\streams\tests\__data__\expected\playlist_format\nl.m3u'

    33 |
    34 | function content(filepath: string) {
  > 35 |   return fs.readFileSync(`tests/__data__/${filepath}`, {
       |             ^
    36 |     encoding: 'utf8'
    37 |   })
    38 | }

    at content (tests/commands/playlist/format.test.ts:35:13)
    at tests/commands/playlist/format.test.ts:27:14
        at Array.forEach (<anonymous>)
    at Object.<anonymous> (tests/commands/playlist/format.test.ts:26:11)

FAIL  tests/commands/playlist/generate.test.ts (7.607 s)
● playlist:generate › can generate playlists and logs

  expect(received).toStrictEqual(expected) // deep equality

  - Expected  - 76
  + Received  + 76

    Array [
...
...
 FAIL  tests/commands/playlist/update.test.ts (7.4 s)
● playlist:update › can update playlists

  ENOENT: no such file or directory, open 'C:\iptv\tests\__data__\output\streams\tests\__data__\expected\playlist_update\us.m3u'

    38 |
    39 | function content(filepath: string) {
  > 40 |   return fs.readFileSync(`tests/__data__/${filepath}`, {
       |             ^
    41 |     encoding: 'utf8'
    42 |   })
    43 | }

    at content (tests/commands/playlist/update.test.ts:40:13)
    at tests/commands/playlist/update.test.ts:28:14
        at Array.forEach (<anonymous>)
    at Object.<anonymous> (tests/commands/playlist/update.test.ts:27:11)

FAIL  tests/commands/readme/update.test.ts (6.922 s)
● readme:update › can update readme.md

  expect(received).toEqual(expected) // deep equality

...
...
...
      30 |     if (process.env.DEBUG === 'true') console.log(cmd, stdout)
    31 |
  > 32 |     expect(content('tests/__data__/output/readme.md')).toEqual(
       |                                                        ^
    33 |       content('tests/__data__/expected/readme_update/_readme.md')
    34 |     )
    35 |   })

    at Object.<anonymous> (tests/commands/readme/update.test.ts:32:56)

FAIL  tests/commands/api/generate.test.ts
● api:generate › can create streams.json

  ENOENT: no such file or directory, open 'C:\iptv\tests\__data__\expected\api_generate\.api\streams.json'

    28 | function content(filepath: string) {
    29 |   return JSON.parse(
  > 30 |     fs.readFileSync(`tests/__data__/${filepath}`, {
       |        ^
    31 |       encoding: 'utf8'
    32 |     })
    33 |   )

    at content (tests/commands/api/generate.test.ts:30:8)
    at Object.<anonymous> (tests/commands/api/generate.test.ts:23:7)

PASS  tests/commands/playlist/test.test.ts (15.428 s)
PASS  tests/commands/playlist/validate.test.ts (12.566 s)
PASS  tests/commands/playlist/edit.test.ts (6.796 s)
PASS  tests/commands/report/create.test.ts (7.336 s)

Test Suites: 5 failed, 4 passed, 9 total
Tests:       5 failed, 5 passed, 10 total

@freearhey freearhey marked this pull request as draft April 22, 2025 17:41
@freearhey
Copy link
Copy Markdown
Collaborator Author

@PopeyeTheSai10r, thanks to you I've caught a lot of bugs. Hopefully everything will work fine now.

@freearhey freearhey marked this pull request as ready for review April 23, 2025 21:01
@PopeyeTheSai10r
Copy link
Copy Markdown
Contributor

All tests passed this time.

npm test

> test
> jest --runInBand

 PASS  tests/commands/playlist/format.test.ts (22.055 s)
 PASS  tests/commands/playlist/generate.test.ts (7.471 s)
 PASS  tests/commands/playlist/update.test.ts (6.587 s)
 PASS  tests/commands/readme/update.test.ts (6.739 s)
 PASS  tests/commands/api/generate.test.ts (6.734 s)
 PASS  tests/commands/playlist/test.test.ts (16.79 s)
 PASS  tests/commands/playlist/validate.test.ts (13.673 s)
 PASS  tests/commands/report/create.test.ts (6.791 s)
 PASS  tests/commands/playlist/edit.test.ts (9.873 s)

Test Suites: 9 passed, 9 total
Tests:       10 passed, 10 total
Snapshots:   0 total
Time:        97.546 s
Ran all test suites.

@PopeyeTheSai10r PopeyeTheSai10r merged commit cf93092 into master Apr 23, 2025
2 checks passed
@PopeyeTheSai10r PopeyeTheSai10r deleted the patch-2025.04.2 branch April 23, 2025 22:46
renanbazinin pushed a commit to renanbazinin/iptv that referenced this pull request May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants