Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CSS and podcast import robustness

  • Loading branch information...
commit da1f3a7b1550393ccf927eace1f770ee19bff3ee 1 parent c88c0b3
@jwheare authored
Showing with 17 additions and 5 deletions.
  1. +3 −0  public/playlick.css
  2. +14 −5 src/js/importers.js
View
3  public/playlick.css
@@ -375,6 +375,7 @@ form#playlistEditForm p.field input {
/* Tracks loading/error */
p#tracksLoading {
+ clear: both;
display: none;
margin: 0 0 20px 40px;
line-height: 39px;
@@ -385,6 +386,7 @@ p#tracksLoading img {
padding-right: 11px;
}
p#tracksError {
+ clear: both;
display: none;
margin: 0 0 20px 40px;
line-height: 39px;
@@ -444,6 +446,7 @@ a#playlistApplescript img {
/* Add track form */
form#addTrackForm {
+ clear: both;
position: relative;
border-bottom: 1px solid #c0e95b;
border-right: 24px solid #fff;
View
19 src/js/importers.js
@@ -168,9 +168,18 @@ IMPORTERS = {
},
getStringItem: function (field) {
var fields = $.makeArray(field);
- return $.grep(fields, function (value, i) {
+ var string = $.grep(fields, function (value, i) {
return typeof value == 'string';
})[0];
+ if (!string) {
+ string = $.grep(fields, function (value, i) {
+ return value.content;
+ })[0] || '';
+ if (string) {
+ string = string.content;
+ }
+ }
+ return string;
},
createPlaylistFromPodcast: function (source, podcast, callback, exception) {
if (!podcast.item) {
@@ -193,7 +202,7 @@ IMPORTERS = {
subtitle: subtitle,
description: description,
copyright: IMPORTERS.getStringItem(podcast.copyright),
- image: IMPORTERS.getAbsoluteUrl(image),
+ image: IMPORTERS.getAbsoluteUrl(image, source),
url: IMPORTERS.getStringItem(podcast.link),
source: source
});
@@ -201,7 +210,7 @@ IMPORTERS = {
$.each(trackList, function (i, data) {
var trackDoc = {
name: data.title,
- artist: data.author || podcast.author
+ artist: data.author ? (data.author.name || IMPORTERS.getStringItem(data.author)) : IMPORTERS.getStringItem(podcast.author)
};
// TODO support media:content alternative
// e.g. <media:content url="blah.mp3" fileSize="46669578" type="audio/mpeg">
@@ -245,7 +254,7 @@ IMPORTERS = {
subtitle: subtitle,
description: description,
copyright: IMPORTERS.getStringItem(podcast.copyright),
- image: IMPORTERS.getAbsoluteUrl(image),
+ image: IMPORTERS.getAbsoluteUrl(image, source),
url: link,
source: source
});
@@ -253,7 +262,7 @@ IMPORTERS = {
$.each(trackList, function (i, data) {
var trackDoc = {
name: data.title,
- artist: data.author ? (data.author.name || IMPORTERS.getStringItem(data.author)) : podcast.author
+ artist: data.author ? (data.author.name || IMPORTERS.getStringItem(data.author)) : IMPORTERS.getStringItem(podcast.author)
};
// TODO support media:content alternative
// e.g. <media:content url="blah.mp3" fileSize="46669578" type="audio/mpeg">
Please sign in to comment.
Something went wrong with that request. Please try again.