Permalink
Browse files

Fixed a bug in new track ingestion

  • Loading branch information...
1 parent bea9dc0 commit 11dabcbb7a6b3d572ce59937c6b2b96c2b7db024 @jhurliman committed Feb 23, 2012
Showing with 25 additions and 25 deletions.
  1. +1 −1 README.md
  2. +24 −24 controllers/fingerprinter.js
View
@@ -62,7 +62,7 @@ The /debug endpoint can be visited in a browser and provides a human-friendly
way of querying for a match and observing results. Here is a screenshot of the
debug interface in action:
-![](http://github.com/jhurliman/node-echoprint-server/raw/master/docs/node-echoprint-debug01.png)
+![](https://github.com/jhurliman/node-echoprint-server/raw/master/docs/node-echoprint-debug01.png)
## Sponsors ##
@@ -403,33 +403,33 @@ function ingest(fp, callback) {
} else {
createArtistAndTrack();
}
+ }
+
+ // Function for creating a new artist and new track
+ function createArtistAndTrack() {
+ var artistID = newArtistID();
+ log.info('Creating artist ' + artistID + ' ("' + fp.artist + '")');
- // Function for creating a new artist and new track
- var createArtistAndTrack = function() {
- var artistID = newArtistID();
- log.info('Creating artist ' + artistID + ' ("' + fp.artist + '")');
-
- database.addArtist(artistID, fp.artist, function(err) {
- if (err) { gMutex.release(); return callback(err, null); }
- createTrack(artistID, fp.artist);
- });
- };
+ database.addArtist(artistID, fp.artist, function(err) {
+ if (err) { gMutex.release(); return callback(err, null); }
+ createTrack(artistID, fp.artist);
+ });
+ }
+
+ // Function for creating a new track given an artistID
+ function createTrack(artistID, artist) {
+ var trackID = newTrackID();
+ log.info('Creating track ' + trackID + ' ("' + fp.track + '")');
- // Function for creating a new track given an artistID
- var createTrack = function(artistID, artist) {
- var trackID = newTrackID();
- log.info('Creating track ' + trackID + ' ("' + fp.track + '")');
+ database.addTrack(trackID, artistID, fp, function(err) {
+ if (err) { gMutex.release(); return callback(err, null); }
- database.addTrack(trackID, artistID, fp, function(err) {
- if (err) { gMutex.release(); return callback(err, null); }
-
- // Success
- log.info('Track insert complete');
- gMutex.release();
- callback(null, { track_id: trackID, track: fp.track,
- artist_id: artistID, artist: artist });
- });
- };
+ // Success
+ log.info('Track insert complete');
+ gMutex.release();
+ callback(null, { track_id: trackID, track: fp.track,
+ artist_id: artistID, artist: artist });
+ });
}
});
});

0 comments on commit 11dabcb

Please sign in to comment.