Skip to content

Commit

Permalink
added fallback regex for title fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
schaermu committed Mar 11, 2012
1 parent c17d064 commit 7fe38f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ var meta = module.exports = {
var rotate = /rotate[\s]+:[\s]([\d]{2,3})/.exec(stderr);

// get ffmpeg version
console.log(stderr);
var getVersion = /ffmpeg version (?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)/i.exec(stderr);
var ffmpegVersion = 0;
if (getVersion) {
Expand Down Expand Up @@ -72,6 +71,14 @@ var meta = module.exports = {
}
};

// fallback logic for title (ffmpeg version madness)
if (ret.titlr == null) {
var title_fallback = /INAM\s+\:(.+)/exec(stderr);
if (title_fallback && title_fallback.length > 1) {
ret.title = title_fallback[1];
}
}

// calculate duration in seconds
if (duration && duration.length > 1) {
var parts = duration[1].split(':');
Expand Down

0 comments on commit 7fe38f7

Please sign in to comment.