A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fission playlist tweaks

+19 -11
+19 -11
src/Javascript/Brain/user.js
··· 169 169 switch (event.data.file) { 170 170 171 171 case "playlists.json": 172 - return wnfs.ls(PLAYLISTS_PATH).then(result => { 173 - return Object.values(result).map(r => { 174 - return wnfs 175 - .read(PLAYLISTS_PATH + r.name) 176 - .then(p => new TextDecoder().decode(p)) 177 - .then(j => JSON.parse(j)) 178 - }) 179 - }).then(promises => { 180 - return Promise.all(promises) 181 - }).then(playlists => { 182 - return sendData(app, event)(playlists) 172 + return wnfs.exists(PLAYLISTS_PATH).then(exists => { 173 + if (!exists) return wnfs 174 + .read(wnfs.appPath([ event.data.file ])) 175 + .then(a => a ? new TextDecoder().decode(a) : null) 176 + .then(sendJsonData_) 177 + 178 + return wnfs.ls(PLAYLISTS_PATH).then(result => 179 + Object.values(result).map(r => 180 + wnfs 181 + .read(PLAYLISTS_PATH + r.name) 182 + .then(p => new TextDecoder().decode(p)) 183 + .then(j => JSON.parse(j)) 184 + ) 185 + ) 183 186 }) 187 + .then(promises => 188 + Promise.all(promises) 189 + ).then(playlists => 190 + sendData(app, event)(playlists) 191 + ) 184 192 185 193 default: 186 194 return wnfs