From 4cf08ccc9231665bcccd5000145225c2649dcd84 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 24 Sep 2016 22:12:42 -0700 Subject: [PATCH 01/10] add fix for missing attributes --- m3u/AttributeList.js | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/m3u/AttributeList.js b/m3u/AttributeList.js index e32b6d6..66f7ed9 100644 --- a/m3u/AttributeList.js +++ b/m3u/AttributeList.js @@ -4,24 +4,28 @@ var AttributeList = module.exports = function AttributeList(attributes) { }; var dataTypes = AttributeList.dataTypes = { - 'audio' : 'quoted-string', - 'autoselect' : 'boolean', - 'bandwidth' : 'decimal-integer', - 'byterange' : 'enumerated-string', - 'codecs' : 'quoted-string', - 'default' : 'boolean', - 'duration' : 'decimal-floating-point', - 'forced' : 'boolean', - 'group-id' : 'quoted-string', - 'language' : 'quoted-string', - 'name' : 'quoted-string', - 'program-id' : 'decimal-integer', - 'resolution' : 'decimal-resolution', - 'subtitles' : 'quoted-string', - 'title' : 'enumerated-string', - 'type' : 'enumerated-string', - 'uri' : 'quoted-string', - 'video' : 'quoted-string' + 'audio' : 'quoted-string', + 'average-bandwidth' : 'decimal-integer', + 'autoselect' : 'boolean', + 'bandwidth' : 'decimal-integer', + 'byterange' : 'enumerated-string', + 'closed-captions' : 'quoted-string', + 'codecs' : 'quoted-string', + 'default' : 'boolean', + 'duration' : 'decimal-floating-point', + 'forced' : 'boolean', + 'frame-rate' : 'decimal-floating-point', + 'group-id' : 'quoted-string', + 'instream-id' : 'quoted-string', + 'language' : 'quoted-string', + 'name' : 'quoted-string', + 'program-id' : 'decimal-integer', + 'resolution' : 'decimal-resolution', + 'subtitles' : 'quoted-string', + 'title' : 'enumerated-string', + 'type' : 'enumerated-string', + 'uri' : 'quoted-string', + 'video' : 'quoted-string' }; AttributeList.prototype.mergeAttributes = function mergeAttributes(attributes) { @@ -121,4 +125,4 @@ var parse = { console.error('Handling value:', value, ' for unknown key:', key); return value; } -}; \ No newline at end of file +}; From fca070d5dfc7d12ea8ffeb69a7bff96af47913ea Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 24 Sep 2016 22:31:12 -0700 Subject: [PATCH 02/10] fix tabbing --- m3u/AttributeList.js | 186 +++++++++++++++++++++---------------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/m3u/AttributeList.js b/m3u/AttributeList.js index 66f7ed9..eb5211c 100644 --- a/m3u/AttributeList.js +++ b/m3u/AttributeList.js @@ -1,128 +1,128 @@ var AttributeList = module.exports = function AttributeList(attributes) { - this.attributes = {}; - this.mergeAttributes(attributes); + this.attributes = {}; + this.mergeAttributes(attributes); }; var dataTypes = AttributeList.dataTypes = { - 'audio' : 'quoted-string', - 'average-bandwidth' : 'decimal-integer', - 'autoselect' : 'boolean', - 'bandwidth' : 'decimal-integer', - 'byterange' : 'enumerated-string', - 'closed-captions' : 'quoted-string', - 'codecs' : 'quoted-string', - 'default' : 'boolean', - 'duration' : 'decimal-floating-point', - 'forced' : 'boolean', - 'frame-rate' : 'decimal-floating-point', - 'group-id' : 'quoted-string', - 'instream-id' : 'quoted-string', - 'language' : 'quoted-string', - 'name' : 'quoted-string', - 'program-id' : 'decimal-integer', - 'resolution' : 'decimal-resolution', - 'subtitles' : 'quoted-string', - 'title' : 'enumerated-string', - 'type' : 'enumerated-string', - 'uri' : 'quoted-string', - 'video' : 'quoted-string' + 'audio' : 'quoted-string', + 'average-bandwidth' : 'decimal-integer', + 'autoselect' : 'boolean', + 'bandwidth' : 'decimal-integer', + 'byterange' : 'enumerated-string', + 'closed-captions' : 'quoted-string', + 'codecs' : 'quoted-string', + 'default' : 'boolean', + 'duration' : 'decimal-floating-point', + 'forced' : 'boolean', + 'frame-rate' : 'decimal-floating-point', + 'group-id' : 'quoted-string', + 'instream-id' : 'quoted-string', + 'language' : 'quoted-string', + 'name' : 'quoted-string', + 'program-id' : 'decimal-integer', + 'resolution' : 'decimal-resolution', + 'subtitles' : 'quoted-string', + 'title' : 'enumerated-string', + 'type' : 'enumerated-string', + 'uri' : 'quoted-string', + 'video' : 'quoted-string' }; AttributeList.prototype.mergeAttributes = function mergeAttributes(attributes) { - var self = this; - if (Array.isArray(attributes)) { - attributes.forEach(function(attribute) { - self.set(attribute.key, attribute.value); - }); - } + var self = this; + if (Array.isArray(attributes)) { + attributes.forEach(function (attribute) { + self.set(attribute.key, attribute.value); + }); + } }; AttributeList.prototype.get = function getValue(key) { - return this.attributes[key]; + return this.attributes[key]; }; AttributeList.prototype.set = function setValue(key, value) { - key = key.toLowerCase(); - this.attributes[key] = parse[dataTypes[key] || 'unknown'](value, key); + key = key.toLowerCase(); + this.attributes[key] = parse[dataTypes[key] || 'unknown'](value, key); - return this; + return this; }; AttributeList.prototype.getCoerced = function getCoerced(key) { - return coerce[dataTypes[key] || 'unknown'](this.get(key)); + return coerce[dataTypes[key] || 'unknown'](this.get(key)); }; AttributeList.prototype.toString = function toString() { - var self = this; - return Object.keys(this.attributes).map(function(key) { - return [key.toUpperCase(), self.getCoerced(key)].join('='); - }).join(','); + var self = this; + return Object.keys(this.attributes).map(function (key) { + return [key.toUpperCase(), self.getCoerced(key)].join('='); + }).join(','); }; AttributeList.prototype.serialize = function serialize() { - return this.attributes; + return this.attributes; }; AttributeList.unserialize = function unserialize(object) { - var list = new AttributeList; - list.attributes = object; - return list; + var list = new AttributeList; + list.attributes = object; + return list; }; var coerce = { - 'boolean': function coerceBoolean(value) { - return value ? 'YES' : 'NO'; - }, - 'decimal-floating-point': parseFloat, - 'decimal-integer': function coerceDecimalInteger(value) { - return parseInt(value, 10); - }, - 'decimal-resolution': function coerceDecimalResolution(value) { - if (Array.isArray(value)) { - return value.join('x'); - } else { - return value; + 'boolean': function coerceBoolean(value) { + return value ? 'YES' : 'NO'; + }, + 'decimal-floating-point': parseFloat, + 'decimal-integer': function coerceDecimalInteger(value) { + return parseInt(value, 10); + }, + 'decimal-resolution': function coerceDecimalResolution(value) { + if (Array.isArray(value)) { + return value.join('x'); + } else { + return value; + } + }, + 'enumerated-string': function coerceEnumeratedString(value) { + return value; + }, + 'quoted-string': function coerceQuotedString(value) { + return '"' + value.replace(/"/g, '\\"') + '"'; + }, + 'unknown': function coerceUnknown(value) { + return value; } - }, - 'enumerated-string': function coerceEnumeratedString(value) { - return value; - }, - 'quoted-string': function coerceQuotedString(value) { - return '"' + value.replace(/"/g, '\\"') + '"'; - }, - 'unknown': function coerceUnknown(value) { - return value; - } }; var parse = { - 'boolean': function parseBoolean(value) { - return typeof value == 'boolean' - ? value - : (value == 'YES' ? true : false); - }, - 'decimal-floating-point': parseFloat, - 'decimal-integer': function parseDecimalInteger(value) { - return parseInt(value, 10); - }, - 'decimal-resolution': function coerceDecimalResolution(value) { - return value.split('x').map(parse['decimal-integer']); - }, - 'enumerated-string': function parseEnumeratedString(value) { - return value; - }, - 'quoted-string': function parseQuotedString(value) { - if (Array.isArray(value)) { - return value.join(','); - } else if (value.indexOf('"') === 0 && - value.lastIndexOf('"') == value.length - 1) { - return value.slice(1,-1); - } else { - return value; + 'boolean': function parseBoolean(value) { + return typeof value == 'boolean' + ? value + : (value == 'YES' ? true : false); + }, + 'decimal-floating-point': parseFloat, + 'decimal-integer': function parseDecimalInteger(value) { + return parseInt(value, 10); + }, + 'decimal-resolution': function coerceDecimalResolution(value) { + return value.split('x').map(parse['decimal-integer']); + }, + 'enumerated-string': function parseEnumeratedString(value) { + return value; + }, + 'quoted-string': function parseQuotedString(value) { + if (Array.isArray(value)) { + return value.join(','); + } else if (value.indexOf('"') === 0 && + value.lastIndexOf('"') == value.length - 1) { + return value.slice(1, -1); + } else { + return value; + } + }, + 'unknown': function parseUnknown(value, key) { + console.error('Handling value:', value, ' for unknown key:', key); + return value; } - }, - 'unknown': function parseUnknown(value, key) { - console.error('Handling value:', value, ' for unknown key:', key); - return value; - } }; From 9594464770a3716ce802bccdcd8d370c96677721 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 24 Sep 2016 22:51:42 -0700 Subject: [PATCH 03/10] version bump --- package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 886673b..5c5358d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,11 @@ { - "name" : "m3u8", - "version" : "0.0.6", + "name" : "@chovy/m3u8", + "version" : "1.0.0", "description" : "streaming m3u8 parser for Apple's HTTP Live Streaming protocol", "main" : "./parser.js", + "publishConfig": { + "access": "public" + }, "keywords" : [ "m3u", "m3u8", From 1567f9460060d2acdba458cc39c40ac20faaea55 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 24 Sep 2016 22:59:50 -0700 Subject: [PATCH 04/10] version bump, repo, readme --- README.md | 11 ++++++++--- package.json | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cb6c48c..622dae5 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,16 @@ node-m3u8 is a streaming m3u8 parser tailored for dealing with [Apple's HTTP Live Streaming protocol](http://tools.ietf.org/html/draft-pantos-http-live-streaming). It may work for other m3u files, but I have not tested it for those uses. +install +------- + +npm install --save @chovy/m3u8 + example ------- ``` js -var m3u8 = require('m3u8'); +var m3u8 = require('@chovy/m3u8'); var fs = require('fs'); var parser = m3u8.createStream(); @@ -36,7 +41,7 @@ parser.on('item', function(item) { The M3U and Item objects are available on m3u8: ``` -var m3u8 = require('m3u8'); +var m3u8 = require('@chovy/m3u8'); var m3u = m3u8.M3U.create(); m3u.addPlaylistItem({ @@ -45,4 +50,4 @@ m3u.addPlaylistItem({ }); ``` -See tests for more usage patterns. \ No newline at end of file +See tests for more usage patterns. diff --git a/package.json b/package.json index 5c5358d..2d6f1ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name" : "@chovy/m3u8", - "version" : "1.0.0", + "version" : "1.1.0", "description" : "streaming m3u8 parser for Apple's HTTP Live Streaming protocol", "main" : "./parser.js", "publishConfig": { @@ -15,7 +15,7 @@ ], "repository" : { "type" : "git", - "url" : "http://github.com/tedconf/node-m3u8.git" + "url" : "http://github.com/chovy/node-m3u8.git" }, "dependencies" : { "chunked-stream": "~0.0.1" From 23587924e46b8da61426f3a7778397762a3c2c67 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 24 Sep 2016 23:05:29 -0700 Subject: [PATCH 05/10] add contributor --- package.json | 79 ++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 2d6f1ba..d1379fc 100644 --- a/package.json +++ b/package.json @@ -1,39 +1,46 @@ { - "name" : "@chovy/m3u8", - "version" : "1.1.0", - "description" : "streaming m3u8 parser for Apple's HTTP Live Streaming protocol", - "main" : "./parser.js", - "publishConfig": { - "access": "public" - }, - "keywords" : [ - "m3u", - "m3u8", - "hls", - "http live streaming", - "stream" - ], - "repository" : { - "type" : "git", - "url" : "http://github.com/chovy/node-m3u8.git" - }, - "dependencies" : { - "chunked-stream": "~0.0.1" - }, - "devDependencies" : { - "mocha" : "~1.6.0", - "sinon" : "~1.5.0", - "should" : "7.1.1" - }, - "engine" : { - "node" : ">=0.6.0" - }, - "scripts": { - "test" : "make test" - }, - "author" : { - "name" : "Mark Bogdanoff", - "email" : "bog@ted.com", - "url" : "http://www.ted.com" + "name": "@chovy/m3u8", + "version": "1.1.0", + "description": "streaming m3u8 parser for Apple's HTTP Live Streaming protocol", + "main": "./parser.js", + "publishConfig": { + "access": "public" + }, + "keywords": [ + "m3u", + "m3u8", + "hls", + "http live streaming", + "stream" + ], + "repository": { + "type": "git", + "url": "http://github.com/chovy/node-m3u8.git" + }, + "dependencies": { + "chunked-stream": "~0.0.1" + }, + "devDependencies": { + "mocha": "~1.6.0", + "sinon": "~1.5.0", + "should": "7.1.1" + }, + "engine": { + "node": ">=0.6.0" + }, + "scripts": { + "test": "make test" + }, + "author": { + "name": "Mark Bogdanoff", + "email": "bog@ted.com", + "url": "http://www.ted.com" + }, + "contributors": [ + { + "name": "Anthony Ettinger", + "email": "anthony@chovy.com", + "url": "http://www.chovy.com" } + ] } From 51b4fecc2fecafcff426b9fb9c164d495075b5ed Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 24 Sep 2016 23:06:52 -0700 Subject: [PATCH 06/10] readme fork info --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 622dae5..c8b5847 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ node-m3u8 is a streaming m3u8 parser tailored for dealing with [Apple's HTTP Live Streaming protocol](http://tools.ietf.org/html/draft-pantos-http-live-streaming). It may work for other m3u files, but I have not tested it for those uses. +Note: this is an updated fork of `m3u8` that fixes a bunch of warnings with unknown attributes. These attributes have been accounted for. The main package `m3u8` appears to be dead. + install ------- From 09be093e151efd7038ee3ec796a4beda4407ac03 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 24 Sep 2016 23:13:29 -0700 Subject: [PATCH 07/10] update readme --- README.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8b5847..a19a30c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Note: this is an updated fork of `m3u8` that fixes a bunch of warnings with unkn install ------- -npm install --save @chovy/m3u8 + npm install --save @chovy/m3u8 example ------- diff --git a/package.json b/package.json index d1379fc..0148ed2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chovy/m3u8", - "version": "1.1.0", + "version": "1.1.1", "description": "streaming m3u8 parser for Apple's HTTP Live Streaming protocol", "main": "./parser.js", "publishConfig": { From 78dd0d33ab42163610b776ed5920b86cb4334964 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Fri, 11 Jan 2019 20:24:50 -0800 Subject: [PATCH 08/10] add new attributes --- m3u/AttributeList.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/m3u/AttributeList.js b/m3u/AttributeList.js index eb5211c..b6bb9e2 100644 --- a/m3u/AttributeList.js +++ b/m3u/AttributeList.js @@ -9,6 +9,8 @@ var dataTypes = AttributeList.dataTypes = { 'autoselect' : 'boolean', 'bandwidth' : 'decimal-integer', 'byterange' : 'enumerated-string', + 'channels' : 'quoted-string', + '_avg-bandwidth' : 'decimal-integer', 'closed-captions' : 'quoted-string', 'codecs' : 'quoted-string', 'default' : 'boolean', From a2781f3c3ad086f07befc3cc63ec2d3030a89bec Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Fri, 11 Jan 2019 20:26:34 -0800 Subject: [PATCH 09/10] fix package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d52d721..cfacce4 100644 --- a/package.json +++ b/package.json @@ -42,4 +42,5 @@ "email": "anthony@chovy.com", "url": "http://www.chovy.com" } + ] } From df1e127b9b9180afd07bbcb503c1ebddfd302554 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Fri, 11 Jan 2019 20:28:00 -0800 Subject: [PATCH 10/10] package-lock.json --- package-lock.json | 152 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..4ed7cc3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,152 @@ +{ + "name": "@chovy/m3u8", + "version": "1.2.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "buster-core": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/buster-core/-/buster-core-0.6.4.tgz", + "integrity": "sha1-J79rrWdCROpyDzEdkAoMoct4YFA=", + "dev": true + }, + "buster-format": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/buster-format/-/buster-format-0.5.6.tgz", + "integrity": "sha1-K4bDIuz14bCubm55Bev884fSq5U=", + "dev": true, + "requires": { + "buster-core": "=0.6.4" + } + }, + "chunked-stream": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/chunked-stream/-/chunked-stream-0.0.2.tgz", + "integrity": "sha1-zPdQmNrb8Ls4/zB+EJWCeAUHk54=" + }, + "commander": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-0.6.1.tgz", + "integrity": "sha1-+mihT2qUXVTbvlDYzbMyDp47GgY=", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + }, + "dependencies": { + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "diff": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-1.0.2.tgz", + "integrity": "sha1-Suc/Gu6Nb89ITxoc53zmUdm38Mk=", + "dev": true + }, + "growl": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.5.1.tgz", + "integrity": "sha1-HezR8ipLMNrn02N5nsYkz0DMAHA=", + "dev": true + }, + "jade": { + "version": "0.26.3", + "resolved": "https://registry.npmjs.org/jade/-/jade-0.26.3.tgz", + "integrity": "sha1-jxDXl32NefL2/4YqgbBRPMslaGw=", + "dev": true, + "requires": { + "commander": "0.6.1", + "mkdirp": "0.3.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz", + "integrity": "sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=", + "dev": true + } + } + }, + "mkdirp": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.3.tgz", + "integrity": "sha1-WV4lHBNww6aLqyE20ONIuBBa3xM=", + "dev": true + }, + "mocha": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-1.6.0.tgz", + "integrity": "sha1-IrcBGIGfRzueQ6PtF4k82/PfUzQ=", + "dev": true, + "requires": { + "commander": "0.6.1", + "debug": "*", + "diff": "1.0.2", + "growl": "1.5.x", + "jade": "0.26.3", + "mkdirp": "0.3.3", + "ms": "0.3.0" + } + }, + "ms": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.3.0.tgz", + "integrity": "sha1-A+3DSNYT5mpWSGz9rFO8vomcvWE=", + "dev": true + }, + "should": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/should/-/should-7.1.1.tgz", + "integrity": "sha1-ZGTEi298Hh8YrASDV4+i3VXCxuA=", + "dev": true, + "requires": { + "should-equal": "0.5.0", + "should-format": "0.3.1", + "should-type": "0.2.0" + } + }, + "should-equal": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-0.5.0.tgz", + "integrity": "sha1-x5fxNfMGf+tp6+zbMGscP+IbPm8=", + "dev": true, + "requires": { + "should-type": "0.2.0" + } + }, + "should-format": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-0.3.1.tgz", + "integrity": "sha1-LLt4JGFnCs5CkrKx7EaNuM+Z4zA=", + "dev": true, + "requires": { + "should-type": "0.2.0" + } + }, + "should-type": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-0.2.0.tgz", + "integrity": "sha1-ZwfvlVKdmJ3MCY/gdTqx+RNrt/Y=", + "dev": true + }, + "sinon": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-1.5.2.tgz", + "integrity": "sha1-nKvGx4vfRF1/gxHVSWhi+VRoxPg=", + "dev": true, + "requires": { + "buster-format": "~0.5" + } + } + } +}