Skip to content

Commit

Permalink
Merge pull request #9701 from pymedusa/release/release-0.5.14
Browse files Browse the repository at this point in the history
Release/release 0.5.14
  • Loading branch information
p0psicles authored Jul 6, 2021
2 parents 64df36d + 892be07 commit db102f3
Show file tree
Hide file tree
Showing 95 changed files with 3,244 additions and 1,370 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## 0.5.14 (06-07-2021)

#### New Features
- Added support for Prowlarr ([9653](https://github.com/pymedusa/Medusa/pull/9653))

#### Improvements
- Vueified config/providers ([9653](https://github.com/pymedusa/Medusa/pull/9653))
- Added support for Prowlarr (an alternative to Jackett) ([9653](https://github.com/pymedusa/Medusa/pull/9653))
- Added feature to test provider results ([9698](https://github.com/pymedusa/Medusa/pull/9698))

#### Fixes
- Fix email notifications for per show notifications with special chars ([9652](https://github.com/pymedusa/Medusa/pull/9652))
- Fix adding an existing show did not run refresh from disk after ([9694](https://github.com/pymedusa/Medusa/pull/9694))
- Fix filter displayShow episodes by overview status ([9691](https://github.com/pymedusa/Medusa/pull/9691))
- Fix main page not reflecting correct 'next episode date' ([9689](https://github.com/pymedusa/Medusa/pull/9689))

-----

## 0.5.13 (16-06-2021)

#### Fixes
Expand Down
17 changes: 16 additions & 1 deletion medusa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ def initialize(self, console_logging=True):
app.CREATE_MISSING_SHOW_DIRS = bool(check_setting_int(app.CFG, 'General', 'create_missing_show_dirs', 0))
app.ADD_SHOWS_WO_DIR = bool(check_setting_int(app.CFG, 'General', 'add_shows_wo_dir', 0))

app.PROWLARR_URL = check_setting_str(app.CFG, 'Prowlarr', 'url', '', censor_log='normal')
app.PROWLARR_APIKEY = check_setting_str(app.CFG, 'Prowlarr', 'apikey', '', censor_log='high')

app.NZBS = bool(check_setting_int(app.CFG, 'NZBs', 'nzbs', 0))
app.NZBS_UID = check_setting_str(app.CFG, 'NZBs', 'nzbs_uid', '', censor_log='normal')
app.NZBS_HASH = check_setting_str(app.CFG, 'NZBs', 'nzbs_hash', '', censor_log='low')
Expand Down Expand Up @@ -1078,6 +1081,9 @@ def initialize(self, console_logging=True):
app.TORZNAB_PROVIDERS = check_setting_list(app.CFG, 'Torznab', 'torznab_providers')
app.torznab_providers_list = TorznabProvider.get_providers_list(app.TORZNAB_PROVIDERS)

app.PROWLARR_PROVIDERS = check_setting_list(app.CFG, 'Prowlarr', 'providers')
# TODO implement ProwlarrProvider.get_providers_list(app.PROWLARR_PROVIDERS)

all_providers = providers.sorted_provider_list()

# dynamically load provider settings
Expand Down Expand Up @@ -1126,6 +1132,8 @@ def initialize(self, console_logging=True):
load_provider_setting(app.CFG, provider, 'string', 'url', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'list', 'cat_ids', '', split_value=',')
load_provider_setting(app.CFG, provider, 'list', 'cap_tv_search', '', split_value=',')
load_provider_setting(app.CFG, provider, 'string', 'manager', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'id_manager', '', censor_log='low')

if isinstance(provider, NewznabProvider):
# non configurable
Expand All @@ -1134,6 +1142,8 @@ def initialize(self, console_logging=True):
load_provider_setting(app.CFG, provider, 'bool', 'needs_auth', 1)
# configurable
load_provider_setting(app.CFG, provider, 'list', 'cat_ids', '', split_value=',')
load_provider_setting(app.CFG, provider, 'string', 'manager', '', censor_log='low')
load_provider_setting(app.CFG, provider, 'string', 'id_manager', '', censor_log='low')

if not os.path.isfile(app.CONFIG_FILE):
logger.debug(u'Unable to find {config!r}, all settings will be default!', config=app.CONFIG_FILE)
Expand Down Expand Up @@ -1697,7 +1707,7 @@ def save_config():
'all': [
'name', 'url', 'cat_ids', 'api_key', 'username', 'search_mode', 'search_fallback',
'enable_daily', 'enable_backlog', 'enable_manualsearch', 'enable_search_delay',
'search_delay',
'search_delay', 'manager', 'id_manager'
],
'encrypted': [
'password',
Expand Down Expand Up @@ -1987,6 +1997,11 @@ def save_config():
new_config['Torznab'] = {}
new_config['Torznab']['torznab_providers'] = app.TORZNAB_PROVIDERS

new_config['Prowlarr'] = {}
new_config['Prowlarr']['providers'] = app.PROWLARR_PROVIDERS
new_config['Prowlarr']['url'] = app.PROWLARR_URL
new_config['Prowlarr']['apikey'] = app.PROWLARR_APIKEY

new_config['GUI'] = {}
new_config['GUI']['theme_name'] = app.THEME_NAME
new_config['GUI']['fanart_background'] = app.FANART_BACKGROUND
Expand Down
5 changes: 5 additions & 0 deletions medusa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,11 @@ def __init__(self):

self.NEWZNAB_PROVIDERS = []

# Prowlarr section.
self.PROWLARR_URL = ''
self.PROWLARR_APIKEY = ''
self.PROWLARR_PROVIDERS = []

self.TORRENTRSS_PROVIDERS = []

self.TORZNAB_PROVIDERS = []
Expand Down
2 changes: 1 addition & 1 deletion medusa/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
log.logger.addHandler(logging.NullHandler())

INSTANCE_ID = text_type(uuid.uuid1())
VERSION = '0.5.13'
VERSION = '0.5.14'
USER_AGENT = 'Medusa/{version} ({system}; {release}; {instance})'.format(
version=VERSION, system=platform.system(), release=platform.release(),
instance=INSTANCE_ID)
Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def notify_snatch(ep_obj, result):

for n in notifiers:
try:
n.notify_snatch(title, message)
n.notify_snatch(title, message, ep_obj=ep_obj)
except (RequestException, socket.gaierror, socket.timeout) as error:
log.debug(u'Unable to send snatch notification. Error: {0!r}', error)

Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/boxcar2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _send_boxcar2(self, msg, title, accesstoken):
log.debug('Boxcar2 notification successful.')
return True

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
"""Send the snatch message."""
if app.BOXCAR2_NOTIFY_ONSNATCH:
self._notify_boxcar2(title, message)
Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _send_discord_msg(self, title, msg, webhook=None, tts=False):
log.info(message)
return success, message

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
"""
Send a Discord notification when an episode is snatched.
Expand Down
56 changes: 32 additions & 24 deletions medusa/notifiers/emailnotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ def test_notify(self, host, port, smtp_from, use_tls, user, pwd, to):
msg['Date'] = formatdate(localtime=True)
return self._sendmail(host, port, smtp_from, use_tls, user, pwd, [to], msg, True)

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, ep_obj):
"""
Send a notification that an episode was snatched.
ep_name: The name of the episode that was snatched
:param title: Notification title.
:param message: Notification message.
:param ep_obj: Episode object. Used for the show's series and indexer id.
"""
if app.USE_EMAIL and app.EMAIL_NOTIFY_ONSNATCH:
parsed = self._parse_name(message)
to = self._generate_recipients(parsed['show'])
to = self._generate_recipients(ep_obj.series)
if not to:
log.debug('Skipping email notify because there are no configured recipients')
else:
Expand All @@ -83,12 +85,12 @@ def notify_snatch(self, title, message):
'<body style="font-family:Helvetica, Arial, sans-serif;">'
'<h3>Medusa Notification - Snatched</h3><br>'
'<p>Show: <b>{show}</b></p><br>'
'<p>Episode: <b>{ep_id}{episode}</b></p><br><br>'
'<p>Episode: <b>{ep_id} - {episode}</b></p><br><br>'
'<footer style="margin-top: 2.5em; padding: .7em 0; '
'color: #777; border-top: #BBB solid 1px;">'
'Powered by Medusa.</footer></body>'.format(
show=parsed['show'],
ep_id=(parsed['ep_id'] + ' - ') if 'ep_id' in parsed else '',
show=ep_obj.series.title,
ep_id=ep_obj.slug,
episode=parsed['episode']
),
'html'))
Expand Down Expand Up @@ -118,15 +120,15 @@ def notify_download(self, ep_obj, title='Completed:'):
"""
Send a notification that an episode was downloaded.
ep_name: The name of the episode that was downloaded
title: The title of the notification (optional)
:param ep_obj: The episode object.
:param title: The title of the notification (optional)
"""
if app.USE_EMAIL and app.EMAIL_NOTIFY_ONDOWNLOAD:
title = notifyStrings[NOTIFY_DOWNLOAD]
ep_name = ep_obj.pretty_name_with_quality()

parsed = self._parse_name(ep_name)
to = self._generate_recipients(parsed['show'])
to = self._generate_recipients(ep_obj.series)
if not to:
log.debug('Skipping email notify because there are no configured recipients')
else:
Expand All @@ -136,12 +138,12 @@ def notify_download(self, ep_obj, title='Completed:'):
'<body style="font-family:Helvetica, Arial, sans-serif;">'
'<h3>Medusa Notification - Downloaded</h3><br>'
'<p>Show: <b>{show}</b></p><br>'
'<p>Episode: <b>{ep_id}{episode}</b></p><br><br>'
'<p>Episode: <b>{ep_id} - {episode}</b></p><br><br>'
'<footer style="margin-top: 2.5em; padding: .7em 0; '
'color: #777; border-top: #BBB solid 1px;">'
'Powered by Medusa.</footer></body>'.format(
show=parsed['show'],
ep_id=(parsed['ep_id'] + ' - ') if 'ep_id' in parsed else '',
show=ep_obj.series.title,
ep_id=ep_obj.slug,
episode=parsed['episode']
),
'html'))
Expand Down Expand Up @@ -171,15 +173,15 @@ def notify_subtitle_download(self, ep_obj, lang):
"""
Send a notification that a subtitle was downloaded.
ep_name: The name of the episode that was downloaded
lang: Subtitle language wanted
:param ep_obj: Episode object.
:param lang: Subtitle language wanted
"""
if app.USE_EMAIL and app.EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD:
title = notifyStrings[NOTIFY_SUBTITLE_DOWNLOAD]
ep_name = ep_obj.pretty_name()

parsed = self._parse_name(ep_name)
to = self._generate_recipients(parsed['show'])
to = self._generate_recipients(ep_obj.series)
if not to:
log.debug('Skipping email notify because there are no configured recipients')
else:
Expand All @@ -189,13 +191,13 @@ def notify_subtitle_download(self, ep_obj, lang):
'<body style="font-family:Helvetica, Arial, sans-serif;">'
'<h3>Medusa Notification - Subtitle Downloaded</h3><br>'
'<p>Show: <b>{show}</b></p><br>'
'<p>Episode: <b>{ep_id}{episode}</b></p><br>'
'<p>Episode: <b>{ep_id} - {episode}</b></p><br>'
'<p>Language: <b>{lang}</b></p><br><br>'
'<footer style="margin-top: 2.5em; padding: .7em 0; '
'color: #777; border-top: #BBB solid 1px;">'
'Powered by Medusa.</footer></body>'.format(
show=parsed['show'],
ep_id=(parsed['ep_id'] + ' - ') if 'ep_id' in parsed else '',
show=ep_obj.series.title,
ep_id=ep_obj.slug,
episode=parsed['episode'],
lang=lang
),
Expand Down Expand Up @@ -224,7 +226,7 @@ def notify_git_update(self, new_version='??'):
"""
Send a notification that Medusa was updated.
new_version: The commit Medusa was updated to
:param new_version: The commit Medusa was updated to
"""
if app.USE_EMAIL:
title = notifyStrings[NOTIFY_GIT_UPDATE]
Expand Down Expand Up @@ -265,7 +267,7 @@ def notify_login(self, ipaddress=''):
"""
Send a notification that Medusa was logged into remotely.
ipaddress: The ip Medusa was logged into from
:param ipaddress: The ip Medusa was logged into from
"""
if app.USE_EMAIL:
title = notifyStrings[NOTIFY_LOGIN]
Expand Down Expand Up @@ -302,7 +304,13 @@ def notify_login(self, ipaddress=''):
log.warning('Login notification error: {0}', self.last_err)

@staticmethod
def _generate_recipients(show):
def _generate_recipients(show_obj):
"""
Generate a list of email recipients for a specific show.
Search the tv_shows table for entries in the notify_list field.
:param show_obj: Show object.
"""
addrs = []
main_db_con = db.DBConnection()

Expand All @@ -314,12 +322,12 @@ def _generate_recipients(show):
)

# Grab the per-show-notification recipients
if show:
if show_obj:
sql_results = main_db_con.select(
'SELECT notify_list '
'FROM tv_shows '
'WHERE show_name = ?',
[show]
'WHERE indexer_id = ? AND indexer = ? ',
[show_obj.series_id, show_obj.indexer]
)
for row in sql_results:
if not row['notify_list']:
Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/freemobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _sendFreeMobileSMS(self, title, msg, cust_id=None, apiKey=None):
log.info(message)
return True, message

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
if app.FREEMOBILE_NOTIFY_ONSNATCH:
self._notifyFreeMobile(title, message)

Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/growl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_notify(self, host, password):
return self._sendGrowl('Test Growl', 'Testing Growl settings from Medusa', 'Test', host, password,
force=True)

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
if app.GROWL_NOTIFY_ONSNATCH:
self._sendGrowl(title, message)

Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_notify(self, join_api, join_device):
force=True
)

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
"""Send Join notification when nzb snatched if selected in config."""
if app.JOIN_NOTIFY_ONSNATCH:
self._sendjoin(
Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def _update_library(self, host=None, series_name=None):
# Public functions which will call the JSON or Legacy HTTP API methods
##############################################################################

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
"""Send the snatch message."""
if app.KODI_NOTIFY_ONSNATCH:
self._notify_kodi(title, message)
Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/libnotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def init_notify(self):
self.gobject = GObject
return True

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
if app.LIBNOTIFY_NOTIFY_ONSNATCH:
self._notify(title, message)

Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/nmj.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def notify_settings(self, host):

return True

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
return False
# Not implemented: Start the scanner when snatched does not make any sense

Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/nmjv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class Notifier(object):
def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
return False
# Not implemented: Start the scanner when snatched does not make any sense

Expand Down
2 changes: 1 addition & 1 deletion medusa/notifiers/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _notify_pht(title, message, host=None, username=None, password=None, force=F
# Public functions
##############################################################################

def notify_snatch(self, title, message):
def notify_snatch(self, title, message, **kwargs):
if app.PLEX_NOTIFY_ONSNATCH:
self._notify_pht(title, message)

Expand Down
Loading

0 comments on commit db102f3

Please sign in to comment.