Commit bb367fd7 authored by echel0n's avatar echel0n

Adding shows from trakt or imdb now prompt for show settings.

parent 23e70050
# Changelog
- * 9780b9d - 2018-11-30: Pre-Release v9.4.48.dev1
- * 73b8296 - 2018-11-30: Adding shows from trakt or imdb now prompt for show settings.
- * 23e7005 - 2018-11-30: Pre-Release v9.4.48.dev1
- * b266867 - 2018-11-29: Release v9.4.47
- * 58c1f5e - 2018-11-29: Added code to ensure seeders, leechers, and size are always integer values before being added to cache.
- * 80b928a - 2018-11-28: Release v9.4.46
......
......@@ -2423,8 +2423,8 @@ class HomeAddShows(Home):
showid = i
cur_dir['existing_info'] = (showid, show_name, indexer)
if showid and findCertainShow(showid): cur_dir['added_already'] = True
if showid and findCertainShow(showid):
cur_dir['added_already'] = True
return self.render(
"/home/mass_add_table.mako",
......@@ -2441,23 +2441,17 @@ class HomeAddShows(Home):
indexer, show_dir, indexer_id, show_name = self.split_extra_show(show_to_add)
use_provided_info = False
if indexer_id and indexer and show_name:
use_provided_info = True
else:
use_provided_info = False
# use the given show_dir for the indexer search if available
if not show_dir:
if search_string:
default_show_name = search_string
else:
default_show_name = ''
elif not show_name:
default_show_name = show_name or ''
if not show_dir and search_string:
default_show_name = search_string
elif not show_name and show_dir:
default_show_name = re.sub(r' \(\d{4}\)', '',
os.path.basename(os.path.normpath(show_dir)).replace('.', ' '))
else:
default_show_name = show_name
# carry a list of other dirs if given
if not other_shows:
......@@ -2466,8 +2460,7 @@ class HomeAddShows(Home):
other_shows = [other_shows]
provided_indexer_id = int(indexer_id or 0)
provided_indexer_name = show_name
provided_indexer_name = show_name or ''
provided_indexer = int(indexer or sickrage.app.config.indexer_default)
return self.render(
......@@ -2565,53 +2558,34 @@ class HomeAddShows(Home):
if findCertainShow(int(indexer_id)):
return
location = None
if sickrage.app.config.root_dirs:
root_dirs = sickrage.app.config.root_dirs.split('|')
location = root_dirs[int(root_dirs[0]) + 1]
else:
location = None
if location:
show_dir = os.path.join(location, sanitizeFileName(showName))
dir_exists = makeDir(show_dir)
if not dir_exists:
sickrage.app.log.warning("Unable to create the folder " + show_dir + ", can't add the show")
return
chmod_as_parent(show_dir)
sickrage.app.show_queue.addShow(indexer=1,
indexer_id=int(indexer_id),
showDir=show_dir,
default_status=sickrage.app.config.status_default,
quality=sickrage.app.config.quality_default,
flatten_folders=sickrage.app.config.flatten_folders_default,
subtitles=sickrage.app.config.subtitles_default,
anime=sickrage.app.config.anime_default,
scene=sickrage.app.config.scene_default,
default_status_after=sickrage.app.config.status_default_after,
skip_downloaded=sickrage.app.config.skip_downloaded_default)
sickrage.app.alerts.message(_('Adding Show'), _('Adding the specified show into ') + show_dir)
else:
if not location:
sickrage.app.log.warning("There was an error creating the show, no root directory setting found")
return _('No root directories setup, please go back and add one.')
# done adding show
return self.redirect('/home/')
show_dir = os.path.join(location, sanitizeFileName(showName))
return self.newShow('1|{show_dir}|{indexer_id}|{show_name}'.format(**{
'show_dir': '',
'indexer_id': indexer_id,
'show_name': showName
}))
def addNewShow(self, whichSeries=None, indexerLang=None, rootDir=None, defaultStatus=None,
quality_preset=None, anyQualities=None, bestQualities=None, flatten_folders=None, subtitles=None,
subtitles_sr_metadata=None, fullShowPath=None, other_shows=None, skipShow=None, providedIndexer=None,
anime=None, scene=None, blacklist=None, whitelist=None, defaultStatusAfter=None,
skip_downloaded=None):
skip_downloaded=None, providedName=None):
"""
Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are
provided then it forwards back to newShow, if not it goes to /home.
"""
if indexerLang is None:
indexerLang = sickrage.app.config.indexer_default_language
indexerLang = indexerLang or sickrage.app.config.indexer_default_language
# grab our list of other dirs if given
if not other_shows:
......@@ -2636,12 +2610,12 @@ class HomeAddShows(Home):
return finishAddShow()
# sanity check on our inputs
if not any([rootDir, fullShowPath, whichSeries]):
if not whichSeries or not any([rootDir, fullShowPath, providedName]):
return self.redirect("/home/")
# figure out what show we're adding and where
series_pieces = whichSeries.split('|')
if (whichSeries and rootDir) or (whichSeries and fullShowPath and len(series_pieces) > 1):
if (whichSeries and rootDir or whichSeries and fullShowPath) and len(series_pieces) > 1:
if len(series_pieces) < 6:
sickrage.app.log.error(
'Unable to add show due to show selection. Not anough arguments: %s' % (repr(series_pieces)))
......@@ -2653,13 +2627,12 @@ class HomeAddShows(Home):
indexer_id = int(series_pieces[3])
show_name = series_pieces[4]
else:
# if no indexer was provided use the default indexer set in General settings
if not providedIndexer:
providedIndexer = sickrage.app.config.indexer_default
indexer = int(providedIndexer)
indexer = int(providedIndexer or sickrage.app.config.indexer_default)
indexer_id = int(whichSeries)
show_name = os.path.basename(os.path.normpath(fullShowPath))
if fullShowPath:
show_name = os.path.basename(os.path.normpath(fullShowPath))
else:
show_name = providedName
# use the whole path if it's given, or else append the show name to the root dir to get the full show path
if fullShowPath:
......
......@@ -39,28 +39,38 @@
<form class="needs-validation" id="addShowForm" method="post"
action="${srWebRoot}/home/addShows/addNewShow">
<div class="card setup-content active" id="step-1">
<div class="card-header">
<h3 class="card-title">${_('Find a show')}</h3>
</div>
<div class="card-body">
<div class="form-group">
<input type="hidden" id="indexer_timeout"
value="${sickrage.app.config.indexer_timeout}"/>
% if use_provided_info:
${_('Show retrieved from existing metadata:')}
<a href="${anon_url(IndexerApi(provided_indexer).config['show_url'], provided_indexer_id)}">
${provided_indexer_name}
</a>
<input type="hidden" id="indexerLang" name="indexerLang"
value="${sickrage.app.config.indexer_default_language}"/>
<input type="hidden" id="whichSeries" name="whichSeries"
value="${provided_indexer_id}"/>
<input type="hidden" id="providedIndexer" name="providedIndexer"
value="${provided_indexer}"/>
<input type="hidden" id="providedName"
value="${provided_indexer_name}"/>
% else:
% if use_provided_info:
<input type="hidden" id="indexerLang" name="indexerLang"
value="${sickrage.app.config.indexer_default_language}"/>
<input type="hidden" id="whichSeries" name="whichSeries"
value="${provided_indexer_id}"/>
<input type="hidden" id="providedIndexer" name="providedIndexer"
value="${provided_indexer}"/>
<input type="hidden" id="providedName" name="providedName"
value="${provided_indexer_name}"/>
% endif
% if provided_show_dir:
<input type="hidden" id="fullShowPath" name="fullShowPath"
value="${provided_show_dir}"/><br>
% endif
% for curNextDir in other_shows:
<input type="hidden" name="other_shows" value="${curNextDir}"/>
% endfor
<input type="hidden" name="skipShow" id="skipShow" value=""/>
% if not use_provided_info:
<div class="card setup-content active" id="step-1">
<div class="card-header">
<h3 class="card-title">${_('Find a show')}</h3>
</div>
<div class="card-body">
<div class="form-group">
<input type="hidden" id="indexer_timeout"
value="${sickrage.app.config.indexer_timeout}"/>
<div class="row">
<div class="col-md-12">
<div class="input-group">
......@@ -107,21 +117,24 @@
</div>
<p>
<div id="messages"></div>
</div>
</div>
<div class="card-footer">
<button class="btn btn-success btn-inline ${('', 'disabled')[use_provided_info]}"
type="button" id="searchName">
${_('Search')}
</button>
<button class="btn btn-primary nextBtn ${('', 'disabled')[not use_provided_info]} pull-right"
type="button">
${_('Next')}
</button>
% if provided_show_dir:
<input class="btn float-right" type="button" id="skipShowButton"
value="${_('Skip Show')}"/>
% endif
</div>
</div>
<div class="card-footer">
<button class="btn btn-success btn-inline" type="button" id="searchName">
${_('Search')}
</button>
<button class="btn btn-primary nextBtn disabled pull-right" type="button">
${_('Next')}
</button>
% if provided_show_dir:
<input class="btn float-right" type="button" id="skipShowButton" value="${_('Skip Show')}"/>
% endif
</div>
</div>
% endif
<div class="card setup-content" id="step-2">
<div class="card-header">
......@@ -129,13 +142,11 @@
</div>
<div class="card-body">
<div class="form-group">
% if provided_show_dir:
% if not provided_show_dir:
<%include file="../includes/root_dirs.mako"/>
% else:
${_('Pre-chosen Destination Folder:')}
<b>${provided_show_dir}</b><br/>
<input type="hidden" id="fullShowPath" name="fullShowPath"
value="${provided_show_dir}"/><br>
% else:
<%include file="../includes/root_dirs.mako"/>
% endif
</div>
</div>
......@@ -161,11 +172,6 @@
</button>
</div>
</div>
% for curNextDir in other_shows:
<input type="hidden" name="other_shows" value="${curNextDir}"/>
% endfor
<input type="hidden" name="skipShow" id="skipShow" value=""/>
</form>
</div>
</div>
......
......@@ -504,8 +504,8 @@ $(document).ready(function ($) {
});
$('.modal').on('shown.bs.modal', function () {
$('body').addClass('modal-open');
$('body').removeAttr('style');
$('body').addClass('modal-open');
$('body').removeAttr('style');
})
SICKRAGE.browser.init();
......@@ -2591,11 +2591,27 @@ $(document).ready(function ($) {
SICKRAGE.home.add_show_options();
SICKRAGE.quality_chooser.init();
if ($('input:hidden[name=whichSeries]').length && $('#fullShowPath').length) {
$('.setup-content #step-1').hide();
$('.setup-content #step-2').show();
if ($('input:hidden[name=whichSeries]').length) {
$('#addShowForm')[0].classList.add('was-validated');
SICKRAGE.home.update_bwlist($('#providedName').val());
navListItems.addClass('disabled');
navListItems.removeClass('btn-success').addClass('btn-dark');
if ($('#fullShowPath').length) {
$('div.setup-panel div a[href="#step-3"]').removeClass('btn-dark').addClass('btn-success');
allWells.hide();
$('#step-3').show();
} else {
$('div.setup-panel div a[href="#step-2"]').removeClass('btn-dark').addClass('btn-success');
allWells.hide();
$('#step-2').show();
}
}
$('#nameToSearch').focus();
$('#searchName').click(function () {
if ($('#addShowForm')[0].checkValidity() === true) {
$('#addShowForm')[0].classList.add('was-validated');
......@@ -2648,8 +2664,6 @@ $(document).ready(function ($) {
if (isValid) nextStepWizard.removeClass('disabled').trigger('click');
});
$('div.setup-panel div a.btn-success').trigger('click');
$('#searchName').on('click', function () {
$('#searchName').prop('disabled', true);
SICKRAGE.home.new_show.searchIndexers();
......@@ -2661,8 +2675,6 @@ $(document).ready(function ($) {
$('#addShowForm').submit();
});
$('#nameToSearch').focus();
$('#nameToSearch').keypress(function (e) {
var keycode = (e.keyCode ? e.keyCode : e.which);
if (keycode === 13) {
......@@ -2670,6 +2682,8 @@ $(document).ready(function ($) {
$('#searchName').click();
}
});
$('div.setup-panel div a.btn-success').trigger('click');
},
searchIndexers: function () {
......@@ -2959,7 +2973,7 @@ $(document).ready(function ($) {
});
});
if( $('#pip_path').length ){
if ($('#pip_path').length) {
$('#pip_path').fileBrowser({
title: gt('Select path to pip'),
key: 'pip_path',
......@@ -2985,7 +2999,7 @@ $(document).ready(function ($) {
});
}
if( $('#git_path').length ) {
if ($('#git_path').length) {
$('#git_path').fileBrowser({
title: gt('Select path to git'),
key: 'git_path',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment