Skip to content

Commit

Permalink
Merge pull request #12 from e-e-e/development
Browse files Browse the repository at this point in the history
0.1.3
  • Loading branch information
sdockray committed Jul 27, 2017
2 parents 2d8d29c + bd0b718 commit be37a53
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
5 changes: 3 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "dat-library",
"version": "0.1.2",
"version": "0.1.3",
"author": "e-e-e <e-e-e@users.noreply.github.com>",
"description": "A tool for searching, building and sharing distributed p2p libraries.",
"license": "ISC",
Expand Down Expand Up @@ -60,7 +60,8 @@
"dependencies": {
"axios": "^0.16.2",
"babel-polyfill": "^6.23.0",
"dat-cardcat": "^0.3.5",
"dat-cardcat": "^0.4.0",
"dat-cardcat-formats": "^0.0.1",
"element-ui": "1.3.7",
"lodash": "^4.17.4",
"pretty-bytes": "^4.0.2",
Expand Down
14 changes: 10 additions & 4 deletions src/renderer/components/datBook.vue
Expand Up @@ -31,6 +31,7 @@
import path from 'path';
import { shell } from 'electron';
import { mapActions, mapGetters } from 'vuex';
import { formatPath } from 'dat-cardcat-formats';
export default {
name: 'datBook',
Expand All @@ -48,10 +49,15 @@
computed: {
...mapGetters(['datWithKey']),
filepath: function filepath() {
return this.book.files.map(file => path.join(this.datWithKey(file.dat).dir, this.book.author, this.book.title, file.file));
},
bookpath: function bookpath() {
return this.book.files.map(file => path.join(this.datWithKey(file.dat).dir, this.book.author, this.book.title));
return this.book.files.map(file => path.join(
this.datWithKey(file.dat).dir,
formatPath({
author: this.book.author,
title: this.book.title,
file: file.file,
format: this.datWithKey(file.dat).format,
})
));
},
},
methods: {
Expand Down
10 changes: 9 additions & 1 deletion src/renderer/components/libraryStats.vue
Expand Up @@ -9,7 +9,7 @@
<el-badge :value="stats.peers.complete || '0'" class="item">Complete</el-badge>
</el-col>
<el-col :span="4">
&uarr; {{ stats.uploadSpeed || 0 }} &bull; &darr; {{ stats.downloadSpeed || 0 }}
&uarr; {{ upload || 0 }} &bull; &darr; {{ download || 0 }}
</el-col>
<el-col :span="12"/>
</el-row>
Expand Down Expand Up @@ -84,6 +84,14 @@
const stats = this.stats;
return prettyBytes(stats.size);
},
download() {
const stats = this.stats;
return prettyBytes(stats.downloadSpeed || 0);
},
upload() {
const stats = this.stats;
return prettyBytes(stats.uploadSpeed || 0);
},
},
methods: {
sanitisePercentage: (value) => {
Expand Down
6 changes: 1 addition & 5 deletions src/renderer/store/store.js
Expand Up @@ -156,11 +156,7 @@ const store = new Vuex.Store({
commit('setDownloadStat', data);
dispatch('getDatStats');
if (data.progress === 100) {
// @TODO: rather than crudely parsing file here -
// we should make dat-cardcat pass over format type,
// and make formatter into a seporate module
const x = _.split(data.file, '/');
commit('setDownloadedResult', { author: x[1], title: x[2], file: x[3], dat: data.key });
commit('setDownloadedResult', { ...data.parsed, dat: data.key });
}
// SD: possible to re-run current results query if desired
// if (state.resultsQuery && state.resultsQuery.func) {
Expand Down

0 comments on commit be37a53

Please sign in to comment.