pig-media-server 2 → 100

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +3 -0
  3. data/Gemfile +1 -0
  4. data/front/application.js +71 -0
  5. data/front/components/custom.js +35 -0
  6. data/front/components/head.js +38 -0
  7. data/front/components/index.js +23 -0
  8. data/front/components/item.js +63 -0
  9. data/front/components/latest.js +32 -0
  10. data/front/components/new_flag.js +29 -0
  11. data/front/components/no_match.js +10 -0
  12. data/front/components/pager.js +38 -0
  13. data/{javascripts → front}/components/player.js +7 -11
  14. data/{javascripts → front}/components/query_list.js +6 -23
  15. data/front/components/recommend.js +41 -0
  16. data/front/components/search.js +87 -0
  17. data/front/components/search_box.js +56 -0
  18. data/{javascripts → front}/components/watch.js +8 -5
  19. data/front/controller.js +22 -0
  20. data/{javascripts/event_dispatcher.js → front/models/base.js} +1 -5
  21. data/front/models/config.js +12 -0
  22. data/front/models/custom.js +41 -0
  23. data/front/models/custom_list.js +12 -0
  24. data/front/models/latest.js +60 -0
  25. data/front/models/list.js +76 -0
  26. data/front/models/playing.js +11 -0
  27. data/front/models/recent.js +34 -0
  28. data/front/models/recommend.js +13 -0
  29. data/front/models/session.js +16 -0
  30. data/lib/pig-media-server/api.rb +35 -3
  31. data/lib/pig-media-server/backup.rb +3 -7
  32. data/lib/pig-media-server/model/comic.rb +1 -1
  33. data/lib/pig-media-server/model/data.rb +85 -81
  34. data/lib/pig-media-server/model/data_use_rdb.rb +124 -0
  35. data/lib/pig-media-server/version.rb +1 -1
  36. data/lib/pig-media-server/views/bundle.js +48 -13
  37. data/package.json +13 -18
  38. data/webpack.build.js +25 -0
  39. data/webpack.config.js +30 -0
  40. metadata +34 -19
  41. data/gulpfile.js +0 -33
  42. data/javascripts/application.js +0 -117
  43. data/javascripts/components/head.js +0 -106
  44. data/javascripts/components/list.js +0 -104
  45. data/javascripts/components/new_flag.js +0 -23
  46. data/javascripts/components/sort.js +0 -64
  47. data/javascripts/controller.js +0 -62
  48. data/javascripts/custom_list.js +0 -14
  49. data/javascripts/recent.js +0 -34
  50. data/javascripts/utils.js +0 -22
  51. data/javascripts/video.js +0 -10
  52. /data/{javascripts → front}/chromecast.js +0 -0
@@ -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;
@@ -1,14 +0,0 @@
1
- class CustomList {
2
- constructor(app){
3
- this.app = app;
4
- this.list = []
5
- }
6
- load(){
7
- $.get('/api/r/custom_list').done((data)=>{
8
- this.list = data;
9
- this.app.update_state();
10
- });
11
- }
12
- }
13
-
14
- window.CustomList = CustomList;
@@ -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
@@ -1,10 +0,0 @@
1
- class Video extends EventDispatcher{
2
- set(item){
3
- this.item = null;
4
- this.dispatchEvent({type: 'videoUpdated'});
5
- this.item = item;
6
- this.dispatchEvent({type: 'videoUpdated'});
7
- }
8
- }
9
-
10
- window.Video = Video;
File without changes