dont reupload files if already on server

This commit is contained in:
j 2013-09-26 21:58:06 +00:00
parent 054d07fcf3
commit e24f83d4c6
2 changed files with 56 additions and 36 deletions

View file

@ -371,6 +371,8 @@ class File(models.Model):
for key in self.PATH_INFO:
data[key] = self.info.get(key)
data['users'] = list(set([i['user'] for i in data['instances']]))
if 'item' in keys:
data['item'] = self.item.itemId
if keys:
for k in data.keys():
if k not in keys:

View file

@ -206,6 +206,16 @@ pandora.ui.uploadVideoDialog = function(data) {
resetProgress();
$info.html(Ox._('Uploading {0}', [file.name]));
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({
filename: file.name,
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();
}
});
});
}