|
|
|
@ -163,21 +163,23 @@ function getGzipped(url) {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function byTitle(a, b) {
|
|
|
|
|
var nameA = a.title.toLowerCase()
|
|
|
|
|
var nameB = b.title.toLowerCase()
|
|
|
|
|
if (nameA < nameB) {
|
|
|
|
|
return -1
|
|
|
|
|
}
|
|
|
|
|
if (nameA > nameB) {
|
|
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
function byTitleAndUrl(a, b) {
|
|
|
|
|
var titleA = a.title.toLowerCase()
|
|
|
|
|
var titleB = b.title.toLowerCase()
|
|
|
|
|
var urlA = a.url.toLowerCase()
|
|
|
|
|
var urlB = b.url.toLowerCase()
|
|
|
|
|
|
|
|
|
|
if(titleA < titleB) return -1
|
|
|
|
|
if(titleA > titleB) return 1
|
|
|
|
|
|
|
|
|
|
if(urlA < urlB) return -1
|
|
|
|
|
if(urlA > urlB) return 1
|
|
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sortByTitle(arr) {
|
|
|
|
|
return arr.sort(byTitle)
|
|
|
|
|
function sortByTitleAndUrl(arr) {
|
|
|
|
|
return arr.sort(byTitleAndUrl)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function readFile(filename) {
|
|
|
|
@ -215,8 +217,9 @@ function clearCache() {
|
|
|
|
|
function getUrlPath(u) {
|
|
|
|
|
let parsed = urlParser.parse(u)
|
|
|
|
|
let searchQuery = parsed.search || ''
|
|
|
|
|
let path = parsed.host + parsed.pathname + searchQuery
|
|
|
|
|
|
|
|
|
|
return parsed.host + parsed.pathname + searchQuery
|
|
|
|
|
return path.toLowerCase()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function validateUrl(channelUrl) {
|
|
|
|
@ -236,7 +239,7 @@ function skipPlaylist(filename) {
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
parsePlaylist,
|
|
|
|
|
sortByTitle,
|
|
|
|
|
sortByTitleAndUrl,
|
|
|
|
|
appendToFile,
|
|
|
|
|
createFile,
|
|
|
|
|
readFile,
|
|
|
|
|