Skip to content

Commit

Permalink
fixed title regex for good (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
schaermu committed Mar 11, 2012
1 parent fa9bac3 commit d50b7f2
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var meta = module.exports = {
var video_bitrate = /bitrate: ([0-9]+) kb\/s/.exec(stderr);
var fps = /([0-9\.]+) (fps|tb\(r\))/.exec(stderr);
var container = /Input #0, ([a-zA-Z0-9]+),/.exec(stderr);
var title = /title *: ([^\n]+)/.exec(stderr);
var title = /(INAM|title)\s+:(.+)/.exec(stderr);
var video_stream = /Stream #([0-9\.]+)([a-z0-9\(\)\[\]]*)[:] Video/.exec(stderr);
var video_codec = /Video: ([\w]+)/.exec(stderr);
var duration = /Duration: (([0-9]+):([0-9]{2}):([0-9]{2}).([0-9]+))/.exec(stderr);
Expand Down Expand Up @@ -49,7 +49,7 @@ var meta = module.exports = {
var ret = {
ffmpegversion: ffmpegVersion,
durationraw: (duration && duration.length > 1) ? duration[1] : '',
title: (title && title.length > 1) ? title[1] : null,
title: (title && title.length > 2) ? title[2].trim() : null,
synched: is_synched,
video: {
container: (container && container.length > 0) ? container[1] : '',
Expand All @@ -71,14 +71,6 @@ var meta = module.exports = {
}
};

// fallback logic for title (ffmpeg version madness)
if (ret.title == 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 d50b7f2

Please sign in to comment.