Skip to content

Commit

Permalink
Added support for Letterboxd
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Rigal committed Apr 14, 2022
1 parent 086b959 commit 485a2f4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
35 changes: 35 additions & 0 deletions js/content-scripts/letterboxd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
let overseerrContainer, tmdbId, mediaType, mediaInfo;

containerOptions.anchorElement = `div.review.body-text`;
containerOptions.containerClass = 'py-2';
containerOptions.plexButtonClass = 'bg-gray-800';
containerOptions.badgeBackground = '#283038';

mediaType = 'movie';

tmdbButton = $('a[data-track-action=TMDb]:first');
tmdbURL = tmdbButton.attr('href');

const tmdbRegex = /.*\/movie\/(\d+)(?:\w|-)*/;
let matches = tmdbURL.match(tmdbRegex);
if (matches !== null && matches.length > 1) {
tmdbId = parseInt(matches[1]);
console.log(`TMDB id: ${tmdbId}`);

initializeContainer();
insertSpinner();

pullStoredData(function() {
if (!userId) {
removeSpinner();
insertNotLoggedInButton();
return;
}
chrome.runtime.sendMessage({contentScriptQuery: 'queryMedia', tmdbId: tmdbId, mediaType: mediaType}, json => {
mediaInfo = json;
removeSpinner();
fillContainer(json.mediaInfo);
});
});
}

6 changes: 5 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Overseerr Assistant",
"version": "1.1.1",
"version": "1.2.0",
"description": "Browser extension for Overseerr that embeds buttons into IMDb and TMDB web pages to easily request movies and tv shows.",
"permissions": ["activeTab", "storage"],
"host_permissions": ["http://*/", "https://*/"],
Expand Down Expand Up @@ -35,6 +35,10 @@
"matches": ["https://thetvdb.com/movies/*", "https://thetvdb.com/series/*"],
"css": ["css/overseerr.min.css", "css/style.css"],
"js": ["js/lib/jquery-3.5.1.min.js", "js/storage.js", "js/overseerr-container.js", "js/content-scripts/tvdb.js"]
},{
"matches": ["https://letterboxd.com/film/*"],
"css": ["css/overseerr.min.css", "css/style.css"],
"js": ["js/lib/jquery-3.5.1.min.js", "js/storage.js", "js/overseerr-container.js", "js/content-scripts/letterboxd.js"]
}],
"options_page": "options.html",
"background": {
Expand Down

0 comments on commit 485a2f4

Please sign in to comment.