const inify = require('ini').stringify
const log = require('npmlog')

function makePlaylist (albums) {
  let index = 0
  const playlist = {}
  for (let album of albums) {
    log.verbose('makePlaylist', 'album', album.name, 'has date', album.date)
    for (let track of album.tracks) {
      index++
      playlist['File' + index] = track.path
      playlist['Title' + index] = track.name
      playlist['Length' + index] = Math.ceil(track.duration)
    }
  }
  playlist['NumberOfEntries'] = index
  playlist['Version'] = 2
  log.info('makePlaylist', 'playlist generated with', index, 'entries')
  return inify(playlist, {section: 'playlist'})
}

module.exports = makePlaylist

@@ -1,71 +1,69 @@
-const 
+import %7B str
 in
+g
 ify 
-= require('ini').stringify%0Aconst log = require(
+as inify %7D from 'ini'%0Aimport log from 
 'npmlog'
 )%0A%0Af
@@ -62,11 +62,25 @@
 log'
-)
 %0A%0A
+export default 
 func
@@ -344,16 +344,21 @@
 = track.
+file.
 path%0A   
@@ -660,35 +660,4 @@
 )%0A%7D%0A
-%0Amodule.exports = makePlaylist%0A

update for new data model