Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions music app/.idea/app.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions music app/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions music app/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

245 changes: 245 additions & 0 deletions music app/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions music app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

## Build
```bash
$ androidjs b
```

Binary file added music app/assets/icon/courses-icon-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added music app/assets/icon/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added music app/assets/icon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
306 changes: 306 additions & 0 deletions music app/assets/ipc/androidjs.js

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions music app/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
var mp3Duration = require('mp3-duration');
var convert = require('convert-seconds');
const path = require('path');
const fs = require('fs');

const {back} = require('androidjs');


// let __dir = '/media/devesh/Data/Songs/';
let __dir = undefined;


async function buildList() {

const items = fs.readdirSync(__dir);

for (let i = 0; i < items.length; i++) {

let item = {
track: undefined,
name: undefined,
duration: undefined,
file: undefined
};

item.track = i;
item.name = items[i];
item.duration = undefined;
item.file = 'file://' + path.join(__dir, items[i]);


if (path.parse(items[i]).ext === '.mp3') {
mp3Duration(path.join(__dir, items[i]), function (err, duration) {
if (err) return console.log(err.message);
let t = convert(duration);
item.duration = t.hours + ':' + t.minutes + ':' + t.seconds;
console.log(item);
back.send('playListSong', item);
});
}
}
}

back.on('getList', (dir) => {
__dir = dir;
buildList();
});
Loading