forked from slash2009/XWMM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.js
218 lines (196 loc) · 4.85 KB
/
global.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
var myVersion = '2.1.0'
function mergeJson(object1, object2) {
var i;
for (i in object2)
object1[i]=object2[i];
}
function removeSpace(string) {
string = string.replace(/^\s*|\s*$/g,'');
return string;
}
var menuBar = new Ext.Toolbar({
region: "north",
height: 30,
items: [{
xtype: 'tbspacer'
},{
xtype: 'tbbutton',
text: 'Movies',
width: 60,
menu: [{
text: 'Movies List',
iconCls: 'silk-grid',
handler: function(){window.location = '../movies/index.html'}
},{
text: 'Movies by Genre',
disabled: 'true',
iconCls: 'silk-grid',
handler: function(){window.location = '../movies/moviegenre.html'}
},{
text: 'Most recent',
iconCls: 'silk-grid',
handler: function(){window.location = '../movies/movierecent.html'}
}]
},{
xtype: 'tbspacer'
},{
xtype: 'tbbutton',
text: ' TV-Shows ',
width: 60,
handler: function(){window.location = '../tvshows/index.html'}
},{
xtype: 'tbspacer'
},{
xtype: 'tbbutton',
text: 'Music',
width: 60,
menu: [{
text: 'Artist / Album',
iconCls: 'silk-grid',
handler: function(){window.location = '../music/index.html'}
},{
text: 'Genre / Album',
iconCls: 'silk-grid',
handler: function(){window.location = '../music/albumgenres.html'}
},{
text: 'Year / Album',
iconCls: 'silk-grid',
handler: function(){window.location = '../music/yearalbum.html'}
}]
},{
xtype: 'tbspacer'
},{
xtype: 'tbbutton',
text: 'Files',
width: 60,
handler: function(){window.location = '../files/index.html'}
}]
})
Number.prototype.unsign = function(bytes) {
return this >= 0 ? this : this - Number.MIN_VALUE*2;
};
function parseXBMCXml(xmlString) {
var tempTable = xmlString.replace(/<\/thumb>/g, ";");
tempTable = tempTable.replace(/<([^>]+)>/g,'');
tempTable = tempTable.split(";");
var x = tempTable.pop();
return tempTable;
}
// Credit to Fiasco from the xbmc forum
function FindCRC(data) {
var CRC=0xffffffff;
data = data.toLowerCase();
for (var j=0; j<data.length; j++) {
var c = data.charCodeAt(j);
CRC ^= c << 24;
for(var i = 0; i<8; i++) {
if(CRC.unsign(8) & 0x80000000) {
CRC = (CRC << 1) ^ 0x04C11DB7;
} else{
CRC <<= 1;
}
}
}
if ( CRC < 0 ) CRC = CRC>>>0;
var temp = CRC.toString(16);
if (temp.length < 8) { return "0"+temp}
else return CRC.toString(16);
};
function copyXBMCVideoThumb(thumb, r, element, type) {
var src = 'special://profile/Thumbnails/Video/'+thumb.substring(0,1)+'/'+thumb+'.tbn';
var dst = 'special://xbmc/web/XWMM/cache/Video/'+thumb.substring(0,1)+'/'+thumb+'.tbn';
var inputUrl = '/xbmcCmds/xbmcHttp?command=FileCopy('+src+';'+dst+')';
var temp = '';
Ext.Ajax.request({
url: inputUrl,
//async: false,
method: 'GET',
success: function (t){
// if (type == 'season') {
// if (t.responseText.substr(11,5) == 'Error'){temp = '../images/nobanner.png'}
// else {temp = '../cache/Video/'+thumb.substring(0,1)+'/'+thumb+'.tbn'};
// r.data.seasonCover = temp;
// element.el.dom.src = r.data.seasonCover
// }
// else {
if (t.responseText.substr(11,5) == 'Error'){temp = '../images/nobanner.png'}
else {temp = '../cache/Video/'+thumb.substring(0,1)+'/'+thumb+'.tbn'};
r.data.ShowCover = temp;
element.el.dom.src = r.data.ShowCover
//};
},
failure: function(t){},
timeout: 2000
})
};
var responseFinale = [];
var movieTable = [];
var currentShowPath;
var selectedMovie;
var currentRecord;
var currentMovie;
var DetailsFlag;
var detailPanel;
var VideoFlagsPanel = new Ext.Panel({
border: false,
defaults:{xtype:'container'},
items: [{
id: 'videocodec',
width:84,
height:31,
autoEl: {tag: 'img', src: "../images/flags/default.png"}
},{
width:84,
height:31,
id: 'resolution',
autoEl: {tag: 'img', src: "../images/flags/defaultscreen.png"}
},{
id: 'aspect',
width:48,
height:31,
autoEl: {tag: 'img', src: "../images/flags/default.png"}
}]
});
var AudioFlagsPanel = new Ext.Panel({
border: false,
defaults:{xtype:'container', width: 64, height: 44},
items: [{
id: 'audiocodec',
autoEl: {tag: 'img', src: "../images/flags/defaultsound.png"}
},{
id: 'audiochannels',
autoEl: {tag: 'img', src: "../images/flags/0c.png"}
}]
});
function findResolution(iWidth) {
if (iWidth == 0)
return "defaultscreen";
else if (iWidth < 721)
return "480";
// 960x540
else if (iWidth < 961)
return "540";
// 1280x720
else if (iWidth < 1281)
return "720";
// 1920x1080
else
return "1080";
}
function findAspect(vAspect) {
if (vAspect == 0)
return "default";
if (vAspect < 1.4)
return "1.33";
else if (vAspect < 1.7)
return "1.66";
else if (vAspect < 1.8)
return "1.78";
else if (vAspect < 1.9)
return "1.85";
else if (vAspect < 2.3)
return "2.20";
else
return "2.35";
}
var savingMessage = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});