Remove a few calls do document.createElement
[armadillo.git] / web_frontend / tv_renamer.js
1 //
2 // Armadillo File Manager
3 // Copyright (c) 2010-2011, Robert Sesek <http://www.bluestatic.org>
4 //
5 // This program is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free Software
7 // Foundation, either version 3 of the License, or any later version.
8 //
9
10 $.namespace('armadillo.TVRenamer');
11
12 /**
13 * Creates a helper to rename a file in a pretty format for TV episodes.
14 * @extends {goog.Disposable}
15 * @constructor
16 */
17 armadillo.TVRenamer = function(file) {
18 /**
19 * The file object
20 * @type {armadillo.File}
21 */
22 this.file_ = file;
23 }
24
25 /**
26 * Performs the information lookup and renames the file if the lookup is
27 * successful.
28 */
29 armadillo.TVRenamer.prototype.run = function() {
30 var file = this.file_;
31 var callback = function(data, stauts, xhr) {
32 if (data['error']) {
33 app.showError(data['message']);
34 } else {
35 app.clearError();
36 file.move(data['path']);
37 }
38 };
39 app.sendRequest('tv_rename', {'path':this.file_.getFullPath()},
40 callback);
41 };