   zipFile = "#{BASE_STORE}/#{id}.zip"
 
   download zip_url(id), zipFile, ->
-    console.log 'finished'
     fs.createReadStream(zipFile)
       .pipe(unzip.Extract(path: "#{BASE_STORE}/#{id}"))
       .on 'close', ->
-        console.log 'unzipped'
+        parser = new xml2js.Parser()
+        fs.readFile "#{BASE_STORE}/#{id}/en.xml", (err, data) ->
+          return error(err) if err
+          parser.parseString data, (err, result) ->
+            return error(err) if err
+            episodes = result['Data']['Episode']
+            episodes.forEach(printEpisode)
 
 module.exports = add

BASE_STORE = "#{BASE}/store"

zip_url = (id) -> "#{API_HOST}/api/#{KEY}/series/#{id}/all/en.zip"

add = (id) ->
  console.log('Please specify Series id') unless id

fs = require('fs')
unzip = require('unzip')
xml2js = require 'xml2js'

{xmlReq, download, error} = require './utils'

KEY = process.env.THETVDB_API_KEY
API_HOST = 'http://thetvdb.com'
