Refactoring helper functions
This commit is contained in:
parent
06b6279574
commit
4dc6ac3632
|
@ -17,7 +17,7 @@ function init() {
|
|||
countries = countries.slice(0, 1)
|
||||
}
|
||||
|
||||
util.createFile(outputFile)
|
||||
util.createFile(outputFile, '#EXTM3U\n')
|
||||
|
||||
for(let country of countries) {
|
||||
|
||||
|
@ -39,7 +39,9 @@ function init() {
|
|||
|
||||
} else {
|
||||
|
||||
util.writeToFile(outputFile, info, file)
|
||||
const data = '#EXTINF:' + info + '\n' + file + '\n'
|
||||
|
||||
util.writeToFile(outputFile, data)
|
||||
|
||||
addToCache(file)
|
||||
|
||||
|
|
|
@ -80,12 +80,12 @@ function sortByTitle(arr) {
|
|||
return arr.sort(byTitle)
|
||||
}
|
||||
|
||||
function writeToFile(filename, info, file) {
|
||||
fs.appendFileSync(path.resolve(__dirname) + '/../' + filename, '#EXTINF:' + info + '\n' + file + '\n')
|
||||
function writeToFile(filename, data) {
|
||||
fs.appendFileSync(path.resolve(__dirname) + '/../' + filename, data)
|
||||
}
|
||||
|
||||
function createFile(filename) {
|
||||
fs.writeFileSync(path.resolve(__dirname) + '/../' + filename, '#EXTM3U\n')
|
||||
function createFile(filename, data) {
|
||||
fs.writeFileSync(path.resolve(__dirname) + '/../' + filename, data)
|
||||
}
|
||||
|
||||
function getBasename(filename) {
|
||||
|
|
Loading…
Reference in New Issue