From c4635b6870d184642f34baa971635482e35f8e37 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 15 Dec 2010 00:09:33 -0500 Subject: [PATCH] Deal with period rather than space separators in file names. --- web_frontend/tv_renamer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web_frontend/tv_renamer.js b/web_frontend/tv_renamer.js index 782c5e4..b830365 100644 --- a/web_frontend/tv_renamer.js +++ b/web_frontend/tv_renamer.js @@ -87,11 +87,17 @@ armadillo.TVRenamer.prototype.lookupHandler_ = function(e) { * @private */ armadillo.TVRenamer.prototype.parseName_ = function(name) { - var pattern = /^(\d+_)?(.+) S?(\d+)(x|E)(\d+)/i; + var pattern = /^(\d+_)?(.+)( |\.)S?(\d+)(x|E)(\d+)/i; var matches = name.match(pattern); + console.log(matches); if (!matches || matches.length < 5) return null; - return [matches[2], parseInt(matches[3], 10), parseInt(matches[5], 10)]; + // If the separator between the show title and episode is a period, then + // it's likely of the form "some.show.name.s03e06.720p.blah.mkv", so strip the + // periods in the title. + if (matches[3] == '.') + matches[2] = matches[2].replace('.', ' '); + return [matches[2], parseInt(matches[4], 10), parseInt(matches[6], 10)]; }; /** -- 2.22.5