diff --git a/client/app/components/SearchObject.jsx b/client/app/components/SearchObject.jsx index b61f4ea..2b3e8e0 100644 --- a/client/app/components/SearchObject.jsx +++ b/client/app/components/SearchObject.jsx @@ -21,8 +21,8 @@ class SearchObject { this.year = object.year; this.type = object.type; this.rating = object.rating; - this.poster = object.poster; - this.background = object.background; + this.poster = object.poster_path; + this.background = object.background_path; this.matchedInPlex = object.matchedInPlex; this.summary = object.summary; } diff --git a/client/app/components/admin/Admin.jsx b/client/app/components/admin/Admin.jsx index d2faeef..c8d8548 100644 --- a/client/app/components/admin/Admin.jsx +++ b/client/app/components/admin/Admin.jsx @@ -33,7 +33,7 @@ class AdminComponent extends React.Component { fetchJSON('https://apollo.kevinmidboe.com/api/v1/plex/requests/all', 'GET') .then(result => { this.setState({ - requested_objects: result.requestedItems.reverse() + requested_objects: result.results.reverse() }) }) } @@ -89,4 +89,4 @@ class AdminComponent extends React.Component { } -export default AdminComponent; \ No newline at end of file +export default AdminComponent; diff --git a/client/app/components/admin/AdminRequestInfo.jsx b/client/app/components/admin/AdminRequestInfo.jsx index 4b10da4..0561e79 100644 --- a/client/app/components/admin/AdminRequestInfo.jsx +++ b/client/app/components/admin/AdminRequestInfo.jsx @@ -171,7 +171,7 @@ class AdminRequestInfo extends Component {
diff --git a/client/app/components/admin/TorrentTable.jsx b/client/app/components/admin/TorrentTable.jsx
index 4cb56fd..3f06ed3 100644
--- a/client/app/components/admin/TorrentTable.jsx
+++ b/client/app/components/admin/TorrentTable.jsx
@@ -38,7 +38,8 @@ class TorrentTable extends Component {
// Link to repo: https://github.com/sindresorhus/pretty-bytes
convertSizeToHumanSize(num) {
if (!Number.isFinite(num)) {
- throw new TypeError(`Expected a finite number, got ${typeof num}: ${num}`);
+ return num
+ // throw new TypeError(`Expected a finite number, got ${typeof num}: ${num}`);
}
const neg = num < 0;
@@ -57,6 +58,17 @@ class TorrentTable extends Component {
return (neg ? '-' : '') + numStr + ' ' + unit;
}
+ convertHumanSizeToBytes(string) {
+ const [numStr, unit] = string.split(' ');
+ if (this.UNITS.indexOf(unit) === -1) {
+ return string
+ }
+
+ const exponent = this.UNITS.indexOf(unit) * 3
+
+ return numStr * (Math.pow(10, exponent))
+ }
+
sendToDownload(magnet) {
const apiData = {
magnet: magnet,
@@ -80,8 +92,6 @@ class TorrentTable extends Component {
return item
})
- console.log(filteredByQuery)
-
this.setState({
torrentResponse: filteredByQuery,
filterQuery: query,
@@ -101,6 +111,9 @@ class TorrentTable extends Component {
let valueA = isNaN(a[col]) ? a[col] : parseInt(a[col])
let valueB = isNaN(b[col]) ? b[col] : parseInt(b[col])
+ valueA = (col == 'size') ? this.convertHumanSizeToBytes(valueA) : valueA
+ valueB = (col == 'size') ? this.convertHumanSizeToBytes(valueB) : valueB
+
if (direction)
return valueA