-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Amazon, Verizon, and Vudu. Also fixed a few icons, and scripts.
- Loading branch information
Showing
30 changed files
with
489 additions
and
31 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.web-to-plex-button { | ||
margin-right: 8px; | ||
color: #fff!important; | ||
margin-bottom: 8px!important; | ||
line-height: 2!important; | ||
} | ||
|
||
.web-to-plex-button--downloader { | ||
background-color: #f45a26!important; | ||
} | ||
|
||
.web-to-plex-button--downloader:hover { | ||
background-color: #f67e56!important; | ||
} | ||
|
||
.web-to-plex-button--found { | ||
background-color: #ca7c1f!important; | ||
} | ||
|
||
.web-to-plex-button--found:hover { | ||
background-color: #f8c022!important; | ||
} | ||
|
||
.web-to-plex-notification { | ||
cursor: pointer; | ||
display: block; | ||
position: fixed; | ||
top: 80px; | ||
left: 50%; | ||
margin-left: -175px; | ||
width: 350px; | ||
background: #21262e; | ||
color: #fff; | ||
font-size: 20px; | ||
padding: 10px; | ||
border-radius: 4px; | ||
z-index: 999000; | ||
} | ||
|
||
.web-to-plex-warning { | ||
background: #fd6a00; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* global findPlexMedia, parseOptions, modifyPlexButton */ | ||
function isMovie() { | ||
return !isShow(); | ||
} | ||
|
||
function isShow() { | ||
return document.querySelector('[data-automation-id="num-of-seasons-badge"]'); | ||
} | ||
|
||
function isPageReady() { | ||
return document.querySelector('[data-automation-id="imdb-rating-badge"]'); | ||
} | ||
|
||
async function init() { | ||
if (isPageReady()) | ||
await initPlexThingy(isMovie()? 'movie': 'tv'); | ||
else | ||
// This almost never happens, but sometimes the page is too slow so we need to wait a bit. | ||
setTimeout(init, 1000); | ||
} | ||
|
||
function renderPlexButton($parent) { | ||
if (!$parent) return; | ||
|
||
let existingButton = document.querySelector('a.web-to-plex-button'); | ||
if (existingButton) | ||
existingButton.remove(); | ||
|
||
let el = document.createElement('a'); | ||
|
||
el.textContent = 'Web to Plex+'; | ||
el.title = 'Loading...'; | ||
el.classList.add('web-to-plex-button', 'av-button', 'av-button--default'); | ||
|
||
$parent.appendChild(el); | ||
return el; | ||
} | ||
|
||
async function initPlexThingy(type) { | ||
let $parent = document.querySelector('#dv-action-box .av-action-button-box'), | ||
$button = renderPlexButton($parent); | ||
|
||
if (!$button) | ||
return; | ||
|
||
let $title = document.querySelector('[data-automation-id="title"]'), | ||
$year = document.querySelector('[data-automation-id="release-year-badge"]'); | ||
|
||
if (!$title) | ||
return modifyPlexButton( | ||
$button, | ||
'error', | ||
'Could not extract title from Amazon' | ||
), | ||
null; | ||
|
||
let title = $title.textContent.replace(/\(.+?\)$/, '').trim(), | ||
year = $year? $year.textContent.trim(): YEAR; | ||
|
||
console.log({ title, year }); | ||
|
||
let Db = await getIDs({ title, year, APIType: type }), | ||
IMDbID = Db.imdb, | ||
TVDbID = Db.thetvdb; | ||
|
||
findPlexMedia({ type, title, year, button: $button, IMDbID, TVDbID }); | ||
} | ||
|
||
if (isMovie() || isShow()) { | ||
parseOptions().then(async() => await init()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.web-to-plex-button--downloader { | ||
border-color: #f45a26!important; | ||
background: #f45a26!important; | ||
color: #fff!important; | ||
} | ||
|
||
.web-to-plex-button--downloader:hover { | ||
background: #f67e56!important; | ||
} | ||
|
||
.web-to-plex-button--found { | ||
background: #e5a00d!important; | ||
border-color: #e5a00d!important; | ||
color: #fff!important; | ||
} | ||
|
||
.web-to-plex-button--found:hover { | ||
background: #f9be03!important; | ||
} | ||
|
||
.web-to-plex-notification { | ||
cursor: pointer; | ||
display: block; | ||
position: fixed; | ||
top: 80px; | ||
left: 50%; | ||
margin-left: -175px; | ||
width: 350px; | ||
background: #21262e; | ||
color: #fff; | ||
font-size: 20px; | ||
padding: 10px; | ||
border-radius: 4px; | ||
z-index: 999000; | ||
} | ||
|
||
.web-to-plex-warning { | ||
background: #fd6a00; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* global wait, modifyPlexButton, parseOptions, findPlexMedia */ | ||
function isMoviePage() { | ||
return window.location.pathname.startsWith('/movie/'); | ||
} | ||
|
||
function isShowPage() { | ||
return window.location.pathname.startsWith('/series/'); | ||
} | ||
|
||
function init() { | ||
if (isMoviePage() || isShowPage()) { | ||
wait( | ||
() => document.querySelector('.container .btn-with-play'), | ||
() => initPlexThingy(isMoviePage() ? 'movie' : 'tv') | ||
); | ||
} | ||
} | ||
|
||
function renderPlexButton() { | ||
let $actions = document.querySelector('.container .content-holder'); | ||
if (!$actions) | ||
return; | ||
|
||
let existingButton = $actions.querySelector('a.web-to-plex-button'); | ||
if (existingButton) | ||
return; | ||
|
||
let el = document.createElement('a'); | ||
|
||
el.textContent = 'Web to Plex+'; | ||
el.title = 'Loading...'; | ||
el.classList.add('web-to-plex-button', 'btn'); | ||
$actions.appendChild(el); | ||
|
||
return el; | ||
} | ||
|
||
async function initPlexThingy(type) { | ||
let $button = renderPlexButton(); | ||
|
||
if (!$button) | ||
return; | ||
|
||
let $title = document.querySelector('.copy > .title'), | ||
$year = (type === 'movie')? | ||
document.querySelector('.copy > .details'): | ||
document.querySelector('.summary ~ .title ~ *'); | ||
|
||
if (!$title || !$year) | ||
return modifyPlexButton($button, 'error', `Could not extract ${ !$title? 'title': 'year' } from Verizon`); | ||
|
||
let title = $title.textContent.trim(), | ||
year = $year.textContent.slice(0, 4).trim(); | ||
|
||
let Db = await getIDs({ title, year, APIType: type }), | ||
IMDbID = Db.imdb, | ||
TVDbID = Db.thetvdb; | ||
|
||
findPlexMedia({ type, title, year, button: $button, IMDbID, TVDbID }); | ||
} | ||
|
||
parseOptions().then(() => { | ||
window.addEventListener('popstate', init); | ||
window.addEventListener('pushstate-changed', init); | ||
init(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.