Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephellon authored May 10, 2018
1 parent e218c0d commit 62dbb8e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ function showNotification(state, text, timeout, callback) {
let el = document.createElement('div');
el.classList.add('web-to-plex-notification');
el.onclick = () => {
clearTimeout(lastNotification);
el.remove();
callback();
return callback();
};

if (state === 'warning') {
Expand Down Expand Up @@ -355,7 +356,7 @@ function pushRadarrRequest(options) {
let title = options.title.replace(/\&/g, 'and').replace(/\s+/g, '-').replace(/\W+/g, '').toLowerCase(),
TVDbID = options.TVDbID;

showNotification('info', 'Added movie to Radarr', 0, () => window.open(`${config.radarrURL}movies/${TVDbID? `${title}-${TVDbID}`: '' }`, '_blank'));
showNotification('info', 'Added movie to Radarr', 0, () => window.open(`${config.radarrURL}${TVDbID? `movies/${title}-${TVDbID}`: '' }`, '_blank'));
} else {
showNotification('warning', 'Could not add to Radarr: Unknown Error');
}
Expand Down Expand Up @@ -387,7 +388,7 @@ function pushSonarrRequest(options) {
return showNotification('warning', 'Could not add to Sonarr: ' + response.error),
console.error('Error adding to Sonarr:', response.error, response.location);
} else if (response && response.success) {
let title = options.title.replace(/\&/g, 'and').replace(/\s+/g, '-').replace(/\W+/g, '').toLowerCase();
let title = options.title.replace(/\&/g, 'and').replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').toLowerCase();

showNotification('info', 'Added series to Sonarr', 0, () => window.open(`${config.sonarrURL}series/${title}`, '_blank'));
} else {
Expand All @@ -403,9 +404,13 @@ function modifyPlexButton(el, action, title, options) {
}

let pa = null,
ty = (options? (options.type === 'show'? 'TV Show': 'Movie'): 'Item'),
txt = options.txt || 'textContent',
hov = options.hov || 'title';
ty = 'Item', txt = 'textContent', hov = 'title';

if(options) {
ty = (options.type === 'show'? 'TV Show': 'Movie');
txt = options.txt || txt;
hov = options.hov || hov;
}

if (action === 'found') {
el.href = getPlexMediaURL(config.server.id, options.key);
Expand Down

0 comments on commit 62dbb8e

Please sign in to comment.