2 // Armadillo File Manager
3 // Copyright (c) 2010-2011, Robert Sesek <http://www.bluestatic.org>
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.
10 goog
.provide('armadillo.TVRenamer');
12 goog
.require('goog.Disposable');
13 goog
.require('goog.net.XhrIo');
16 * Creates a helper to rename a file in a pretty format for TV episodes.
17 * @extends {goog.Disposable}
20 armadillo
.TVRenamer
= function(file
) {
25 * @type {armadillo.File}
29 goog
.inherits(armadillo
.TVRenamer
, goog
.Disposable
);
34 armadillo
.TVRenamer
.prototype.disposeInternal
= function() {
35 goog
.base(this, 'disposeInternal');
40 * Performs the information lookup and renames the file if the lookup is
43 armadillo
.TVRenamer
.prototype.run
= function() {
44 var file
= this.file_
;
45 var callback
= function(xhr
) {
46 var data
= xhr
.currentTarget
.getResponseJson();
48 app
.showError(data
['message']);
51 file
.move(data
['path']);
54 app
.sendRequest('tv_rename', {'path':this.file_
.getFullPath()},