Skip to content

Commit

Permalink
Merge pull request #487 from petio-team/dev
Browse files Browse the repository at this point in the history
0.5.4
  • Loading branch information
ADRFranklin authored Sep 8, 2021
2 parents 7e2b583 + db67464 commit 9769f4d
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 127 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This application can be installed to run in docker or as a standalone binary tha
Binary (executable file) guides
**note:** this method requires a local mongodb instance to be installed
<ul>
<li><a target="_blank" href="hhttps://docs.petio.tv/install-guides/windows">Windows</a> </li>
<li><a target="_blank" href="https://docs.petio.tv/install-guides/windows">Windows</a> </li>
<li><a target="_blank" href="https://docs.petio.tv/install-guides/linux">Linux</a> </li>
<li><a target="_blank" href="https://docs.petio.tv/install-guides/macos">MacOS</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "petio-admin",
"version": "0.5.2-alpha",
"version": "0.5.4-alpha",
"private": true,
"homepage": ".",
"dependencies": {
Expand Down
41 changes: 21 additions & 20 deletions admin/src/page/Requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,16 @@ class Requests extends React.Component {
let uuid = Object.keys(r)[0];
let child =
req.children && req.children[i] ? req.children[i].info : {};
let path = false;
if (child.path) {
path = child.path
.replace(`/${req.title} (${child.year})`, "")
.replace(`\\${req.title} (${child.year})`, "");
}
edit_radarr[uuid] = {
active: true,
profile: child.qualityProfileId ? child.qualityProfileId : false,
path: child.path
? child.path
.replace(`/${req.title} (${child.year})`, "")
.replace(`\\${req.title} (${child.year})`, "")
: false,
path: path,
};
});
} else {
Expand All @@ -214,14 +216,14 @@ class Requests extends React.Component {
req.sonarrId.map((r, i) => {
let uuid = Object.keys(r)[0];
let child = req.children[i] ? req.children[i].info : {};
let path = false;
if (child.rootFolderPath) {
path = child.rootFolderPath.slice(0, -1);
}
edit_sonarr[uuid] = {
active: true,
profile: child.qualityProfileId ? child.qualityProfileId : false,
path: child.path
? child.path
.replace(`${req.title} (${child.year})`, "")
.replace(`${req.title} (${child.year})`, "")
: false,
path: path,
};
});
} else {
Expand Down Expand Up @@ -276,6 +278,7 @@ class Requests extends React.Component {

renderReqEdit(server, type) {
let editable = this.state.activeRequest[`${type}Id`].length === 0;

return (
<div
className="request-edit--server--wrap"
Expand Down Expand Up @@ -343,8 +346,13 @@ class Requests extends React.Component {
data-id={server.uuid}
name="path"
value={
this.state[`edit_${type}`][server.uuid]
? this.state[`edit_${type}`][server.uuid].path
this.state[`edit_${type}`][server.uuid]?.path
? this.state[`edit_${type}`][server.uuid]?.path
: false
}
dataValue={
this.state[`edit_${type}`][server.uuid]?.path
? this.state[`edit_${type}`][server.uuid]?.path
: false
}
onChange={this.changeServerSettings}
Expand Down Expand Up @@ -530,14 +538,7 @@ class Requests extends React.Component {
: false
}
delete={this.deleteReq}
submit={
this.state.activeRequest
? this.state.activeRequest.sonarrId.length > 0 ||
this.state.activeRequest.radarrId.length > 0
? false
: this.updateReq
: false
}
submit={this.updateReq}
>
{this.state.activeRequest ? (
<>
Expand Down
10 changes: 0 additions & 10 deletions admin/src/page/settings/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,8 @@ class General extends React.Component {
super(props);

this.state = {
email_user: "",
email_pass: "",
email_server: "",
email_port: "",
email_secure: false,
email_enabled: false,
base_path: "",
login_type: false,
discord_webhook: false,
telegram_bot_token: "",
telegram_chat_id: "",
telegram_send_silently: false,
plexPopular: false,
token: false,
};
Expand Down
4 changes: 4 additions & 0 deletions admin/src/page/settings/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ class Notifications extends React.Component {
}
}

componentDidMount() {
this.loadConfigs();
}

render() {
return (
<>
Expand Down
36 changes: 17 additions & 19 deletions admin/src/page/settings/radarr.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Radarr extends React.Component {
protocol: "http",
host: "localhost",
port: "",
profile: "",
profile: false,
profile_title: "",
path: "",
path_title: "",
Expand Down Expand Up @@ -92,7 +92,6 @@ class Radarr extends React.Component {

servers.splice(this.state.activeServer, 1);

console.log(servers);
// return;
await Api.saveRadarrConfig(servers);
this.getRadarr(true);
Expand Down Expand Up @@ -314,6 +313,7 @@ class Radarr extends React.Component {
</>
);
}

return (
<>
<Modal
Expand All @@ -324,18 +324,18 @@ class Radarr extends React.Component {
this.state.needsTest
? false
: () => {
this.saveServer();
this.closeModal("addServer");
}
this.saveServer();
this.closeModal("addServer");
}
}
close={() => this.closeModal("addServer")}
delete={
this.state.newServer
? false
: () => {
this.deleteServer();
this.closeModal("addServer");
}
this.deleteServer();
this.closeModal("addServer");
}
}
>
<label>Title</label>
Expand Down Expand Up @@ -398,18 +398,17 @@ class Radarr extends React.Component {
</button>
<label>Profile</label>
<div
className={`styled-input--select ${
this.state.profiles ? "" : "disabled"
}`}
className={`styled-input--select ${this.state.profiles ? "" : "disabled"
}`}
>
<select
name="profile"
value={this.state.profile}
onChange={this.inputChange}
>
{this.state.profiles &&
!this.state.newServer &&
!this.state.needsTest ? (
!this.state.newServer &&
!this.state.needsTest ? (
<>
<option value="">Choose an option</option>
{this.state.profiles.map((item) => {
Expand All @@ -431,9 +430,8 @@ class Radarr extends React.Component {
</div>
<label>Path</label>
<div
className={`styled-input--select ${
this.state.profiles ? "" : "disabled"
}`}
className={`styled-input--select ${this.state.profiles ? "" : "disabled"
}`}
>
<select
name="path"
Expand Down Expand Up @@ -461,9 +459,9 @@ class Radarr extends React.Component {
</select>
</div>
{!this.state.newServer &&
this.state.path &&
this.state.profile &&
!this.state.needsTest ? (
this.state.path &&
this.state.profile &&
!this.state.needsTest ? (
<div className="checkbox-wrap mb--2">
<input
type="checkbox"
Expand Down
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "petio-rest",
"version": "0.5.2-alpha",
"version": "0.5.4-alpha",
"description": "Rest Api for Petio",
"main": "index.js",
"scripts": {
Expand Down
32 changes: 28 additions & 4 deletions api/plex/libraryUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class LibraryUpdate {
} catch (err) {
logger.log("error", `LIB CRON: Unable to get library content`);
logger.log({ level: "error", message: err });
console.log(err.stack);
}
}
}
Expand Down Expand Up @@ -418,6 +419,13 @@ class LibraryUpdate {
return;
}
for (let guid of movieObj.Guid) {
if (!guid.id) {
logger.log(
"warn",
`LIB CRON: Movie couldn't be matched - ${title} - no GUID ID`
);
return;
}
let source = guid.id.split("://");
externalIds[source[0] + "_id"] = source[1];
if (source[0] === "tmdb") tmdbId = source[1];
Expand Down Expand Up @@ -454,10 +462,19 @@ class LibraryUpdate {
if (idSource === "themoviedb") {
idSource = "tmdb";
}
externalId = movieObj.guid
.replace("com.plexapp.agents.", "")
.split("://")[1]
.split("?")[0];

try {
externalId = movieObj.guid
.replace("com.plexapp.agents.", "")
.split("://")[1]
.split("?")[0];
} catch (e) {
logger.log(
"warn",
`LIB CRON: Movie couldn't be matched - ${title} - GUID Error #2 - GUID is - ${movieObj.guid}`
);
return;
}

if (idSource !== "tmdb") {
try {
Expand Down Expand Up @@ -633,6 +650,13 @@ class LibraryUpdate {
return;
}
for (let guid of showObj.Guid) {
if (!guid.id) {
logger.log(
"warn",
`LIB CRON: Show couldn't be matched - ${title} - no GUID ID`
);
return;
}
let source = guid.id.split("://");
externalIds[source[0] + "_id"] = source[1];
if (source[0] === "tmdb") tmdbId = source[1];
Expand Down
14 changes: 8 additions & 6 deletions api/requests/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,16 @@ function reqState(req, children) {
if (children[r].info.seasons) {
let missing = false;
for (let season of children[r].info.seasons) {
if (
season.statistics &&
season.statistics.percentOfEpisodes !== 100
)
missing = true;
if (season.monitored) {
if (
season.statistics &&
season.statistics.percentOfEpisodes !== 100
)
missing = true;
}
}

if (!missing && children[r].info.totalEpisodeCount > 0) {
if (!missing && children[r].info.statistics.totalEpisodeCount > 0) {
return {
status: "good",
message: "Downloaded",
Expand Down
11 changes: 8 additions & 3 deletions api/services/radarr.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,20 @@ class Radarr {
let key = val;
paramsString += `${i === 0 ? "?" : "&"}${key}=${params[val]}`;
});
let url = `${this.config.protocol}://${this.config.hostname}${
this.config.port ? ":" + this.config.port : ""
}${this.config.urlBase}/api/v3/${endpoint}${paramsString}`;
let url = `${this.config.protocol}://${this.config.hostname}${this.config.port ? ":" + this.config.port : ""
}${this.config.urlBase}/api/v3/${endpoint}${paramsString}`;
try {
if (method === "post" && body) {
let res = await axios.post(url, body);
if (typeof res.data !== 'object') {
reject("not a valid object");
}
return res.data;
} else {
let res = await axios.get(url);
if (typeof res.data !== 'object') {
reject("not a valid object");
}
return res.data;
}
} catch (err) {
Expand Down
Loading

0 comments on commit 9769f4d

Please sign in to comment.