Skip to content

Commit

Permalink
take old services code out of upload.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kookster committed Nov 20, 2014
1 parent 9bb2e08 commit 024678f
Showing 1 changed file with 3 additions and 50 deletions.
53 changes: 3 additions & 50 deletions src/app/upload/upload.js
@@ -1,6 +1,6 @@
/* istanbul ignore next */
if (FEAT.TCF_DEMO) {
angular.module('prx.upload', ['ui.router', 'angular-dnd', 'angular-evaporate', 'angular-uuid', 'angular-id3'])
angular.module('prx.upload', ['ui.router', 'angular-dnd', 'angular-evaporate', 'angular-uuid', 'prx.analyze-audio'])
.config(function ($stateProvider, evaporateProvider) {
$stateProvider.state('upload', {
url: '/upload',
Expand Down Expand Up @@ -122,58 +122,11 @@ if (FEAT.TCF_DEMO) {
}

this.validate = function (file) {
Id3Service.analyze(file).then(function (tags) {
console.log('tags', tags);
file.tags = tags;
}, function (err) {
console.log('err', err);
} );
return $timeout(angular.noop, Math.random() * 1500 + 500).then(validationResult(file));
};
})
.service('MimeType', function MimeTypeService() {

var expectedMimeTypes = {
"aif": "audio\/x-aiff",
"aifc": "audio\/x-aiff",
"aiff": "audio\/x-aiff",
"caf": "audio\/x-caf",
"flac": "audio\/x-flac",
"m2a": "audio\/mpeg",
"m3a": "audio\/mpeg",
"m4a": "audio\/mp4",
"mp2": "audio\/mpeg",
"mp2a": "audio\/mpeg",
"mp3": "audio\/mpeg",
"mp4": "video\/mp4",
"mp4a": "audio\/mp4",
"mpga": "audio\/mpeg",
"oga": "audio\/ogg",
"ogg": "audio\/ogg",
"spx": "audio\/ogg",
"wav": "audio\/x-wav",
"weba": "audio\/webm",
"gif": "image\/gif",
"jpe": "image\/jpeg",
"jpeg": "image\/jpeg",
"jpg": "image\/jpeg",
"png": "image\/png",
"svg": "image\/svg+xml",
"svgz": "image\/svg+xml",
"webp": "image\/webp"
};

this.lookup = function(file, defaultType) {
defaultType = defaultType || "application\/octet-stream";
window.validateFile = file;

var type = file.type;
if (typeof type === 'undefined' || type === null || type === '') {
var ext = file.name.split('.').pop();
type = expectedMimeTypes[ext];
}
return type || defaultType;
return $timeout(angular.noop, Math.random() * 1500 + 500).then(validationResult(file));
};

})
.service('Upload', function UploadService(evaporate, $uuid, MimeType, $q) {

Expand Down

0 comments on commit 024678f

Please sign in to comment.