pig-media-server 2 → 100
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.babelrc +3 -0
- data/Gemfile +1 -0
- data/front/application.js +71 -0
- data/front/components/custom.js +35 -0
- data/front/components/head.js +38 -0
- data/front/components/index.js +23 -0
- data/front/components/item.js +63 -0
- data/front/components/latest.js +32 -0
- data/front/components/new_flag.js +29 -0
- data/front/components/no_match.js +10 -0
- data/front/components/pager.js +38 -0
- data/{javascripts → front}/components/player.js +7 -11
- data/{javascripts → front}/components/query_list.js +6 -23
- data/front/components/recommend.js +41 -0
- data/front/components/search.js +87 -0
- data/front/components/search_box.js +56 -0
- data/{javascripts → front}/components/watch.js +8 -5
- data/front/controller.js +22 -0
- data/{javascripts/event_dispatcher.js → front/models/base.js} +1 -5
- data/front/models/config.js +12 -0
- data/front/models/custom.js +41 -0
- data/front/models/custom_list.js +12 -0
- data/front/models/latest.js +60 -0
- data/front/models/list.js +76 -0
- data/front/models/playing.js +11 -0
- data/front/models/recent.js +34 -0
- data/front/models/recommend.js +13 -0
- data/front/models/session.js +16 -0
- data/lib/pig-media-server/api.rb +35 -3
- data/lib/pig-media-server/backup.rb +3 -7
- data/lib/pig-media-server/model/comic.rb +1 -1
- data/lib/pig-media-server/model/data.rb +85 -81
- data/lib/pig-media-server/model/data_use_rdb.rb +124 -0
- data/lib/pig-media-server/version.rb +1 -1
- data/lib/pig-media-server/views/bundle.js +48 -13
- data/package.json +13 -18
- data/webpack.build.js +25 -0
- data/webpack.config.js +30 -0
- metadata +34 -19
- data/gulpfile.js +0 -33
- data/javascripts/application.js +0 -117
- data/javascripts/components/head.js +0 -106
- data/javascripts/components/list.js +0 -104
- data/javascripts/components/new_flag.js +0 -23
- data/javascripts/components/sort.js +0 -64
- data/javascripts/controller.js +0 -62
- data/javascripts/custom_list.js +0 -14
- data/javascripts/recent.js +0 -34
- data/javascripts/utils.js +0 -22
- data/javascripts/video.js +0 -10
- /data/{javascripts → front}/chromecast.js +0 -0
data/javascripts/controller.js
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
class Controller {
|
2
|
-
route(){
|
3
|
-
var query =this.params().query;
|
4
|
-
var result = {}
|
5
|
-
switch(location.pathname){
|
6
|
-
case "/":
|
7
|
-
result.page = "list";
|
8
|
-
if(!!query){
|
9
|
-
result.api_url = `/api/r/search?query=${query}`
|
10
|
-
if(!!this.params().sort){ result.api_url += `&sort=${this.params().sort}` }
|
11
|
-
if(!!this.params().order){ result.api_url += `&order=${this.params().order}` }
|
12
|
-
if(!!this.params().page){ result.api_url += `&page=${this.params().page}` }
|
13
|
-
$('title').text(decodeURIComponent(this.query()));
|
14
|
-
} else {
|
15
|
-
result.api_url = null;
|
16
|
-
}
|
17
|
-
break;
|
18
|
-
|
19
|
-
case "/latest":
|
20
|
-
result.page = "list";
|
21
|
-
result.api_url = '/api/r/latest';
|
22
|
-
$('title').text("Latest - Pig Media Server");
|
23
|
-
break;
|
24
|
-
case "/custom":
|
25
|
-
result.page = "list";
|
26
|
-
result.api_url = `/api/r/custom?name=${this.params().name}`;
|
27
|
-
$('title').text(decodeURIComponent(this.params().name));
|
28
|
-
break;
|
29
|
-
|
30
|
-
case "/recommend":
|
31
|
-
result.page = "list";
|
32
|
-
result.api_url = `/api/r/recommend?name=${this.params().name}`;
|
33
|
-
$('title').text('Recommend');
|
34
|
-
break;
|
35
|
-
}
|
36
|
-
return result;
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
params(){
|
42
|
-
var arg = new Object;
|
43
|
-
var pair = location.search.substring(1).split('&');
|
44
|
-
for(var i=0; pair[i]; i++) {
|
45
|
-
var kv = pair[i].split('=');
|
46
|
-
arg[kv[0]] = kv[1];
|
47
|
-
}
|
48
|
-
return arg;
|
49
|
-
}
|
50
|
-
|
51
|
-
query(){ return this.params().query; }
|
52
|
-
|
53
|
-
can_sort_and_paging(){
|
54
|
-
if(location.pathname == '/'){
|
55
|
-
return !!this.query();
|
56
|
-
} else {
|
57
|
-
return false;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
window.Controller = Controller;
|
data/javascripts/custom_list.js
DELETED
data/javascripts/recent.js
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
class Recent {
|
2
|
-
constructor(app){
|
3
|
-
this.app = app;
|
4
|
-
}
|
5
|
-
|
6
|
-
login(){ return !!this.app.state.session.user_id }
|
7
|
-
|
8
|
-
load(){
|
9
|
-
if(this.login()){
|
10
|
-
var dd = new Date();
|
11
|
-
$.get('/recents', {stamp: dd.getTime()}).done((data)=>{
|
12
|
-
this.app.state.recents = data;
|
13
|
-
this.app.update_state();
|
14
|
-
});
|
15
|
-
} else {
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
use(key){
|
20
|
-
if(this.login()){
|
21
|
-
var dd = new Date();
|
22
|
-
$.get('/recents', {stamp: dd.getTime()}).done((recents)=>{
|
23
|
-
recents[key] = {time: parseInt((new Date)/1000), type: 'movie'}
|
24
|
-
$.post("/recents", {data: JSON.stringify(recents)});
|
25
|
-
this.app.state.recents = recents;
|
26
|
-
this.app.update_state();
|
27
|
-
});
|
28
|
-
} else {
|
29
|
-
console.log("kotti");
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
window.Recent = Recent;
|
data/javascripts/utils.js
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
window.round = (i)=>{
|
2
|
-
i = i*10;
|
3
|
-
return Math.round(i)/10
|
4
|
-
}
|
5
|
-
|
6
|
-
window.size_pretty = (size)=>{
|
7
|
-
var size = parseFloat(String(size));
|
8
|
-
var result = size;
|
9
|
-
if(size < 1024){
|
10
|
-
result = `${size} Bytes`
|
11
|
-
} else if(size < 1024*1024){
|
12
|
-
result = `${round(size / 1024)} KB`
|
13
|
-
} else if(size < 1024*1024*1024){
|
14
|
-
result = `${round(size / (1024*1024))} MB`
|
15
|
-
} else if(size < 1024*1024*1024*1024){
|
16
|
-
result = `${round(size / (1024*1024*1024))} GB`
|
17
|
-
}
|
18
|
-
return result
|
19
|
-
}
|
20
|
-
|
21
|
-
|
22
|
-
window.ext = (str)=>{ return String(str).split('.').pop().toLowerCase(); }
|
data/javascripts/video.js
DELETED
File without changes
|