Skip to content

Commit

Permalink
Merge pull request #10491 from pymedusa/release/release-0.5.29
Browse files Browse the repository at this point in the history
Release/release 0.5.29
  • Loading branch information
p0psicles authored Apr 11, 2022
2 parents b618bb9 + 46f1cdd commit e4870f8
Show file tree
Hide file tree
Showing 103 changed files with 594 additions and 3,689 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Medusa User Related #
######################
/cache/
/cache-*/
/Logs/
/data/
restore/
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 0.5.29 (11-04-2022)

#### New Features
- Support for Plex metadata (.plexmatch) ([10466](https://github.com/pymedusa/Medusa/pull/10466))

#### Improvements
- Make the cache db and cache files optional for inclusion in the backup ([10475](https://github.com/pymedusa/Medusa/pull/10475))

#### Fixes
- Fix joining segments in log for failed episodes ([10472](https://github.com/pymedusa/Medusa/pull/10472))

## 0.5.28 (01-04-2022)

#### Improvements
Expand Down
14 changes: 12 additions & 2 deletions medusa/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def start(self, args):

# Check if we need to perform a restore first
restore_dir = os.path.join(app.DATA_DIR, 'restore')
if os.path.exists(restore_dir):
if os.path.exists(restore_dir) and os.listdir(restore_dir):
success = self.restore_db(restore_dir, app.DATA_DIR)
if self.console_logging:
sys.stdout.write('Restore: restoring DB and config.ini %s!\n' % ('FAILED', 'SUCCESSFUL')[success])
Expand Down Expand Up @@ -1009,6 +1009,7 @@ def initialize(self, console_logging=True):
app.METADATA_WDTV = check_setting_list(app.CFG, 'General', 'metadata_wdtv', ['0'] * 11, transform=int)
app.METADATA_TIVO = check_setting_list(app.CFG, 'General', 'metadata_tivo', ['0'] * 11, transform=int)
app.METADATA_MEDE8ER = check_setting_list(app.CFG, 'General', 'metadata_mede8er', ['0'] * 11, transform=int)
app.METADATA_PLEX = check_setting_list(app.CFG, 'General', 'metadata_plex', ['0'] * 11, transform=int)

app.HOME_LAYOUT = check_setting_str(app.CFG, 'GUI', 'home_layout', 'poster')
app.HISTORY_LAYOUT = check_setting_str(app.CFG, 'GUI', 'history_layout', 'detailed')
Expand Down Expand Up @@ -1052,6 +1053,9 @@ def initialize(self, console_logging=True):
app.CACHE_RECOMMENDED_TRAKT_LISTS = check_setting_list(app.CFG, 'Recommended', 'trakt_lists', app.CACHE_RECOMMENDED_TRAKT_LISTS)
app.CACHE_RECOMMENDED_PURGE_AFTER_DAYS = check_setting_int(app.CFG, 'Recommended', 'purge_after_days', 180)

app.BACKUP_CACHE_DB = check_setting_int(app.CFG, 'Backup', 'cache_db', 1)
app.BACKUP_CACHE_FILES = check_setting_int(app.CFG, 'Backup', 'cache_files', 1)

# Initialize trakt config path.
trakt.core.CONFIG_PATH = os.path.join(app.CACHE_DIR, '.pytrakt.json')
trakt.core.load_config()
Expand Down Expand Up @@ -1236,7 +1240,8 @@ def initialize(self, console_logging=True):
(app.METADATA_PS3, metadata.ps3),
(app.METADATA_WDTV, metadata.wdtv),
(app.METADATA_TIVO, metadata.tivo),
(app.METADATA_MEDE8ER, metadata.mede8er)]:
(app.METADATA_MEDE8ER, metadata.mede8er),
(app.METADATA_PLEX, metadata.plex)]:
(cur_metadata_config, cur_metadata_class) = cur_metadata_tuple
tmp_provider = cur_metadata_class.metadata_class()
tmp_provider.set_config(cur_metadata_config)
Expand Down Expand Up @@ -1687,6 +1692,7 @@ def save_config():
new_config['General']['metadata_wdtv'] = app.METADATA_WDTV
new_config['General']['metadata_tivo'] = app.METADATA_TIVO
new_config['General']['metadata_mede8er'] = app.METADATA_MEDE8ER
new_config['General']['metadata_plex'] = app.METADATA_PLEX

new_config['General']['backlog_days'] = int(app.BACKLOG_DAYS)

Expand Down Expand Up @@ -1757,6 +1763,10 @@ def save_config():
new_config['Blackhole']['nzb_dir'] = app.NZB_DIR
new_config['Blackhole']['torrent_dir'] = app.TORRENT_DIR

new_config['Backup'] = {}
new_config['Backup']['cache_db'] = int(app.BACKUP_CACHE_DB)
new_config['Backup']['cache_files'] = int(app.BACKUP_CACHE_FILES)

# dynamically save provider settings
all_providers = providers.sorted_provider_list()
for provider in all_providers:
Expand Down
6 changes: 6 additions & 0 deletions medusa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ def __init__(self):
self.EXT3_FOLDER = 'ext3'
self.STATIC_FOLDER = 'static'
self.UNKNOWN_RELEASE_GROUP = 'Medusa'

# Backup related
self.BACKUP_DIR = 'backup'
self.BACKUP_FILENAME_PREFIX = 'backup'
self.BACKUP_FILENAME = self.BACKUP_FILENAME_PREFIX + '-{timestamp}.zip'
self.BACKUP_CACHE_DB = None
self.BACKUP_CACHE_FILES = None

self.LEGACY_DB = 'sickbeard.db'
self.APPLICATION_DB = 'main.db'
self.FAILED_DB = 'failed.db'
Expand Down Expand Up @@ -229,6 +234,7 @@ def __init__(self):
self.METADATA_WDTV = []
self.METADATA_TIVO = []
self.METADATA_MEDE8ER = []
self.METADATA_PLEX = []

self.QUALITY_DEFAULT = None
self.STATUS_DEFAULT = None
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.28'
VERSION = '0.5.29'

USER_AGENT = 'Medusa/{version} ({system}; {release}; {instance})'.format(
version=VERSION, system=platform.system(), release=platform.release(),
Expand Down
2 changes: 1 addition & 1 deletion medusa/failed_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _process_release_name(self):

if segment:
self.log(logger.DEBUG, 'Created segment of episodes [{segment}] from release: {release}'.format(
segment=','.join(ep.episode for ep in segment),
segment=','.join(str(ep.episode) for ep in segment),
release=release_name
))

Expand Down
2 changes: 2 additions & 0 deletions medusa/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
kodi_12plus,
mede8er,
media_browser,
plex,
ps3,
tivo,
wdtv,
Expand All @@ -38,6 +39,7 @@
'kodi_12plus',
'mede8er',
'media_browser',
'plex',
'ps3',
'tivo',
'wdtv',
Expand Down
40 changes: 22 additions & 18 deletions medusa/metadata/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ def update_show_indexer_metadata(self, show_obj):
nfo_file_path = self.get_show_file_path(show_obj)

try:
with io.open(nfo_file_path, 'rb') as xmlFileObj:
showXML = etree.ElementTree(file=xmlFileObj)
with io.open(nfo_file_path, 'rb') as xml_file_obj:
show_xml = etree.ElementTree(file=xml_file_obj)

indexerid = showXML.find('id')
indexerid = show_xml.find('id')

root = showXML.getroot()
root = show_xml.getroot()
if indexerid is not None:
indexerid.text = str(show_obj.indexerid)
else:
Expand All @@ -311,7 +311,7 @@ def update_show_indexer_metadata(self, show_obj):
# Make it purdy
helpers.indent_xml(root)

showXML.write(nfo_file_path, encoding='UTF-8')
show_xml.write(nfo_file_path, encoding='UTF-8')
helpers.chmod_as_parent(nfo_file_path)

return True
Expand Down Expand Up @@ -967,31 +967,35 @@ def retrieveShowMetadata(self, folder):
{'name': self.name, 'location': folder})

try:
with io.open(metadata_path, 'rb') as xmlFileObj:
showXML = etree.ElementTree(file=xmlFileObj)
with io.open(metadata_path, 'rb') as xml_file_obj:
show_xml = etree.ElementTree(file=xml_file_obj)

uniqueid = showXML.find("uniqueid[@default='true']")
uniqueid = show_xml.find("uniqueid[@default='true']")
if (
showXML.findtext('title') is None or
(showXML.findtext('tvdbid') is None and showXML.findtext('id') is None and showXML.find("uniqueid[@default='true']") is None)
show_xml.findtext('title') is None
or (
show_xml.findtext('tvdbid') is None
and show_xml.findtext('id') is None
and show_xml.find("uniqueid[@default='true']") is None
)
):
log.debug(
'Invalid info in tvshow.nfo (missing name or id): {0} {1} {2}',
showXML.findtext('title'), showXML.findtext('tvdbid'), showXML.findtext('id'),
show_xml.findtext('title'), show_xml.findtext('tvdbid'), show_xml.findtext('id'),
)
return empty_return

name = showXML.findtext('title')
name = show_xml.findtext('title')

if uniqueid is not None and uniqueid.get('type') and indexer_name_mapping.get(uniqueid.get('type')):
indexer = indexer_name_mapping.get(uniqueid.get('type'))
indexer_id = int(ImdbIdentifier(uniqueid.text).series_id)
else:
# For legacy nfo's
if showXML.findtext('tvdbid'):
indexer_id = int(showXML.findtext('tvdbid'))
elif showXML.findtext('id'):
indexer_id = int(showXML.findtext('id'))
if show_xml.findtext('tvdbid'):
indexer_id = int(show_xml.findtext('tvdbid'))
elif show_xml.findtext('id'):
indexer_id = int(show_xml.findtext('id'))
else:
log.warning('Empty <id> or <tvdbid> field in NFO, unable to find a ID')
return empty_return
Expand All @@ -1002,8 +1006,8 @@ def retrieveShowMetadata(self, folder):
return empty_return

indexer = None
if showXML.findtext('episodeguide/url'):
epg_url = showXML.findtext('episodeguide/url').lower()
if show_xml.findtext('episodeguide/url'):
epg_url = show_xml.findtext('episodeguide/url').lower()
if str(indexer_id) in epg_url:
if 'thetvdb.com' in epg_url:
indexer = INDEXER_TVDBV2
Expand Down
Loading

0 comments on commit e4870f8

Please sign in to comment.