From 5484510c7ddcdd25890b882d4c0a81ca2ab34a15 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 14 Nov 2010 12:31:12 -0500 Subject: [PATCH] Error out if a filename can't be parsed in the TVRenamer. --- web_frontend/tv_renamer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web_frontend/tv_renamer.js b/web_frontend/tv_renamer.js index 3388ab6..5134b62 100644 --- a/web_frontend/tv_renamer.js +++ b/web_frontend/tv_renamer.js @@ -43,6 +43,10 @@ armadillo.TVRenamer.prototype.disposeInternal = function() { armadillo.TVRenamer.prototype.run = function() { console.log('running for ' + this.file_.getName()); var data = this.parseName_(this.file_.getName()); + if (!data) { + app.showError('Could not parse episode information for ' + this.file_.getName()); + return; + } var url = this.buildURL_(data[0], data[1], data[2]); console.log('url = ' + url); goog.net.XhrIo.send('/proxy?url=' + encodeURIComponent(url), @@ -51,7 +55,7 @@ armadillo.TVRenamer.prototype.run = function() { /** * Callback for when the network data is received. - * @param {object} response + * @param {Event} e * @private */ armadillo.TVRenamer.prototype.lookupHandler_ = function(e) { @@ -79,7 +83,7 @@ armadillo.TVRenamer.prototype.lookupHandler_ = function(e) { * @private */ armadillo.TVRenamer.prototype.parseName_ = function(name) { - var pattern = /^(\d+_)?(.+) S?(\d+)(x|E)(\d+)/; + var pattern = /^(\d+_)?(.+) S?(\d+)(x|E)(\d+)/i; var matches = name.match(pattern); if (!matches || matches.length < 5) return null; -- 2.43.5