Fix tabs bugs and podcast auto-ingest error

This commit is contained in:
Duncan Sommerville 2015-10-30 10:29:22 -04:00
parent d08e19a93a
commit 9af7f6dcdd
5 changed files with 26 additions and 19 deletions

View file

@ -35,9 +35,11 @@ class PodcastManager {
// that we're ingesting. // that we're ingesting.
// Note that this folds to the failure case (Celery task timeout/download failure) // Note that this folds to the failure case (Celery task timeout/download failure)
// but will at least continue to ingest new episodes. // but will at least continue to ingest new episodes.
if (!empty($episodes)) {
$podcast->setDbAutoIngestTimestamp(gmdate('r', strtotime($episodes[0]->getDbPublicationDate())))->save(); $podcast->setDbAutoIngestTimestamp(gmdate('r', strtotime($episodes[0]->getDbPublicationDate())))->save();
$service->downloadEpisodes($episodes); $service->downloadEpisodes($episodes);
} }
}
Application_Model_Preference::setPodcastPollLock(microtime(true)); Application_Model_Preference::setPodcastPollLock(microtime(true));
} }

View file

@ -374,10 +374,10 @@ var AIRTIME = (function(AIRTIME) {
//buildEditMetadataDialog(json); //buildEditMetadataDialog(json);
}); });
} else if (data.ftype === "playlist" || data.ftype === "block") { } else if (data.ftype === "playlist" || data.ftype === "block") {
AIRTIME.playlist.fnEdit(data.id, data.tr_id, baseUrl + 'playlist/edit'); AIRTIME.playlist.fnEdit(data, baseUrl + 'playlist/edit');
AIRTIME.playlist.validatePlaylistElements(); AIRTIME.playlist.validatePlaylistElements();
} else if (data.ftype === "stream") { } else if (data.ftype === "stream") {
AIRTIME.playlist.fnEdit(data.id, data.tr_id, baseUrl + 'webstream/edit'); AIRTIME.playlist.fnEdit(data, baseUrl + 'webstream/edit');
} }
}); });
}); });

View file

@ -1080,12 +1080,12 @@ var AIRTIME = (function(AIRTIME) {
}; };
} else if (data.ftype === "playlist" || data.ftype === "block") { } else if (data.ftype === "playlist" || data.ftype === "block") {
callback = function() { callback = function() {
AIRTIME.playlist.fnEdit(data.id, data.tr_id, baseUrl+'playlist/edit'); AIRTIME.playlist.fnEdit(data, baseUrl+'playlist/edit');
AIRTIME.playlist.validatePlaylistElements(); AIRTIME.playlist.validatePlaylistElements();
}; };
} else if (data.ftype === "stream") { } else if (data.ftype === "stream") {
callback = function() { callback = function() {
AIRTIME.playlist.fnEdit(data.id, data.tr_id, baseUrl + 'webstream/edit'); AIRTIME.playlist.fnEdit(data, baseUrl + 'webstream/edit');
} }
} else { } else {
throw new Exception($.i18n._("Unknown type: ") + data.ftype); throw new Exception($.i18n._("Unknown type: ") + data.ftype);

View file

@ -849,12 +849,12 @@ var AIRTIME = (function(AIRTIME){
// TODO: refactor - this code is pretty finicky... // TODO: refactor - this code is pretty finicky...
if ((name == $.i18n._("Untitled Playlist") if ((name == $.i18n._("Untitled Playlist")
|| name == $.i18n._("Untitled Smart Block")) || name == $.i18n._("Untitled Smart Block"))
&& $pl.find(".spl_sortable .spl_empty").length == 1) { && tab.contents.find(".spl_sortable .spl_empty").length == 1) {
mod.fnDelete(undefined, tab); mod.fnDelete(undefined, tab);
} else {
tab.close();
} }
tab.close();
$.ajax( { $.ajax( {
url : baseUrl+"usersettings/set-library-screen-settings", url : baseUrl+"usersettings/set-library-screen-settings",
type : "POST", type : "POST",
@ -1117,14 +1117,13 @@ var AIRTIME = (function(AIRTIME){
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initFileMdEvents); AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initFileMdEvents);
}; };
mod.fnEdit = function(id, uid, url) { mod.fnEdit = function(data, url) {
//openPlaylistPanel();
stopAudioPreview(); stopAudioPreview();
$.post(url, $.post(url,
{format: "json", id: id, type: type}, {format: "json", id: data.id, type: data.ftype},
function(json) { function(json) {
AIRTIME.tabs.openTab(json.html, uid, AIRTIME.playlist._initPlaylistTabEvents); AIRTIME.tabs.openTab(json.html, data.tr_id, AIRTIME.playlist._initPlaylistTabEvents);
redrawLib(); redrawLib();
}); });
}; };
@ -1139,10 +1138,12 @@ var AIRTIME = (function(AIRTIME){
type = pl.find('.obj_type').val(); type = pl.find('.obj_type').val();
url = baseUrl+'playlist/delete'; url = baseUrl+'playlist/delete';
console.log(id);
console.log(type);
$.post(url, $.post(url,
{format: "json", ids: id, modified: lastMod, type: type}, {format: "json", ids: id, modified: lastMod, type: type},
function(json) { function(json) {
tab.close();
redrawLib(); redrawLib();
}); });
}; };
@ -1485,14 +1486,17 @@ var AIRTIME = (function(AIRTIME){
mod.setCurrent = function(pl) { mod.setCurrent = function(pl) {
$pl = pl; $pl = pl;
var type = $pl.find('.obj_type').val();
if ($.inArray(type, Object.keys(AIRTIME.library.MediaTypeFullToStringEnum)) > -1) {
$.post(baseUrl + "playlist/change-playlist", { $.post(baseUrl + "playlist/change-playlist", {
"id": mod.getId($pl), id: mod.getId($pl),
"type": $pl.find('.obj_type').val() type: type
}); });
}
}; };
mod.init = function() { mod.init = function() {
AIRTIME.tabs.updateActiveTab();
if (!$pl) return; if (!$pl) return;
$pl.delegate(".pl-waveform-cues-btn", {"click": function(ev){ $pl.delegate(".pl-waveform-cues-btn", {"click": function(ev){

View file

@ -253,6 +253,7 @@ var AIRTIME = (function(AIRTIME){
*/ */
mod.initScheduleTab = function() { mod.initScheduleTab = function() {
$scheduleTab = Object.freeze(new ScheduleTab()); $scheduleTab = Object.freeze(new ScheduleTab());
$activeTab = $scheduleTab;
}; };
/** /**