Skip to content

Commit

Permalink
[metadata.themoviedb.org.python] 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmrector committed Dec 28, 2024
1 parent 123f893 commit 3e24d26
Show file tree
Hide file tree
Showing 86 changed files with 434 additions and 95 deletions.
24 changes: 11 additions & 13 deletions metadata.themoviedb.org.python/addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="metadata.themoviedb.org.python"
name="The Movie Database Python"
version="3.0.1"
version="3.1.0"
provider-name="Team Kodi">
<requires>
<import addon="xbmc.metadata" version="2.1.0"/>
Expand All @@ -11,17 +11,15 @@
library="python/scraper.py"/>
<extension point="xbmc.addon.metadata">
<reuselanguageinvoker>true</reuselanguageinvoker>
<news>v3.0.1 (2024-04-22)
<news>v3.1.0 (2024-12-28)
- add option to increase available artwork per art type
- fix for inability to scrape IMDB ratings

v3.0.1 (2024-04-22)
- fix scraper error when tags are disabled

v3.0.0 (2024-04-17)
- version 3 for Kodi 20 Nexus and above

v2.2.1 (2024-04-12)
- Update YouTube plugin URL for trailers

v2.2.0 (2024-01-10)
- Support IMDB/TMDB IDs in filename for Kodi 21 Omega (uniqueIDs directly from Kodi)</news>
- version 3 for Kodi 20 Nexus and above</news>
<platform>all</platform>
<license>GPL-2.0-or-later</license>
<forum>https://forum.kodi.tv/showthread.php?tid=344580</forum>
Expand All @@ -43,7 +41,7 @@ v2.2.0 (2024-01-10)
<summary lang="en_NZ">Python TMDB Movie Scraper</summary>
<summary lang="en_US">Python TMDB Movie Scraper</summary>
<summary lang="es_AR">Scraper de Películas de TheMovieDB</summary>
<summary lang="es_ES">Scraper de películas de TheMovieDB</summary>
<summary lang="es_ES">Scraper de películas para TheMovieDB</summary>
<summary lang="es_MX">Scraper de Películas TMDb</summary>
<summary lang="et_EE">Python TMDB filmikaabits</summary>
<summary lang="fi_FI">The Movie Database (TMDB) Python -tietolähde elokuville</summary>
Expand All @@ -69,7 +67,7 @@ v2.2.0 (2024-01-10)
<summary lang="pl_PL">Ekstraktor filmowy TMDB</summary>
<summary lang="pt_BR">Scraper de Filmes TMDb</summary>
<summary lang="pt_PT">Colector de filmes TMDb</summary>
<summary lang="ro_RO">Scraper de filme TMDb</summary>
<summary lang="ro_RO">Catalog de filme TMDb</summary>
<summary lang="ru_RU">Инфоресурс на базе TMDB</summary>
<summary lang="se">Skrapa för TMDb</summary>
<summary lang="sk_SK">Phyton TheMovieDB sťahovač filmových metadát</summary>
Expand All @@ -95,7 +93,7 @@ v2.2.0 (2024-01-10)
<description lang="en_NZ">themoviedb.org is a free and open movie database. It&apos;s completely user driven by people like you. TMDb is currently used by millions of people every month and with their powerful API, it is also used by many popular media centers like Kodi to retrieve Movie Metadata, Posters and Fanart to enrich the user&apos;s experience.</description>
<description lang="en_US">themoviedb.org is a free and open movie database. It&apos;s completely user driven by people like you. TMDb is currently used by millions of people every month and with their powerful API, it is also used by many popular media centers like Kodi to retrieve Movie Metadata, Posters and Fanart to enrich the user&apos;s experience.</description>
<description lang="es_AR">themovieDB.org es una base de datos de películas gratuita y abierta. Está formada con contenido subido por usuarios como vos. TMDb es actualmente utilizada por millones de personas cada mes y, gracias a su poderosa API, es usada por muchos programas populares como Kodi para descargar Información de Películas, Posters y Fanart para enriquecer la experiencia de usar Kodi.</description>
<description lang="es_ES">themovieDB.org es una base de datos de películas libre y abierta. Esta completamente gestionada por gente como tu. TMDb se usa diariamente por millones de personas gracias a su potente API, que es usada por más programas aparte de Kodi para descargar información de películas así como Carteles o Fanart (Fondos de escritorio basados en películas usados en distintos skins) para enriquecer la experiencia de usar Kodi.</description>
<description lang="es_ES">themovieDB.org es una base de datos de películas gratuita y abierta. Esta completamente gestionada por gente como . TMDb se usa diariamente por millones de personas gracias a su potente API, que es usada por más programas aparte de Kodi para descargar información de películas así como pósters o fanart para enriquecer la experiencia de usar Kodi.</description>
<description lang="es_MX">themoviedb.org es una base de datos de películas gratis y abierta. Es completamente manejada por usuarios y personas como tu. Actualmente TMDb es usada por millones de personas cada mes, y dado a su poderosa API, es usada también por varios media centers populares como Kodi para obtener Metada de Películas, Posters y Fanarts, enriqueciendo de esta manera la experiencia del usuario.</description>
<description lang="et_EE">themoviedb.org on tasuta ja avatud filmide andmebaas. See on täielikult kasutajate poolt hooldatud. TMDb-d kasutavad igal kuul miljonid inimesed. Seda kasutatakse kasutajakogemuse rikastamiseks paljudes teistes populaarsetes programmides, nagu Kodi, laadides alla filmiteavet, plakateid ja fännikunsti.</description>
<description lang="fi_FI">The Movie Database (TMDB) on yhteisön ylläpitämä, ilmainen ja avoin tietokanta elokuville ja televisiosarjoille. Palvelulla on miljoonia kuukausittaisia käyttäjiä ja sen tehokkaan rajapinnan avulla Kodi ja monet muut mediasovellukset voivat hyödyntää palvelun metatietoja ja mediakuvituksia käyttökokemuksen parantamiseen. Tietokannan vahva painotus kansaivälisyyteen ja kattava tietomäärä on suurelta osin ylivertainen ja olemme tästä erittäin ylpeitä. Yksinkertaisesti sanoen, elämme ja hengitämme yhteisönä ja juuri se tekee meistä erilaisia.</description>
Expand All @@ -119,7 +117,7 @@ v2.2.0 (2024-01-10)
<description lang="pl_PL">themoviedb.org jest wolną i otwartą filmową bazą danych. Jest ona całkowicie zarządzana przez osoby takie jak Ty. Obecnie odwiedzają ją miliony osób miesięcznie, a dzięki dostępności interfejsu programistycznego jest używana przez wiele centrów multimedialnych, takich jak Kodi, do pobierania informacji o filmach, plakatów i fototapet.</description>
<description lang="pt_BR">O themoviedb.org é um banco de dados aberto e gratuito. É completamente operado por pessoas como você. O TMDb é atualmente usado por milhares de pessoas a cada mês e com sua poderosa API, é usado por muitas centrais de mídia populares como o Kodi para buscar metadados, cartazes e fanart de filmes para enriquecer a experiência do usuário.</description>
<description lang="pt_PT">O themoviedb.org é uma base de dados de filmes livre e aberta. É actualizado inteiramente por pessoas como você e usado por milhões todos os meses. Com o poderoso motor de busca disponível, também se tornou no favorito para muitos programas de centro de média, como o popular Kodi, para obter informação, posters e fanart que enriquecem a experiência do utilizador.</description>
<description lang="ro_RO">themoviedb.org este o bază de date de filme gratuită și deschisă. Este actualizată de oameni ca și tine. TMDb este curent folosită de milioane de oameni în fiecare lună și datorită API-ului puternic, este de asemena folosită de multe centre media populare ca Kodi pentru a obține informații despre filme, afișe și imagini produse de fani (Fanart) care îmbogățesc experiența utilizatorului.</description>
<description lang="ro_RO">themoviedb.org este o bază de date de filme gratuită și deschisă. Este actualizată de oameni ca și tine. TMDb este actual folosită de milioane de oameni în fiecare lună și datorită API-ului puternic, este de asemenea folosită de multe centre media populare ca Kodi pentru a obține informații despre filme, afișe, decoruri și imagini produse de fani (Fanart), care îmbogățesc experiența utilizatorului.</description>
<description lang="ru_RU">themoviedb.org — это бесплатная и открытая база данных фильмов. Она полностью поддерживается обычными людьми. В данный момент сайт TMDb используют миллионы людей каждый месяц, и благодаря мощному API его могут использовать различные популярные медиацентры, такие как Kodi, чтобы получать метаданные, постеры и фанарт для фильмов с целью красивого оформления интерфейса.</description>
<description lang="se">themoviedb.org är en fri och öppen filmdatabas. Det drivs helt av människor som dig. TMDb används av miljontals människor varje månad och med deras kraftfulla API, är det också använt av många populära mediacenter som Kodi för att hämta filmmetadata, omslag och fanart för att förgylla användarens upplevelse.</description>
<description lang="sk_SK">themoviedb.org je voľná a otvorená databáza filmov. Je výlučne vedená užívateľmi ako si ty. TMDb je každý mesiac používaná miliónmi ľudí, a vďaka svojmu výkonnému API je veľmi populárna medzi &apos;media centrami&apos; ako Kodi pre sťahovanie filmových metadát, plagátov a fanartov pre obohatenie zážitkov.</description>
Expand Down
4 changes: 4 additions & 0 deletions metadata.themoviedb.org.python/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v3.1.0 (2024-12-28)
- add option to increase available artwork per art type
- fix for inability to scrape IMDB ratings

v3.0.1 (2024-04-22)
- fix scraper error when tags are disabled

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@


def set_headers(headers):
HEADERS.clear()
HEADERS.update(headers)


Expand All @@ -65,6 +66,8 @@ def load_info(url, params=None, default=None, resp_type = 'json'):
url = url + '?' + urlencode(params)
if xbmc:
xbmc.log('Calling URL "{}"'.format(url), xbmc.LOGDEBUG)
if HEADERS:
xbmc.log(str(HEADERS), xbmc.LOGDEBUG)
req = Request(url, headers=HEADERS)
try:
response = urlopen(req)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
'movieposter': 'poster'
}

HEADERS = (
('User-Agent', 'Kodi Movie scraper by Team Kodi'),
('api-key', API_KEY),
)


def get_details(uniqueids, clientkey, language, set_tmdbid):
media_id = _get_mediaid(uniqueids)
if not media_id:
Expand Down Expand Up @@ -48,7 +54,7 @@ def _get_mediaid(uniqueids):
return uniqueids[source]

def _get_data(media_id, clientkey):
headers = {'api-key': API_KEY}
headers = dict(HEADERS)
if clientkey:
headers['client-key'] = clientkey
api_utils.set_headers(headers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
IMDB_VOTES_REGEX_PREVIOUS = re.compile(r'itemprop="ratingCount".*?>.*?([\d,]+).*?<')
IMDB_TOP250_REGEX_PREVIOUS = re.compile(r'Top Rated Movies #(\d+)')

HEADERS = (
('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'),
('Accept', 'application/json'),
)

def get_details(uniqueids):
imdb_id = get_imdb_id(uniqueids)
if not imdb_id:
Expand All @@ -40,6 +45,7 @@ def get_details(uniqueids):
return _assemble_imdb_result(votes, rating, top250)

def _get_ratinginfo(imdb_id):
api_utils.set_headers(dict(HEADERS))
response = api_utils.load_info(IMDB_RATINGS_URL.format(imdb_id), default = '', resp_type='text')
return _parse_imdb_result(response)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
('User-Agent', 'Kodi Movie scraper by Team Kodi'),
('Accept', 'application/json'),
)
api_utils.set_headers(dict(HEADERS))

TMDB_PARAMS = {'api_key': 'f090bb54758cabf231fb605d3e3e0468'}
BASE_URL = 'https://api.themoviedb.org/3/{}'
Expand Down Expand Up @@ -61,6 +60,7 @@ def search_movie(query, year=None, language=None, page=None):
params['page'] = page
if year is not None:
params['year'] = str(year)
api_utils.set_headers(dict(HEADERS))
return api_utils.load_info(theurl, params=params)


Expand All @@ -77,6 +77,7 @@ def find_movie_by_external_id(external_id, language=None):
theurl = FIND_URL.format(external_id)
params = _set_params(None, language)
params['external_source'] = 'imdb_id'
api_utils.set_headers(dict(HEADERS))
return api_utils.load_info(theurl, params=params)


Expand All @@ -93,6 +94,7 @@ def get_movie(mid, language=None, append_to_response=None):
"""
xbmc.log('using movie id of %s to get movie details' % mid, xbmc.LOGDEBUG)
theurl = MOVIE_URL.format(mid)
api_utils.set_headers(dict(HEADERS))
return api_utils.load_info(theurl, params=_set_params(append_to_response, language))


Expand All @@ -108,6 +110,7 @@ def get_collection(collection_id, language=None, append_to_response=None):
"""
xbmc.log('using collection id of %s to get collection details' % collection_id, xbmc.LOGDEBUG)
theurl = COLLECTION_URL.format(collection_id)
api_utils.set_headers(dict(HEADERS))
return api_utils.load_info(theurl, params=_set_params(append_to_response, language))


Expand All @@ -119,6 +122,7 @@ def get_configuration():
:return: configuration details or error
"""
xbmc.log('getting configuration details', xbmc.LOGDEBUG)
api_utils.set_headers(dict(HEADERS))
return api_utils.load_info(CONFIG_URL, params=TMDB_PARAMS.copy())


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
('trakt-api-version', '2'),
('Content-Type', 'application/json'),
)
api_utils.set_headers(dict(HEADERS))

MOVIE_URL = 'https://api.trakt.tv/movies/{}'

Expand All @@ -46,6 +45,7 @@ def get_trakt_ratinginfo(uniqueids):
result = {}
url = MOVIE_URL.format(imdb_id)
params = {'extended': 'full'}
api_utils.set_headers(dict(HEADERS))
movie_info = api_utils.load_info(url, params=params, default={})
if(movie_info):
if 'votes' in movie_info and 'rating' in movie_info:
Expand Down
9 changes: 4 additions & 5 deletions metadata.themoviedb.org.python/python/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,10 @@ def _searchresult_to_listitem(movie):

return listitem

# Low limit because a big list of artwork can cause trouble in some cases
# Default limit of 10 because a big list of artwork can cause trouble in some cases
# (a column can be too large for the MySQL integration),
# and how useful is a big list anyway? Not exactly rhetorical, this is an experiment.
IMAGE_LIMIT = 10

def add_artworks(listitem, artworks):
def add_artworks(listitem, artworks, IMAGE_LIMIT):
infotag = listitem.getVideoInfoTag()
for arttype, artlist in artworks.items():
if arttype == 'fanart':
Expand Down Expand Up @@ -144,7 +142,8 @@ def get_details(input_uniqueids, handle, settings, fail_silently=False):
infotag.setCast(build_cast(details['cast']))
infotag.setUniqueIDs(details['uniqueids'], 'tmdb')
infotag.setRatings(build_ratings(details['ratings']), find_defaultrating(details['ratings']))
add_artworks(listitem, details['available_art'])
IMAGE_LIMIT = settings.getSettingInt('maxartwork')
add_artworks(listitem, details['available_art'], IMAGE_LIMIT)

xbmcplugin.setResolvedUrl(handle=handle, succeeded=True, listitem=listitem)
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: XBMC Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2024-01-09 21:13+0000\n"
"Last-Translator: Heiko Berner <[email protected]>\n"
Expand Down Expand Up @@ -85,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr "Stel plakkate vanaf TMDb in staat"

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr "Taal vir Fanart.tv kunswerke"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ msgstr ""
"Project-Id-Version: XBMC Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"PO-Revision-Date: 2024-08-08 13:26+0000\n"
"Last-Translator: \"Enol P.\" <[email protected]>\n"
"Language-Team: Asturian (Spain) <https://kodi.weblate.cloud/projects/kodi-add-ons-information-providers/metadata-themoviedb-org-python/ast_es/>\n"
"Language: ast_es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

msgctxt "Addon Summary"
msgid "Python TMDB Movie Scraper"
Expand Down Expand Up @@ -84,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr ""
Expand All @@ -102,4 +107,4 @@ msgstr ""

msgctxt "#30999"
msgid "Fanart.tv"
msgstr "Fanart.tv"
msgstr ""
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr "Мова для ілюстрацый з Fanart.tv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: XBMC Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2024-01-27 10:13+0000\n"
"Last-Translator: Xavi Carol <[email protected]>\n"
Expand Down Expand Up @@ -85,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr "Activa els posters de TMDb"

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr "Idioma per a les obres d'art de Fanart.tv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: XBMC Addons\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2023-09-11 11:11+0000\n"
"Last-Translator: HansCR <[email protected]>\n"
Expand Down Expand Up @@ -85,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr "Povolit plakáty z TMDb"

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr "Jazyk pro grafiku z Fanart.tv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ msgctxt "#30014"
msgid "Enable posters from TMDb"
msgstr ""

msgctxt "#30015"
msgid "Maximum number of each artwork type - many artwork can cause an error scraping to MySQL database"
msgstr ""

msgctxt "#30100"
msgid "Language for Fanart.tv artwork"
msgstr ""
Expand Down
Loading

0 comments on commit 3e24d26

Please sign in to comment.