@internetarchive/radio-player 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/package.json +2 -2
  2. package/.eslintrc +0 -37
  3. package/.gitignore +0 -11
  4. package/.storybook/.babelrc +0 -15
  5. package/.storybook/addons.js +0 -7
  6. package/.storybook/config.js +0 -11
  7. package/.storybook/webpack.config.js +0 -5
  8. package/demo/full-text-search-service.ts +0 -32
  9. package/demo/index.html +0 -53
  10. package/demo/radio-player-controller.ts +0 -237
  11. package/karma.bs.config.js +0 -16
  12. package/karma.conf.js +0 -66
  13. package/package-lock.json +0 -51719
  14. package/stories/index.stories.js +0 -40
  15. package/stories/transcript.js +0 -683
  16. package/test/assets/arrow.mp3 +0 -0
  17. package/test/music-zone.test.js +0 -13
  18. package/test/promised-sleep.js +0 -3
  19. package/test/radio-player-config.test.js +0 -42
  20. package/test/radio-player.test.js +0 -1072
  21. package/test/sample_transcript.js +0 -1493
  22. package/test/search-handler/search-backends/full-text-sample-response-brackets.js +0 -60
  23. package/test/search-handler/search-backends/full-text-sample-response-em.js +0 -60
  24. package/test/search-handler/search-backends/full-text-search-backend.test.js +0 -74
  25. package/test/search-handler/search-backends/full-text-search-response.test.js +0 -14
  26. package/test/search-handler/search-backends/local-search-backend.test.js +0 -39
  27. package/test/search-handler/search-handler.test.js +0 -550
  28. package/test/search-handler/search-helper.test.js +0 -63
  29. package/test/search-handler/search-model.test.js +0 -56
  30. package/test/search-handler/transcript-index.test.js +0 -66
  31. package/test/search-results-switcher.test.js +0 -97
  32. package/tsconfig.build.json +0 -7
  33. package/tsconfig.json +0 -21
  34. package/yarn.lock +0 -14450
@@ -1,60 +0,0 @@
1
- // this is an abridged response from the full text search server
2
- export default {
3
- success: true,
4
- value: {
5
- numFound: 1,
6
- start: 0,
7
- docs: [
8
- {
9
- identifier: 'KHNC_1360_AM_20180126_170000',
10
- title: 'KHNC 1360 AM [The Lion] : January 26, 2018 10:00AM-11:00AM MST',
11
- text: "Well good morning Colorado America and the ships at sea this is the freedom and\nliberty forum with the Freedom Rider Why do they call me the freedom rider because\nI have\na Harley Davidson I've raised motorcycles and I was $1273.00 now and I've got\na Harley that's painted up like the flag with see through lettering on it that says\nFree 30 isn't free and on both sides of the gas tank. Or the prime law of the\nUnited States the birth certificate of the United States of the birthright of every\nAmerican we hold these truths self-evident that all men are created equal endowed\nby their Creator with certain unalienable Rights that among these rights are life\nliberty pursuit of happiness and that to secure these rights governments are\ninstituted among men and that's what we talk about here the 4th part of that is\nthat of Government becomes destructive of these and it is the right of the People\nto alter and or abolish and replace that's the law and anything that means you've\ngot to replace the whole government no it doesn't we operate under\na system whereby we can replace We the People can replace individual members of\ngovernment. By ourselves outside of government why because sometimes\ngovernments get so in-grown and so protective of one another that you cannot get\nthat corruption out in government and that's what we're here to discuss what it is",
12
- times: '3.023,7.079,13.012,13.047,20.024,24.098,31.096,36,41.097,47.044,53.016,59.03,65.062,72.05,78.006,84.07,91.045,97.078',
13
- downloads: 2,
14
- collection: 'Radio-KHNC-1360-AM',
15
- highlight: {
16
- cc: [
17
- " secure these rights {{{governments}}} are\ninstituted among men and that's what we talk about here the 4th",
18
- ' part of that is\nthat of {{{Government}}} becomes destructive of these and it is the right of the People\nto',
19
- " whole {{{government}}} no it doesn't we operate under\na system whereby we can replace We the People can",
20
- ' replace individual members of\n{{{government}}}. By ourselves outside of {{{government}}} why because sometimes',
21
- '\n{{{governments}}} get so in-grown and so protective of one another that you cannot get\nthat corruption out in',
22
- ]
23
- },
24
- description: ' you can go after individuals in the federal <em>government</em> that\nhave captured the news personally I',
25
- mediatype: 'radio',
26
- __href__: '/details/KHNC_1360_AM_20180126_170000?start=3388.09&q=government',
27
- 'SE-BYPASS': 1
28
- }
29
- ],
30
- highlighting: {
31
- KHNC_1360_AM_20180126_170000: {
32
- text: [
33
- " secure these rights {{{governments}}} are\ninstituted among men and that's what we talk about here the 4th",
34
- ' part of that is\nthat of {{{Government}}} becomes destructive of these and it is the right of the People\nto',
35
- " whole {{{government}}} no it doesn't we operate under\na system whereby we can replace We the People can",
36
- ' replace individual members of\n{{{government}}}. By ourselves outside of {{{government}}} why because sometimes',
37
- '\n{{{governments}}} get so in-grown and so protective of one another that you cannot get\nthat corruption out in',
38
- ]
39
- }
40
- },
41
- facet_counts: {
42
- facet_fields: {
43
- languageSorter: {
44
- English: 1
45
- },
46
- year: {
47
- 2018: 1
48
- },
49
- subject: {
50
- 'American lawyers': 1,
51
- 'Business terms': 1
52
- },
53
- num_items: 1
54
- },
55
- facet_dates: {
56
- start: null
57
- }
58
- }
59
- }
60
- };
@@ -1,60 +0,0 @@
1
- // this is an abridged response from the full text search server
2
- export default {
3
- success: true,
4
- value: {
5
- numFound: 1,
6
- start: 0,
7
- docs: [
8
- {
9
- identifier: 'KHNC_1360_AM_20180126_170000',
10
- title: 'KHNC 1360 AM [The Lion] : January 26, 2018 10:00AM-11:00AM MST',
11
- text: "Well good morning Colorado America and the ships at sea this is the freedom and\nliberty forum with the Freedom Rider Why do they call me the freedom rider because\nI have\na Harley Davidson I've raised motorcycles and I was $1273.00 now and I've got\na Harley that's painted up like the flag with see through lettering on it that says\nFree 30 isn't free and on both sides of the gas tank. Or the prime law of the\nUnited States the birth certificate of the United States of the birthright of every\nAmerican we hold these truths self-evident that all men are created equal endowed\nby their Creator with certain unalienable Rights that among these rights are life\nliberty pursuit of happiness and that to secure these rights governments are\ninstituted among men and that's what we talk about here the 4th part of that is\nthat of Government becomes destructive of these and it is the right of the People\nto alter and or abolish and replace that's the law and anything that means you've\ngot to replace the whole government no it doesn't we operate under\na system whereby we can replace We the People can replace individual members of\ngovernment. By ourselves outside of government why because sometimes\ngovernments get so in-grown and so protective of one another that you cannot get\nthat corruption out in government and that's what we're here to discuss what it is",
12
- times: '3.023,7.079,13.012,13.047,20.024,24.098,31.096,36,41.097,47.044,53.016,59.03,65.062,72.05,78.006,84.07,91.045,97.078',
13
- downloads: 2,
14
- collection: 'Radio-KHNC-1360-AM',
15
- highlight: {
16
- cc: [
17
- " secure these rights <em>governments</em> are\ninstituted among men and that's what we talk about here the 4th",
18
- ' part of that is\nthat of <em>Government</em> becomes destructive of these and it is the right of the People\nto',
19
- " whole <em>government</em> no it doesn't we operate under\na system whereby we can replace We the People can",
20
- ' replace individual members of\n<em>government</em>. By ourselves outside of <em>government</em> why because sometimes',
21
- '\n<em>governments</em> get so in-grown and so protective of one another that you cannot get\nthat corruption out in',
22
- ]
23
- },
24
- description: ' you can go after individuals in the federal <em>government</em> that\nhave captured the news personally I',
25
- mediatype: 'radio',
26
- __href__: '/details/KHNC_1360_AM_20180126_170000?start=3388.09&q=government',
27
- 'SE-BYPASS': 1
28
- }
29
- ],
30
- highlighting: {
31
- KHNC_1360_AM_20180126_170000: {
32
- text: [
33
- " secure these rights <em>governments</em> are\ninstituted among men and that's what we talk about here the 4th",
34
- ' part of that is\nthat of <em>Government</em> becomes destructive of these and it is the right of the People\nto',
35
- " whole <em>government</em> no it doesn't we operate under\na system whereby we can replace We the People can",
36
- ' replace individual members of\n<em>government</em>. By ourselves outside of <em>government</em> why because sometimes',
37
- '\n<em>governments</em> get so in-grown and so protective of one another that you cannot get\nthat corruption out in',
38
- ]
39
- }
40
- },
41
- facet_counts: {
42
- facet_fields: {
43
- languageSorter: {
44
- English: 1
45
- },
46
- year: {
47
- 2018: 1
48
- },
49
- subject: {
50
- 'American lawyers': 1,
51
- 'Business terms': 1
52
- },
53
- num_items: 1
54
- },
55
- facet_dates: {
56
- start: null
57
- }
58
- }
59
- }
60
- };
@@ -1,74 +0,0 @@
1
- import { expect } from '@open-wc/testing';
2
-
3
- import { FullTextSearchBackend } from '../../../lib/src/search-handler/search-backends/full-text-search-backend/full-text-search-backend';
4
-
5
- import sampleResponseBrackets from './full-text-sample-response-brackets';
6
- import sampleResponseEms from './full-text-sample-response-em';
7
-
8
- class MockFullTextSearchServiceBrackets {
9
- searchRequested(query) {
10
- return new Promise(resolve => resolve(sampleResponseBrackets));
11
- }
12
- }
13
-
14
- class MockFullTextSearchServiceEmss {
15
- searchRequested(query) {
16
- return new Promise(resolve => resolve(sampleResponseEms));
17
- }
18
- }
19
-
20
- describe('Full Text Search Backend', () => {
21
- it('correctly finds search indices with default triple curly brackets', async () => {
22
- const searchService = new MockFullTextSearchServiceBrackets();
23
- const searchBackend = new FullTextSearchBackend(searchService);
24
-
25
- const searchIndices = await searchBackend.getSearchRanges('government');
26
-
27
- expect(searchIndices.length).to.equal(6);
28
-
29
- expect(searchIndices[0].startIndex).to.equal(719);
30
- expect(searchIndices[0].endIndex).to.equal(730);
31
-
32
- expect(searchIndices[1].startIndex).to.equal(823);
33
- expect(searchIndices[1].endIndex).to.equal(833);
34
-
35
- expect(searchIndices[2].startIndex).to.equal(1004);
36
- expect(searchIndices[2].endIndex).to.equal(1014);
37
-
38
- expect(searchIndices[3].startIndex).to.equal(1126);
39
- expect(searchIndices[3].endIndex).to.equal(1136);
40
-
41
- expect(searchIndices[4].startIndex).to.equal(1162);
42
- expect(searchIndices[4].endIndex).to.equal(1172);
43
-
44
- expect(searchIndices[5].startIndex).to.equal(1195);
45
- expect(searchIndices[5].endIndex).to.equal(1206);
46
- });
47
-
48
- it('correctly finds search indices with em tags', async () => {
49
- const searchService = new MockFullTextSearchServiceEmss();
50
- const searchBackend = new FullTextSearchBackend(searchService, '<em>', '</em>');
51
-
52
- const searchIndices = await searchBackend.getSearchRanges('government');
53
-
54
- expect(searchIndices.length).to.equal(6);
55
-
56
- expect(searchIndices[0].startIndex).to.equal(719);
57
- expect(searchIndices[0].endIndex).to.equal(730);
58
-
59
- expect(searchIndices[1].startIndex).to.equal(823);
60
- expect(searchIndices[1].endIndex).to.equal(833);
61
-
62
- expect(searchIndices[2].startIndex).to.equal(1004);
63
- expect(searchIndices[2].endIndex).to.equal(1014);
64
-
65
- expect(searchIndices[3].startIndex).to.equal(1126);
66
- expect(searchIndices[3].endIndex).to.equal(1136);
67
-
68
- expect(searchIndices[4].startIndex).to.equal(1162);
69
- expect(searchIndices[4].endIndex).to.equal(1172);
70
-
71
- expect(searchIndices[5].startIndex).to.equal(1195);
72
- expect(searchIndices[5].endIndex).to.equal(1206);
73
- });
74
- });
@@ -1,14 +0,0 @@
1
- import { expect } from '@open-wc/testing';
2
-
3
- import { FullTextSearchResponse } from '../../../lib/src/search-handler/search-backends/full-text-search-backend/full-text-search-response';
4
-
5
- import sampleResponse from './full-text-sample-response-brackets';
6
-
7
- describe('Full Text Search Response Models', () => {
8
- it('initialize properly from backend response', async () => {
9
- const response = new FullTextSearchResponse(sampleResponse);
10
- expect(response.success).to.be.true;
11
-
12
- expect(response.value.docs[0].identifier).to.equal('KHNC_1360_AM_20180126_170000');
13
- });
14
- });
@@ -1,39 +0,0 @@
1
- import {
2
- html, fixture, expect, oneEvent, elementUpdated
3
- } from '@open-wc/testing';
4
-
5
- import { TranscriptConfig, TranscriptEntryConfig } from '@internetarchive/transcript-view';
6
- import { LocalSearchBackend } from '../../../lib/src/search-handler/search-backends/local-search-backend/local-search-backend';
7
- import { TranscriptIndex } from '../../../lib/src/search-handler/transcript-index';
8
-
9
- describe('Local Search Backend', () => {
10
- it('correctly finds search indices', async () => {
11
- const entry1 = new TranscriptEntryConfig(1, 0, 4, 'foo bar baz', false);
12
- const entry2 = new TranscriptEntryConfig(2, 5, 9, 'boop blop', false);
13
- const entry3 = new TranscriptEntryConfig(3, 10, 13, 'bump baz boing', false);
14
- const transcriptConfig = new TranscriptConfig([entry1, entry2, entry3]);
15
- const transcriptIndex = new TranscriptIndex(transcriptConfig);
16
- const searchBackend = new LocalSearchBackend(transcriptIndex);
17
-
18
- const searchIndices = await searchBackend.getSearchRanges('baz');
19
-
20
- expect(searchIndices.length).to.equal(2);
21
- expect(searchIndices[0].startIndex).to.equal(8);
22
- expect(searchIndices[0].endIndex).to.equal(11);
23
- expect(searchIndices[1].startIndex).to.equal(27);
24
- expect(searchIndices[1].endIndex).to.equal(30);
25
- });
26
-
27
- it('correctly handles special characters', async () => {
28
- const entry1 = new TranscriptEntryConfig(1, 0, 4, 'foo bar baz', false);
29
- const entry2 = new TranscriptEntryConfig(2, 5, 9, 'boop blop', false);
30
- const entry3 = new TranscriptEntryConfig(3, 10, 13, 'bump baz boing', false);
31
- const transcriptConfig = new TranscriptConfig([entry1, entry2, entry3]);
32
- const transcriptIndex = new TranscriptIndex(transcriptConfig);
33
- const searchBackend = new LocalSearchBackend(transcriptIndex);
34
-
35
- const searchIndices = await searchBackend.getSearchRanges('baz|-.*');
36
-
37
- expect(searchIndices.length).to.equal(0);
38
- });
39
- });