forked from 0x2620/pandora
refactor media import
This commit is contained in:
parent
79d0d8e290
commit
e0163ed881
1 changed files with 7 additions and 1 deletions
|
@ -82,7 +82,7 @@ pandora.ui.importMediaDialog = function(options) {
|
||||||
width: 544
|
width: 544
|
||||||
});
|
});
|
||||||
|
|
||||||
function addMedia(url, callback) {
|
function getMediaUrlInfo(url, callback) {
|
||||||
pandora.api.getMediaUrlInfo({url: url}, function(result) {
|
pandora.api.getMediaUrlInfo({url: url}, function(result) {
|
||||||
// FIXME: support playlists / multiple items
|
// FIXME: support playlists / multiple items
|
||||||
var info = result.data.items[0];
|
var info = result.data.items[0];
|
||||||
|
@ -116,6 +116,12 @@ pandora.ui.importMediaDialog = function(options) {
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
|
callback(values, info)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addMedia(url, callback) {
|
||||||
|
getMediaUrlInfo(url, function(values, info) {
|
||||||
pandora.api.add({title: values.title || info.title}, function(result) {
|
pandora.api.add({title: values.title || info.title}, function(result) {
|
||||||
var edit = Ox.extend(
|
var edit = Ox.extend(
|
||||||
Ox.filter(values, function(value, key) {
|
Ox.filter(values, function(value, key) {
|
||||||
|
|
Loading…
Reference in a new issue