Merge lp:~arashbm/cliffhanger/person-movie-backend into lp:~flashback-dev/cliffhanger/trunk

Proposed by Arash Badie Modiri
Status: Merged
Merged at revision: 10
Proposed branch: lp:~arashbm/cliffhanger/person-movie-backend
Merge into: lp:~flashback-dev/cliffhanger/trunk
Diff against target: 750 lines (+224/-192)
16 files modified
backend/MovieDetails.js (+0/-29)
backend/PersonDetails.js (+0/-58)
backend/backend.js (+18/-0)
models/BaseModel.qml (+13/-5)
models/Cast.qml (+0/-3)
models/Crew.qml (+0/-3)
models/Genres.qml (+0/-3)
models/Movie.qml (+37/-0)
models/Movies.qml (+0/-2)
models/People.qml (+0/-3)
models/Person.qml (+30/-0)
models/PersonCast.qml (+22/-0)
models/PersonCrew.qml (+21/-0)
models/Shows.qml (+0/-3)
ui/MoviePage.qml (+39/-45)
ui/PersonPage.qml (+44/-38)
To merge this branch: bzr merge lp:~arashbm/cliffhanger/person-movie-backend
Reviewer Review Type Date Requested Status
Nekhelesh Ramananthan Approve
Review via email: mp+195487@code.launchpad.net

Description of the change

* Added models for Movie and Person, PersonCast, PersonCrew
* Removed `PersonDetails.js` and `MovieDetails,js`
* Optimized MoviePage (and PersonPage) to do one request only

To post a comment you must log in.
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

As usual great work! I have one question regarding the Movie.qml and Person.qml Models. In their model definition why do you define default_attributes if you are anyway going to add additional items to the attribute variable? I feel like the defaultAttributes variables is just unnecessary. Thoughts?

180 + property variant defaultAttributes: {
181 + 'title': '',
182 + 'homepage': '',
183 + 'tagline': '',
184 + 'overview': '',
185 + 'releaseDate': '',
186 + 'runtime': '',
187 + 'voteAverage': '',
188 + 'voteCount': '',
189 + 'genres': [],
190 + 'thumb_url': ''
191 + }

202 + attributes = {
203 + 'id': ob.id,
204 + 'title': ob.title,
205 + 'homepage': ob.homepage,
206 + 'tagline': ob.tagline,
207 + 'overview': ob.overview,
208 + 'releaseDate': ob.release_date,
209 + 'runtime': ob.runtime,
210 + 'voteAverage': ob.vote_average,
211 + 'voteCount': ob.vote_count,
212 + 'genres': ob.genres,
213 + 'thumb_url': thumbnail_url(ob.poster_path),
214 + 'creditsJson': JSON.stringify(ob.credits || {}),
215 + 'similarMoviesJson': JSON.stringify(ob.similar_movies || {})
216 + };

review: Needs Information
Revision history for this message
Arash Badie Modiri (arashbm) wrote :

oops! I thought I had removed them. I'll fix it in a moment.

17. By Arash Badie Modiri

* refactoring json === ''
* removing unused defaultAttributes property

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'backend/MovieDetails.js'
2--- backend/MovieDetails.js 2013-11-15 09:48:33 +0000
3+++ backend/MovieDetails.js 1970-01-01 00:00:00 +0000
4@@ -1,29 +0,0 @@
5-WorkerScript.onMessage = function(message) {
6-
7- var XHR = new XMLHttpRequest();
8- var thumb_url;
9-
10- XHR.open("GET", message.movie_url);
11- XHR.setRequestHeader("Accept", "application/json");
12-
13- XHR.onreadystatechange = function() {
14- if(XHR.readyState != XHR.DONE)
15- return;
16- if(XHR.status != 200)
17- return;
18-
19- var obj = JSON.parse(XHR.responseText);
20-
21- WorkerScript.sendMessage({ 'poster': obj.poster_path,
22- "title": obj.original_title,
23- "description": obj.overview,
24- "runtime": obj.runtime,
25- "genre": obj.genres,
26- "theme": obj.tagline,
27- "avg_vote": obj.vote_average,
28- "total_vote": obj.vote_count,
29- "releasedate": obj.release_date})
30- };
31-
32- XHR.send();
33-}
34
35=== removed file 'backend/PersonDetails.js'
36--- backend/PersonDetails.js 2013-11-13 21:28:13 +0000
37+++ backend/PersonDetails.js 1970-01-01 00:00:00 +0000
38@@ -1,58 +0,0 @@
39-WorkerScript.onMessage = function(message) {
40-
41- var XHR = new XMLHttpRequest();
42- var thumb_url;
43-
44- XHR.open("GET", message.person_url);
45- XHR.setRequestHeader("Accept", "application/json");
46-
47- XHR.onreadystatechange = function() {
48- if(XHR.readyState != XHR.DONE)
49- return;
50- if(XHR.status != 200)
51- return;
52-
53- var obj = JSON.parse(XHR.responseText);
54-
55- for(var i=0; i<obj.combined_credits.cast.length; i++) {
56- if (obj.combined_credits.cast[i].poster_path == null)
57- thumb_url = "null"
58- else
59- thumb_url = "http://d3gtl9l2a4fn1j.cloudfront.net/t/p/" + "w185/" + obj.combined_credits.cast[i].poster_path
60-
61-
62- if(obj.combined_credits.cast[i].media_type == "movie")
63- message.actedModel.append({"title": obj.combined_credits.cast[i].title,
64- "character": obj.combined_credits.cast[i].character,
65- "media_type": obj.combined_credits.cast[i].media_type,
66- "id": obj.combined_credits.cast[i].id,
67- "iconUrl": thumb_url});
68- else if(obj.combined_credits.cast[i].media_type == "tv")
69- message.actedModel.append({"title": obj.combined_credits.cast[i].name,
70- "character": obj.combined_credits.cast[i].media_type,
71- "media_type": obj.combined_credits.cast[i].media_type,
72- "id": obj.combined_credits.cast[i].id,
73- "iconUrl": thumb_url});
74- message.actedModel.sync()
75- }
76-
77- for(i=0; i<obj.combined_credits.crew.length; i++) {
78- message.directedModel.append({"title": obj.combined_credits.crew[i].title,
79- "character": obj.combined_credits.crew[i].job,
80- "media_type": obj.combined_credits.cast[i].media_type,
81- "id": obj.combined_credits.crew[i].id,
82- "iconUrl": thumb_url});
83- message.directedModel.sync()
84- }
85-
86- WorkerScript.sendMessage({ 'poster': obj.profile_path,
87- "name": obj.name,
88- "biography": obj.biography,
89- "birthday": obj.birthday,
90- "deathday": obj.deathday,
91- "place_of_birth": obj.place_of_birth,
92- "homepage": obj.homepage})
93- };
94-
95- XHR.send();
96-}
97
98=== modified file 'backend/backend.js'
99--- backend/backend.js 2013-11-15 22:11:55 +0000
100+++ backend/backend.js 2013-11-17 16:42:59 +0000
101@@ -16,6 +16,15 @@
102 return credentials.baseUrl + "/movie/upcoming" + "?api_key=" + credentials.apiKey;
103 }
104
105+function movieUrl(movie_id, options) {
106+ options = options || {};
107+ var base = credentials.baseUrl + "/movie/"+ movie_id + "?api_key=" + credentials.apiKey;
108+ if ( options.appendToResponse )
109+ return base + "&append_to_response=" + options.appendToResponse.join(',');
110+ else
111+ return base;
112+}
113+
114 function filterByGenreUrl(genre_id) {
115 return credentials.baseUrl + "/genre/" + genre_id + "/movies" + "?api_key=" + credentials.apiKey;
116 }
117@@ -45,6 +54,15 @@
118 return credentials.baseUrl + "/person/popular" + "?api_key=" + credentials.apiKey;
119 }
120
121+function personUrl(person_id, options) {
122+ options = options || {};
123+ var base = credentials.baseUrl + "/person/"+ person_id + "?api_key=" + credentials.apiKey;
124+ if ( options.appendToResponse )
125+ return base + "&append_to_response=" + options.appendToResponse.join(',');
126+ else
127+ return base;
128+}
129+
130 // Search
131 function searchUrl(type, term) {
132 return credentials.baseUrl + "/search/"+ type + "?api_key=" + credentials.apiKey + "&query=" + encodeURIComponent(term);
133
134=== modified file 'models/BaseModel.qml'
135--- models/BaseModel.qml 2013-11-15 17:02:44 +0000
136+++ models/BaseModel.qml 2013-11-17 16:42:59 +0000
137@@ -6,8 +6,10 @@
138 property string json: ""
139 property int status: XMLHttpRequest.UNSENT
140
141- property ListModel model: ListModel { id: jsonModel }
142- property alias count: jsonModel.count
143+ property ListModel model: ListModel { id: model }
144+ property alias count: model.count
145+
146+ signal updated()
147
148 onSourceChanged: {
149 var xhr = new XMLHttpRequest;
150@@ -19,12 +21,18 @@
151 }
152 xhr.send();
153 }
154- onJsonChanged: updateJSONModel()
155+
156+ onJsonChanged: {
157+ if ( json != "" ) {
158+ updateJSONModel();
159+ updated();
160+ }
161+ }
162
163 function thumbnail_url(thumb_path) {
164 if (thumb_path)
165- return "http://d3gtl9l2a4fn1j.cloudfront.net/t/p/" + "w185/" + thumb_path;
166+ return "http://d3gtl9l2a4fn1j.cloudfront.net/t/p/" + "w185/" + thumb_path;
167 else
168- return Qt.resolvedUrl("../graphics/toolbarIcon.png");
169+ return Qt.resolvedUrl("../graphics/toolbarIcon.png");
170 }
171 }
172
173=== modified file 'models/Cast.qml'
174--- models/Cast.qml 2013-11-15 10:57:48 +0000
175+++ models/Cast.qml 2013-11-17 16:42:59 +0000
176@@ -6,9 +6,6 @@
177 function updateJSONModel() {
178 model.clear();
179
180- if ( json === "" )
181- return;
182-
183 var objectArray = JSON.parse(json).cast;
184 for ( var key in objectArray ) {
185 var jo = objectArray[key];
186
187=== modified file 'models/Crew.qml'
188--- models/Crew.qml 2013-11-15 10:57:48 +0000
189+++ models/Crew.qml 2013-11-17 16:42:59 +0000
190@@ -5,9 +5,6 @@
191 function updateJSONModel() {
192 model.clear();
193
194- if ( json === "" )
195- return;
196-
197 var objectArray = JSON.parse(json).crew;
198 for ( var key in objectArray ) {
199 var jo = objectArray[key];
200
201=== modified file 'models/Genres.qml'
202--- models/Genres.qml 2013-11-15 22:22:17 +0000
203+++ models/Genres.qml 2013-11-17 16:42:59 +0000
204@@ -5,9 +5,6 @@
205 function updateJSONModel() {
206 model.clear();
207
208- if ( json === "" )
209- return;
210-
211 var objectArray = JSON.parse(json).genres;
212 for ( var key in objectArray ) {
213 var jo = objectArray[key];
214
215=== added file 'models/Movie.qml'
216--- models/Movie.qml 1970-01-01 00:00:00 +0000
217+++ models/Movie.qml 2013-11-17 16:42:59 +0000
218@@ -0,0 +1,37 @@
219+import QtQuick 2.0
220+
221+BaseModel {
222+ id: movie
223+
224+ property variant attributes: {
225+ 'title': '',
226+ 'homepage': '',
227+ 'tagline': '',
228+ 'overview': '',
229+ 'releaseDate': '',
230+ 'runtime': '',
231+ 'voteAverage': '',
232+ 'voteCount': '',
233+ 'genres': [],
234+ 'thumb_url': ''
235+ }
236+
237+ function updateJSONModel() {
238+ var ob = JSON.parse(json);
239+ attributes = {
240+ 'id': ob.id,
241+ 'title': ob.title,
242+ 'homepage': ob.homepage,
243+ 'tagline': ob.tagline,
244+ 'overview': ob.overview,
245+ 'releaseDate': ob.release_date,
246+ 'runtime': ob.runtime,
247+ 'voteAverage': ob.vote_average,
248+ 'voteCount': ob.vote_count,
249+ 'genres': ob.genres,
250+ 'thumb_url': thumbnail_url(ob.poster_path),
251+ 'creditsJson': JSON.stringify(ob.credits || {}),
252+ 'similarMoviesJson': JSON.stringify(ob.similar_movies || {})
253+ };
254+ }
255+}
256
257=== modified file 'models/Movies.qml'
258--- models/Movies.qml 2013-11-15 10:57:48 +0000
259+++ models/Movies.qml 2013-11-17 16:42:59 +0000
260@@ -5,8 +5,6 @@
261
262 function updateJSONModel() {
263 model.clear();
264-
265- if ( json === "" ) return;
266
267 var objectArray = JSON.parse(json).results;
268 for ( var key in objectArray ) {
269
270=== modified file 'models/People.qml'
271--- models/People.qml 2013-11-15 10:57:48 +0000
272+++ models/People.qml 2013-11-17 16:42:59 +0000
273@@ -5,9 +5,6 @@
274 function updateJSONModel() {
275 model.clear();
276
277- if ( json === "" )
278- return;
279-
280 var objectArray = JSON.parse(json).results;
281 for ( var key in objectArray ) {
282 var jo = objectArray[key];
283
284=== added file 'models/Person.qml'
285--- models/Person.qml 1970-01-01 00:00:00 +0000
286+++ models/Person.qml 2013-11-17 16:42:59 +0000
287@@ -0,0 +1,30 @@
288+import QtQuick 2.0
289+
290+BaseModel {
291+ id: person
292+
293+ property variant attributes: {
294+ 'name': '',
295+ 'biography': '',
296+ 'birthday': '',
297+ 'deathday': '',
298+ 'homepage': '',
299+ 'placeOfBirth': '',
300+ 'thumb_url': ''
301+ }
302+
303+ function updateJSONModel() {
304+ var ob = JSON.parse(json);
305+ attributes = {
306+ 'id': ob.id,
307+ 'name': ob.name,
308+ 'biography': ob.biography,
309+ 'birthday': ob.birthday,
310+ 'deathday': ob.deathday,
311+ 'homepage': ob.homepage,
312+ 'placeOfBirth': ob.place_of_birth,
313+ 'thumb_url': thumbnail_url(ob.profile_path),
314+ 'combinedCreditsJson': JSON.stringify(ob.combined_credits || {})
315+ };
316+ }
317+}
318
319=== added file 'models/PersonCast.qml'
320--- models/PersonCast.qml 1970-01-01 00:00:00 +0000
321+++ models/PersonCast.qml 2013-11-17 16:42:59 +0000
322@@ -0,0 +1,22 @@
323+import QtQuick 2.0
324+
325+BaseModel {
326+ id: personCast
327+
328+ function updateJSONModel() {
329+ model.clear();
330+
331+ var objectArray = JSON.parse(json).cast;
332+ for ( var key in objectArray ) {
333+ var jo = objectArray[key];
334+ model.append({
335+ 'id': jo.id,
336+ 'title': jo.title,
337+ 'character': jo.character,
338+ 'releaseDate': jo.release_date,
339+ 'mediaType': jo.media_type,
340+ 'thumb_url': thumbnail_url(jo.poster_path)
341+ });
342+ }
343+ }
344+}
345
346=== added file 'models/PersonCrew.qml'
347--- models/PersonCrew.qml 1970-01-01 00:00:00 +0000
348+++ models/PersonCrew.qml 2013-11-17 16:42:59 +0000
349@@ -0,0 +1,21 @@
350+import QtQuick 2.0
351+
352+BaseModel {
353+ id: personCrew
354+ function updateJSONModel() {
355+ model.clear();
356+
357+ var objectArray = JSON.parse(json).crew;
358+ for ( var key in objectArray ) {
359+ var jo = objectArray[key];
360+ model.append({
361+ 'id': jo.id,
362+ 'title': jo.title,
363+ 'department': jo.department,
364+ 'releaseDate': jo.release_date,
365+ 'mediaType': jo.media_type,
366+ 'thumb_url': thumbnail_url(jo.profile_path)
367+ });
368+ }
369+ }
370+}
371
372=== modified file 'models/Shows.qml'
373--- models/Shows.qml 2013-11-15 10:57:48 +0000
374+++ models/Shows.qml 2013-11-17 16:42:59 +0000
375@@ -6,9 +6,6 @@
376 function updateJSONModel() {
377 model.clear();
378
379- if ( json === "" )
380- return;
381-
382 var objectArray = JSON.parse(json).results;
383 for ( var key in objectArray ) {
384 var jo = objectArray[key];
385
386=== modified file 'ui/MoviePage.qml'
387--- ui/MoviePage.qml 2013-11-15 09:48:33 +0000
388+++ ui/MoviePage.qml 2013-11-17 16:42:59 +0000
389@@ -13,52 +13,30 @@
390 flickable: null
391
392 property string movie_id
393- property string movie_url: root.baseUrl + "/movie/" + movie_id + root.api_Key + "&append_to_response=credits"
394-
395- Component.onCompleted: movieWorker.sendMessage({"movie_url": movie_url})
396
397 Cast {
398 id: movieCast
399- source: Backend.movieCastUrl(movie_id)
400 }
401
402 Crew {
403 id: movieCrew
404- source: Backend.movieCrewUrl(movie_id)
405 }
406
407 Movies {
408 id: similarMoviesModel
409- source: Backend.similarMoviesUrl(movie_id)
410- }
411-
412- WorkerScript {
413- id: movieWorker
414- source: "../backend/MovieDetails.js"
415- onMessage: {
416- if(messageObject.poster == null)
417- thumb.source = Qt.resolvedUrl("../graphics/toolbarIcon.png")
418- else
419- thumb.source = "http://d3gtl9l2a4fn1j.cloudfront.net/t/p/" + "w185/" + messageObject.poster
420-
421- title.text = messageObject.title
422- description.text = messageObject.description
423- releaseDate.subText = messageObject.releasedate
424- year.text = releaseDate.subText.split("-")[0]
425- runTime.text = messageObject.runtime + " minutes"
426-
427- var genreModel = messageObject.genre
428- for (var i=0; i<genreModel.length; i++) {
429- if(genre.subText != "")
430- genre.subText = genre.subText + ", " + genreModel[i].name
431- else
432- genre.subText = genreModel[i].name
433- }
434-
435- theme.subText = messageObject.theme
436- rating.text = messageObject.avg_vote + "/10\n" + messageObject.total_vote
437- }
438- }
439+ }
440+
441+ Movie {
442+ id: movie
443+ source: Backend.movieUrl(movie_id, {appendToResponse: ['credits', 'similar_movies']})
444+
445+ onUpdated: {
446+ movieCast.json = movie.attributes.creditsJson;
447+ movieCrew.json = movie.attributes.creditsJson;
448+ similarMoviesModel.json = movie.attributes.similarMoviesJson;
449+ }
450+ }
451+
452
453 Overlay {
454 id: summaryOverlay
455@@ -75,7 +53,7 @@
456 bottomMargin: units.gu(12)
457 }
458
459- text: description.text
460+ text: movie.attributes.overview
461 wrapMode: Text.WordWrap
462 }
463 }
464@@ -153,11 +131,12 @@
465 id: thumb
466 fillMode: Image.PreserveAspectFit
467 smooth: true
468+ source: movie.attributes.thumb_url
469 }
470
471 ActivityIndicator {
472 anchors.centerIn: parent
473- running: thumb.status != Image.Ready ? true : false
474+ running: thumb.status != Image.Ready
475 }
476 }
477
478@@ -175,6 +154,7 @@
479 spacing: units.gu(2)
480 Label {
481 id: title
482+ text: movie.attributes.title
483 fontSize: "large"
484 width: movieColumn.width
485 maximumLineCount: 2
486@@ -183,7 +163,8 @@
487 }
488
489 Label {
490- id: description
491+ id: overview
492+ text: movie.attributes.overview
493 fontSize: "medium"
494 width: movieColumn.width
495 height: movieColumn.height/2
496@@ -196,8 +177,15 @@
497 }
498
499 Column {
500- Label { id: year }
501- Label { id: runTime }
502+ Label {
503+ id: year
504+ text: movie.attributes.releaseDate.split('-')[0]
505+ }
506+ Label {
507+ id: runTime
508+ text: movie.attributes.runtime + " minutes"
509+ visible: movie.attributes.runtime != '0'
510+ }
511 }
512 }
513
514@@ -220,7 +208,10 @@
515 smooth: true
516 }
517
518- Label { id: rating }
519+ Label {
520+ id: rating
521+ text: movie.attributes.voteAverage+"\n"+movie.attributes.voteCount
522+ }
523 }
524
525 // Movie Details - Release dates, genre, movie theme etc.
526@@ -243,19 +234,22 @@
527 Header { text: "Details" }
528
529 Subtitled {
530- id: genre
531- text: "Genre"
532+ id: genres
533+ text: "Genres"
534+ subText: movie.attributes.genres.map(function(o) { return o.name }).join(', ')
535 }
536
537 Subtitled {
538 id: releaseDate
539 text: "Release Date"
540+ subText: movie.attributes.releaseDate
541 }
542
543 Subtitled {
544 id: theme
545- text: "Movie Theme"
546- visible: theme.subText == "" ? false : true
547+ text: "Tagline"
548+ subText: movie.attributes.tagline
549+ visible: movie.attributes.tagline
550 }
551
552 Header { text: "Casts" }
553
554=== modified file 'ui/PersonPage.qml'
555--- ui/PersonPage.qml 2013-11-13 21:28:13 +0000
556+++ ui/PersonPage.qml 2013-11-17 16:42:59 +0000
557@@ -1,6 +1,8 @@
558 import QtQuick 2.0
559 import Ubuntu.Components 0.1
560 import Ubuntu.Components.ListItems 0.1
561+import '../models'
562+import '../backend/backend.js' as Backend
563
564 Page {
565 id: personPage
566@@ -9,29 +11,24 @@
567 flickable: null
568
569 property string person_id
570- property string person_url: root.baseUrl + "/person/" + person_id + root.api_Key + "&append_to_response=combined_credits"
571-
572- Component.onCompleted: personWorker.sendMessage({"person_url": person_url, "actedModel": actedModel, "directedModel": directedModel})
573-
574- ListModel { id: actedModel }
575- ListModel { id: directedModel }
576-
577- WorkerScript {
578- id: personWorker
579- source: "../backend/PersonDetails.js"
580- onMessage: {
581- if(messageObject.poster == null)
582- thumb.source = Qt.resolvedUrl("../graphics/toolbarIcon.png")
583- else
584- thumb.source = "http://d3gtl9l2a4fn1j.cloudfront.net/t/p/" + "w185/" + messageObject.poster
585-
586- name.text = messageObject.name
587- biography.text = messageObject.biography == null ? "Biography not available" : messageObject.biography
588- birthYear.text = messageObject.birthday == null ? "Not Available" : "Born: " + messageObject.birthday
589- deathYear.text = messageObject.deathday == null ? "Not Available" :"Dead: " + messageObject.deathday
590- birthPlace.text = messageObject.place_of_birth == null ? "Birth Place Not Available" : messageObject.place_of_birth
591- contact.text = messageObject.homepage
592- }
593+
594+ PersonCast {
595+ id: personCast
596+ }
597+
598+ PersonCrew {
599+ id: personCrew
600+ }
601+
602+ Person {
603+ id: person
604+
605+ source: Backend.personUrl(person_id, {appendToResponse: ['combined_credits']})
606+
607+ onUpdated: {
608+ personCast.json = person.attributes.combinedCreditsJson;
609+ personCrew.json = person.attributes.combinedCreditsJson;
610+ }
611 }
612
613 Flickable {
614@@ -56,11 +53,12 @@
615 id: thumb
616 fillMode: Image.PreserveAspectFit
617 smooth: true
618+ source: person.attributes.thumb_url
619 }
620
621 ActivityIndicator {
622 anchors.centerIn: parent
623- running: thumb.status != Image.Ready ? true : false
624+ running: thumb.status != Image.Ready
625 }
626 }
627
628@@ -79,6 +77,7 @@
629
630 Label {
631 id: name
632+ text: person.attributes.name
633 fontSize: "large"
634 width: personColumn.width
635 maximumLineCount: 2
636@@ -89,6 +88,7 @@
637 Column {
638 Label {
639 id: birthPlace
640+ text: person.attributes.placeOfBirth
641 fontSize: "medium"
642 width: personColumn.width
643 elide: Text.ElideRight
644@@ -97,8 +97,9 @@
645
646 Label {
647 id: birthYear
648+ text: "Birth: " + person.attributes.birthday.split('-')[0]
649 fontSize: "medium"
650- visible: text == "Not Available" ? false: true
651+ visible: person.attributes.birthday
652 width: personColumn.width
653 elide: Text.ElideRight
654 wrapMode: Text.WordWrap
655@@ -106,8 +107,9 @@
656
657 Label {
658 id: deathYear
659+ text: "Death: " + person.attributes.deathday.split('-')[0]
660 fontSize: "medium"
661- visible: text == "Dead: " || text == "Not Available" ? false : true
662+ visible: person.attributes.deathday
663 width: personColumn.width
664 elide: Text.ElideRight
665 wrapMode: Text.WordWrap
666@@ -115,13 +117,14 @@
667
668 Label {
669 id: contact
670+ text: person.attributes.homepage
671 fontSize: "medium"
672 width: personColumn.width
673 elide: Text.ElideRight
674 wrapMode: Text.WordWrap
675 MouseArea {
676 anchors.fill: parent
677- enabled: contact.text == "null" ? false : true
678+ enabled: person.attributes.homepage
679 onClicked: Qt.openUrlExternally(contact.text)
680 }
681 }
682@@ -130,6 +133,7 @@
683
684 Label {
685 id: biography
686+ text: person.attributes.biography
687 anchors {
688 top: personColumn.bottom
689 left: parent.left
690@@ -154,10 +158,13 @@
691
692 Header {
693 text: "Acting"
694- visible: actedModel.count !== 0
695+ visible: personCast.count > 0
696 }
697
698 ListView {
699+ id: personCastView
700+ model: personCast.model
701+
702 anchors {
703 left: parent.left
704 right: parent.right
705@@ -165,22 +172,23 @@
706
707 height: units.gu(20)
708 clip: true
709-
710- model: actedModel
711 delegate: Subtitled {
712- icon: iconUrl == "null" ? Qt.resolvedUrl("../graphics/toolbarIcon.png") : iconUrl
713+ icon: thumb_url
714 text: title
715 subText: character
716- onClicked: media_type == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : console.log("Not a movie")
717+ onClicked: mediaType == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : console.log("Not a movie")
718 }
719 }
720
721 Header {
722 text: "Production"
723- visible: directedModel.count !== 0
724+ visible: personCrew.count > 0
725 }
726
727 ListView {
728+ id: personCrewView
729+ model: personCrew.model
730+
731 anchors {
732 left: parent.left
733 right: parent.right
734@@ -188,13 +196,11 @@
735
736 height: units.gu(20)
737 clip: true
738-
739- model: directedModel
740 delegate: Subtitled {
741- icon: iconUrl == "null" ? Qt.resolvedUrl("../graphics/toolbarIcon.png") : iconUrl
742+ icon: thumb_url
743 text: title
744- subText: character
745- onClicked: media_type == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : console.log("Not a movie")
746+ subText: department
747+ onClicked: mediaType == "movie" ? pageStack.push(Qt.resolvedUrl("MoviePage.qml"), {"movie_id": id}) : console.log("Not a movie")
748 }
749 }
750 }

Subscribers

People subscribed via source and target branches