dont reupload files if already on server
This commit is contained in:
parent
054d07fcf3
commit
e24f83d4c6
2 changed files with 56 additions and 36 deletions
|
@ -371,6 +371,8 @@ class File(models.Model):
|
||||||
for key in self.PATH_INFO:
|
for key in self.PATH_INFO:
|
||||||
data[key] = self.info.get(key)
|
data[key] = self.info.get(key)
|
||||||
data['users'] = list(set([i['user'] for i in data['instances']]))
|
data['users'] = list(set([i['user'] for i in data['instances']]))
|
||||||
|
if 'item' in keys:
|
||||||
|
data['item'] = self.item.itemId
|
||||||
if keys:
|
if keys:
|
||||||
for k in data.keys():
|
for k in data.keys():
|
||||||
if k not in keys:
|
if k not in keys:
|
||||||
|
|
|
@ -206,6 +206,16 @@ pandora.ui.uploadVideoDialog = function(data) {
|
||||||
resetProgress();
|
resetProgress();
|
||||||
$info.html(Ox._('Uploading {0}', [file.name]));
|
$info.html(Ox._('Uploading {0}', [file.name]));
|
||||||
Ox.oshash(file, function(oshash) {
|
Ox.oshash(file, function(oshash) {
|
||||||
|
pandora.api.findMedia({
|
||||||
|
query: {
|
||||||
|
conditions: [{key: 'oshash', value: oshash}]
|
||||||
|
},
|
||||||
|
keys: ['id', 'item', 'available']
|
||||||
|
}, function(result) {
|
||||||
|
if (
|
||||||
|
result.data.items.length === 0
|
||||||
|
|| !result.data.items[0].available
|
||||||
|
) {
|
||||||
pandora.api.addMedia({
|
pandora.api.addMedia({
|
||||||
filename: file.name,
|
filename: file.name,
|
||||||
id: oshash,
|
id: oshash,
|
||||||
|
@ -245,6 +255,14 @@ pandora.ui.uploadVideoDialog = function(data) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
pandora.UI.set({
|
||||||
|
item: result.data.items[0].item,
|
||||||
|
itemView: 'media'
|
||||||
|
});
|
||||||
|
that.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue