diff --git a/package.json b/package.json index fe5820cc..a9045165 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "material-ui": "^0.17.0", "mkdirp": "^0.5.1", "musicmetadata": "^2.0.2", + "natsort": "^1.0.6", "network-address": "^1.1.0", "parse-torrent": "^5.7.3", "prettier-bytes": "^1.0.1", diff --git a/src/renderer/pages/torrent-list-page.js b/src/renderer/pages/torrent-list-page.js index 18936209..7eaaed2d 100644 --- a/src/renderer/pages/torrent-list-page.js +++ b/src/renderer/pages/torrent-list-page.js @@ -1,5 +1,6 @@ const React = require('react') const prettyBytes = require('prettier-bytes') +const natsort = require('natsort') const Checkbox = require('material-ui/Checkbox').default const LinearProgress = require('material-ui/LinearProgress').default @@ -278,9 +279,11 @@ module.exports = class TorrentList extends React.Component { ) } else { // We do know the files. List them and show download stats for each one + const sorter = natsort() const fileRows = torrentSummary.files .filter((file) => !file.path.includes('/.____padding_file/')) .map((file, index) => ({ file, index })) + .sort((a, b) => sorter(a.file.name, b.file.name)) .map((object) => this.renderFileRow(torrentSummary, object.file, object.index)) filesElement = (