-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add optional metadata grabber for television: tvmaze
See https://www.tvmaze.com/ https://www.tvmaze.com/api This commit adds an alternative metadata grabber for TV-Series. The tvmaze metadata grabber follows the defintions in https://www.mythtv.org/wiki/MythTV_Universal_Metadata_Format To enable this grabber, run in mythtv frontend "Setup" -> "Artwork and Data Sources" and select 'TVMaze.com' for the default TelevisionGrabber. Once done, you can check this global setting with mysql: [mythconverg]> select * from settings where value like '%grabber%'; +--------------------+-------------------------------+----------+ | value | data | hostname | +--------------------+-------------------------------+----------+ | TelevisionGrabber | metadata/Television/tvmaze.py | NULL | | MovieGrabber | metadata/Movie/tmdb3.py | NULL | +--------------------+-------------------------------+----------+ Any further metadata update will then use these grabbers. Note: The tvmaze grabber is compatible to python 2.7 and 3.6+.
- Loading branch information
Showing
13 changed files
with
2,170 additions
and
2 deletions.
There are no files selected for viewing
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
Empty file.
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,54 @@ | ||
# -*- coding: UTF-8 -*- | ||
|
||
# Copyright (c) 2020 Lachlan Mackenzie | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
|
||
# --------------------------------------------------- | ||
# Roland Ernst | ||
# Changes implemented for MythTV: | ||
# - added python2 compatibility | ||
# | ||
# --------------------------------------------------- | ||
|
||
|
||
from __future__ import unicode_literals | ||
|
||
# python 3 doesn't have a unicode type | ||
try: | ||
unicode | ||
except: | ||
unicode = str | ||
|
||
|
||
class Embed(object): | ||
def __init__(self, data): | ||
self.key = 'embed' | ||
self.value = None | ||
if isinstance(data, unicode): | ||
self.key = 'embed' | ||
self.value = data | ||
if isinstance(data, list) and len(data) > 0: | ||
if all(isinstance(item, unicode) for item in data): | ||
self.key = 'embed[]' | ||
self.value = data | ||
|
||
def __str__(self): | ||
return self.key + ': ' + self.value |
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,40 @@ | ||
# -*- coding: UTF-8 -*- | ||
|
||
# Copyright (c) 2020 Lachlan Mackenzie | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
|
||
from __future__ import unicode_literals | ||
|
||
|
||
API_URL = 'https://api.tvmaze.com' | ||
search_show_name = 'https://api.tvmaze.com/search/shows?' | ||
search_show_best_match = 'https://api.tvmaze.com/singlesearch/shows?' | ||
search_external_show_id = 'https://api.tvmaze.com/lookup/shows?' | ||
show_information = 'https://api.tvmaze.com/shows/{0}' | ||
show_episode_list = 'https://api.tvmaze.com/shows/{0}/episodes?' | ||
show_episode = 'http://api.tvmaze.com/shows/{0}/episodebynumber?' | ||
show_episodes_on_date = 'http://api.tvmaze.com/shows/{0}/episodesbydate?' | ||
show_season_list = 'http://api.tvmaze.com/shows/{0}/seasons' | ||
season_episode_list = 'http://api.tvmaze.com/seasons/{0}/episodes' | ||
show_alias_list = 'http://api.tvmaze.com/shows/{0}/akas' | ||
episode_information = 'http://api.tvmaze.com/episodes/{0}?' | ||
show_cast = 'http://api.tvmaze.com/shows/{0}/cast' | ||
show_crew = 'http://api.tvmaze.com/shows/{0}/crew' |
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,55 @@ | ||
# -*- coding: UTF-8 -*- | ||
|
||
# Copyright (c) 2020 Lachlan Mackenzie | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
|
||
# --------------------------------------------------- | ||
# Roland Ernst | ||
# Changes implemented for MythTV: | ||
# - added method utils.convert_date | ||
# | ||
# --------------------------------------------------- | ||
|
||
|
||
from __future__ import unicode_literals | ||
|
||
from . import utils | ||
|
||
|
||
class Episode(object): | ||
def __init__(self, data): | ||
self.id = data.get('id') | ||
self.url = data.get('url') | ||
self.name = data.get('name') | ||
self.season = data.get('season') | ||
self.number = data.get('number') | ||
self.airdate = utils.convert_date(data.get('airdate')) | ||
self.airtime = data.get('airtime') | ||
self.timestamp = data.get('airstamp') | ||
self.duration = data.get('runtime') | ||
self.images = data.get('image') | ||
self.summary = utils.strip_tags(data.get('summary')) | ||
self.links = data.get('_links') | ||
self.special = self.number == 0 | ||
|
||
def __str__(self): | ||
return 'S{}E{} {}'.format(self.season, self.number, self.name) | ||
# return f'S{self.season}E{self.number} {self.name}' if not self.special else f'Special: {self.name}' |
Oops, something went wrong.