Merge lp:~xzcvczx/dmedia/browser-ng into lp:dmedia

Proposed by xzcvczx
Status: Merged
Merged at revision: 574
Proposed branch: lp:~xzcvczx/dmedia/browser-ng
Merge into: lp:dmedia
Diff against target: 280 lines (+98/-39)
4 files modified
ui/common.js (+0/-1)
ui/dmedia.js (+48/-7)
ui/index.html (+19/-9)
ui/style.css (+31/-22)
To merge this branch: bzr merge lp:~xzcvczx/dmedia/browser-ng
Reviewer Review Type Date Requested Status
dmedia Dev Pending
Review via email: mp+141158@code.launchpad.net

Description of the change

Redesigned browser, Added ability to add a title to each video

To post a comment you must log in.
lp:~xzcvczx/dmedia/browser-ng updated
571. By xzcvczx

Modified info table

572. By xzcvczx

Changed display of metadata

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ui/common.js'
--- ui/common.js 2012-11-02 09:34:08 +0000
+++ ui/common.js 2013-01-16 15:31:20 +0000
@@ -304,7 +304,6 @@
304 }304 }
305}305}
306306
307
308function Tagger(project, form) {307function Tagger(project, form) {
309 this.key = null;308 this.key = null;
310 this.old_value = '';309 this.old_value = '';
311310
=== modified file 'ui/dmedia.js'
--- ui/dmedia.js 2012-11-02 10:13:42 +0000
+++ ui/dmedia.js 2013-01-16 15:31:20 +0000
@@ -162,7 +162,6 @@
162 }162 }
163);163);
164164
165
166function make_tag_li(remove, doc, id) {165function make_tag_li(remove, doc, id) {
167 var id = id || doc._id;166 var id = id || doc._id;
168 var li = $el('li', {textContent: doc.value});167 var li = $el('li', {textContent: doc.value});
@@ -513,7 +512,7 @@
513 this.tags = $('tags');512 this.tags = $('tags');
514 this.doc = null;513 this.doc = null;
515514
516 this.items = new Items('right');515 this.items = new Items('south');
517 this.items.onchange = $bind(this.on_item_change, this);516 this.items.onchange = $bind(this.on_item_change, this);
518 this.items.parent.onmousewheel = $bind(this.on_mousewheel, this);517 this.items.parent.onmousewheel = $bind(this.on_mousewheel, this);
519518
@@ -524,6 +523,9 @@
524 window.addEventListener('keypress', $bind(this.on_window_keypress, this));523 window.addEventListener('keypress', $bind(this.on_window_keypress, this));
525524
526 $('back').onclick = $bind(this.hide, this);525 $('back').onclick = $bind(this.hide, this);
526
527 //$('clip_title_form').onsubmit = $bind(this.on_title, this);
528 $('clip_title').onblur = $bind(this.on_title, this);
527529
528 this.browser = $('browser_main');530 this.browser = $('browser_main');
529 this.projects = $('browser_projects');531 this.projects = $('browser_projects');
@@ -645,6 +647,26 @@
645647
646 on_doc: function(req) {648 on_doc: function(req) {
647 this.doc = req.read();649 this.doc = req.read();
650
651 $('clip_title').placeholder = this.doc.name;
652 if (this.doc.title) {
653 $('clip_title').value = this.doc.title;
654 }
655 else {
656 $('clip_title').value = '';
657 }
658
659 if (this.doc.media == 'video') {
660 var resolution = this.doc.width + 'x' + this.doc.height;
661 var framerate = this.doc.framerate;
662 var fps = Math.round((framerate.num/framerate.denom)*100)/100;
663 var length = format_time(this.doc.duration.seconds);
664
665 $('metadata_1').textContent = length;
666 $('metadata_2').textContent = resolution;
667 $('metadata_3').textContent = fps + ' fps';
668 }
669
648 var keys = Object.keys(this.doc.tags);670 var keys = Object.keys(this.doc.tags);
649 var remove = $bind(this.on_tag_remove, this);671 var remove = $bind(this.on_tag_remove, this);
650 keys.forEach(function(key) {672 keys.forEach(function(key) {
@@ -654,6 +676,25 @@
654 }, this);676 }, this);
655 },677 },
656678
679 on_title: function(title) {
680 title = $('clip_title').value;
681 //console.log('Title: ' + title);
682 if (!this.doc) {
683 return;
684 }
685 if (title == '') {
686 if (this.doc.title) {
687 delete this.doc.title;
688 }
689 }
690 else {
691 if (this.doc.title != title) {
692 this.doc.title = title
693 }
694 }
695 this.project.db.save(this.doc);
696 },
697
657 on_tag: function(tag) {698 on_tag: function(tag) {
658 //console.log(tag);699 //console.log(tag);
659 if (!this.doc) {700 if (!this.doc) {
@@ -685,19 +726,19 @@
685 on_mousewheel: function(event) {726 on_mousewheel: function(event) {
686 event.preventDefault();727 event.preventDefault();
687 var delta = wheel_delta(event) * 112; // 108px height + 2px border728 var delta = wheel_delta(event) * 112; // 108px height + 2px border
688 this.items.parent.scrollTop += delta;729 this.items.parent.scrollLeft += delta;
689 },730 },
690731
691732
692 on_window_keydown: function(event) {733 on_window_keydown: function(event) {
693 var keyID = event.keyIdentifier;734 var keyID = event.keyIdentifier;
694 if (['Up', 'Down', 'Enter', 'U+007F'].indexOf(keyID) > -1 && !this.tagger.input.value) {735 if (['Left', 'Right', 'Enter', 'U+007F'].indexOf(keyID) > -1 && !this.tagger.input.value) {
695 event.preventDefault();736 event.preventDefault();
696 event.stopPropagation();737 event.stopPropagation();
697 if (keyID == 'Up') {738 if (keyID == 'Left') {
698 this.previous();739 this.previous();
699 }740 }
700 else if (keyID == 'Down') {741 else if (keyID == 'Right') {
701 this.next();742 this.next();
702 }743 }
703 else if (keyID == 'Enter') {744 else if (keyID == 'Enter') {
@@ -716,7 +757,7 @@
716 }757 }
717 // Don't focus on Backspace, Enter, Spacebar, or Delete758 // Don't focus on Backspace, Enter, Spacebar, or Delete
718 if ([8, 13, 32, 127].indexOf(event.keyCode) == -1) {759 if ([8, 13, 32, 127].indexOf(event.keyCode) == -1) {
719 this.tagger.focus();760 return;
720 }761 }
721 },762 },
722763
723764
=== modified file 'ui/index.html'
--- ui/index.html 2012-11-02 10:13:42 +0000
+++ ui/index.html 2013-01-16 15:31:20 +0000
@@ -64,19 +64,29 @@
64 <div id="browser_target" class="hide">64 <div id="browser_target" class="hide">
65 <ul id="browser_projects"></ul>65 <ul id="browser_projects"></ul>
66 <div id="browser_main" class="hide">66 <div id="browser_main" class="hide">
67 <div id="back">&larr; Back</div>
68 <div id="screen"><video id="player"></div>67 <div id="screen"><video id="player"></div>
69 <form id="tag_form">68 <div id="east" class="grid_row">
70 <div id="lower" class="grid_row">69 <div id="info" class="grid_row">
71 <div id="add_tag" class="grid_3 grid_cell">70 <form id="clip_title_form">
72 <input id="tag_value"></input>71 <input id="clip_title" class="grid_3"></input>
72 </form>
73 <p id="metadata_1" class="metadata"></p>
74 <p id="metadata_2" class="metadata"></p>
75 <p id="metadata_3" class="metadata"></p>
76 </div>
77 <form id="tag_form">
78 <div id="tag_block" class="grid_row">
79 <div id="add_tag" class="grid_2 grid_cell">
80 <input id="tag_value" placeholder="Tag"></input>
73 <ul class="matches" id="tag_matches"></ul>81 <ul class="matches" id="tag_matches"></ul>
74 </div>82 </div>
75 <button id="tag_button" class="grid_1 arrow" disabled>Tag &rarr;</button>83 <button id="tag_button" class="grid_1 arrow" disabled>+</button>
76 <ul id="tags" class="grid_5 tags inset"></ul>84 <ul id="tags" class="grid_3 tags inset"></ul>
85 . </div>
86 </form>
87 <div id="back">&larr; Back</div>
77 </div>88 </div>
78 </form>89 <div id="south"></div>
79 <div id="right"></div>
80 </div>90 </div>
81 </div>91 </div>
8292
8393
=== modified file 'ui/style.css'
--- ui/style.css 2012-11-02 10:13:42 +0000
+++ ui/style.css 2013-01-16 15:31:20 +0000
@@ -351,9 +351,9 @@
351 position: fixed;351 position: fixed;
352 z-index: 200;352 z-index: 200;
353 top: 38px;353 top: 38px;
354 bottom: 170px;354 bottom: 128px;
355 left: 0;355 left: 0;
356 right: 210px;356 right: 262px;
357 background-color: black;357 background-color: black;
358}358}
359359
@@ -365,40 +365,43 @@
365 height: 100%;365 height: 100%;
366}366}
367367
368#lower {368#east {
369 position: fixed;369 position: fixed;
370 z-index: 200;370 z-index: 200;
371 height: 170px;371 width: 262px;
372 bottom: 0;372 top: 38px;
373 left: 0;373 bottom: 128px;
374 right: 210px;374 right: 0;
375 background-color: black;375 overflow-y: auto;
376 overflow-x: auto;
377 overflow-y: visible;
378 background: -webkit-linear-gradient(top, #222, #333);376 background: -webkit-linear-gradient(top, #222, #333);
379}377}
378.metadata {
379 text-align: center;
380}
380381
381#right {382#south {
382 position: fixed;383 position: fixed;
383 z-index: 200;384 z-index: 200;
384 top: 38px;385 left: 0;
385 bottom: 0;386 bottom: 0;
386 width: 210px;387 height: 128px;
387 right: 0;388 right: 0;
388 background-color: #555;389 background-color: #555;
389 overflow-y: scroll;390 overflow-x: scroll;
390 overflow-x: hidden;391 overflow-y: hidden;
391 line-height: 0;392 line-height: 0;
393 white-space: nowrap;
392}394}
393395
394#right img.thumbnail {396#south img.thumbnail {
395 width: 192px;397 width: 192px;
396 height: 108px;398 height: 108px;
397 border: 2px solid black;399 border: 2px solid black;
398 border-top: 2px solid #111;400 border-left: 2px solid #111;
401 overflow: hidden;
399}402}
400403
401#right img.thumbnail.selected {404#south img.thumbnail.selected {
402 border-color: #e81f3b;405 border-color: #e81f3b;
403}406}
404407
@@ -428,12 +431,18 @@
428 background-color: #e81f3b;431 background-color: #e81f3b;
429}432}
430433
434.label {
435 font-weight: bold;
436}
431437
432ul.tags {438ul.tags {
439 position: relative;
440 top: -8px;
441
433 font-size: 0;442 font-size: 0;
434 list-style: none;443 list-style: none;
435 444
436 height: 150px;445 height: 100px;
437 padding: 2px;446 padding: 2px;
438}447}
439448
@@ -473,10 +482,10 @@
473 border-bottom:1px solid #383838;482 border-bottom:1px solid #383838;
474 border-radius: 2px;483 border-radius: 2px;
475 box-shadow: 0px 1px 1px rgba(0,0,0,0.7);484 box-shadow: 0px 1px 1px rgba(0,0,0,0.7);
476 position: fixed;
477 z-index: 250;485 z-index: 250;
478 bottom: 8px;486 position: absolute;
479 left: 8px;487 bottom: 5px;
488 right: 10px;
480 width: 144px;489 width: 144px;
481}490}
482491

Subscribers

People subscribed via source and target branches

to all changes: