Don't return a null slice from server.ListPath, return an empty one
[armadillo.git] / 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 * @constructor
15 */
16 armadillo.TVRenamer = function(file) {
17 /**
18 * The file object
19 * @type {armadillo.File}
20 */
21 this.file_ = file;
22 }
23
24 /**
25 * Performs the information lookup and renames the file if the lookup is
26 * successful.
27 */
28 armadillo.TVRenamer.prototype.run = function() {
29 var file = this.file_;
30 var callback = function(data, stauts, xhr) {
31 if (data['error']) {
32 app.showError(data['message']);
33 } else {
34 app.clearError();
35 file.move(data['path']);
36 }
37 };
38 app.sendRequest('tv_rename', {'path':this.file_.getFullPath()},
39 callback);
40 };