YAMJ / yamj-v3

Main Project for YAMJ v3
11 stars 7 forks source link

duplicated episode #299

Open jluc2808 opened 8 years ago

jluc2808 commented 8 years ago

api/video/season/56.json?dataitems=status,trailer,externalid,genre,artwork,plot,country,award,files,certification,studio,rating&jobs=actor-5,director-1,writer-1

return the right amount of episode "result": { "id": 56, "title": "Homeland", "originalTitle": "Homeland", "plot": "Huit ans après la disparition de deux soldats américains lors de l'invasion de Bagdad, l'un d'entre eux réapparaît, seul survivant alors que tout le monde le pensait mort depuis longtemps. Rapatrié aux États-Unis, il est accueilli chaleureusement par sa famille, ses amis et le gouvernement. Seule contre tous, l'agent de la CIA Carrie Mathison, qui a passé plusieurs années en Afghanistan, est persuadée que le héros est en réalité devenu un espion à la solde de l'ennemi, préparant la prochaine attaque terroriste sur le sol américain. Sans réelle preuve et montrée du doigt suite à un incident diplomatique qu'elle a déclenché quelques mois plus tôt, Carrie va devoir se battre pour prouver que ce qu'elle avance est la réalité... Adaptation de la série israélienne Hatufim.", "watched": false, "artwork": { "POSTER": [ { "id": 56, "source": "SEASON", "artworkId": 25994, "locatedId": 24940, "generatedId": 22450, "artworkType": "POSTER", "filename": "h/ho/Homeland_0000_004.season.poster.iXoQiNTeJiHkzQf2fhMpjH0nYFz.default.jpg" }, { "id": 56, "source": "SEASON", "artworkId": 25994, "locatedId": 24939, "generatedId": 22446, "artworkType": "POSTER", "filename": "h/ho/Homeland_0000_004.season.poster.1r8IGCsOtobBnyrswlExBvsO1d3.default.jpg" }, { "id": 56, "source": "SEASON", "artworkId": 25994, "locatedId": 24938, "generatedId": 22447, "artworkType": "POSTER", "filename": "h/ho/Homeland_0000_004.season.poster.hJSeJuus0BsVUl4pbNpTIdOpkLq.default.jpg" }, { "id": 56, "source": "SEASON", "artworkId": 25994, "locatedId": 24937, "generatedId": 22444, "artworkType": "POSTER", "filename": "h/ho/Homeland_0000_004.season.poster.lFmr0Irmt8yM2B4ulwsU2ojAdlt.default.jpg" }, { "id": 56, "source": "SEASON", "artworkId": 25994, "locatedId": 24936, "generatedId": 22445, "artworkType": "POSTER", "filename": "h/ho/Homeland_0000_004.season.poster.gRyfQzqTZw99y0Q7ZkCFhmQHmJV.default.jpg" } ] }, "videoType": "SEASON", "sortTitle": "Homeland", "videoYear": 2014, "seriesId": 5, "seasonId": 56, "season": 4, "status": "DONE", "genres": [ { "name": "Comedie" }, { "name": "Thriller" } ], "studios": [ { "id": 362, "name": "Showtime" } ], "countries": [ { "id": 2, "countryCode": "US", "country": "États-Unis" } ], "certifications": [ { "id": 10, "countryCode": "DE", "country": "Allemagne", "certificate": "16" }, { "id": 6, "countryCode": "FR", "country": "France", "certificate": "U" }, { "id": 12, "countryCode": "GB", "country": "Grande-Bretagne", "certificate": "15" }, { "id": 25, "countryCode": "US", "country": "États-Unis", "certificate": "TV-MA" } ], "ratings": [ { "source": "combined", "rating": 85 }, { "source": "allocine", "rating": 86 }, { "source": "tvdb", "rating": 83 } ], "files": [ { "id": 1204, "extra": false, "container": "Matroska", "codec": "V_MPEG4/ISO/AVC", "codecFormat": "AVC", "codecProfile": "High@L3.1", "bitrate": 4255, "overallBitrate": 4704, "fps": 25, "width": 1280, "height": 720, "aspectRatio": "1.777:1", "runtime": "46m", "videoSource": "WEBDL", "fileId": 2211, "fileName": "T:\video\Film\series\Homeland\Homeland S04 720p\Homeland S04E01 - 720p.WEB-DL.DD5.1.H264.mkv", "fileDate": "2016-08-27 05:43:38", "fileSize": "1.54 GB", "season": 4, "episode": 1, "audioCodecs": [ { "codec": "A_AC3", "codecFormat": "AC-3", "bitrate": 448, "channels": 6, "languageCode": "fr", "language": "français" } ], "subtitles": [ { "format": "UTF-8", "languageCode": "fr", "language": "français", "defaultFlag": true, "forcedFlag": true } ] }, { "id": 1205, "extra": false, "container": "Matroska", "codec": "V_MPEG4/ISO/AVC", "codecFormat": "AVC", "codecProfile": "High@L3.1", "bitrate": 4229, "overallBitrate": 4679, "fps": 25, "width": 1280, "height": 720, "aspectRatio": "1.777:1", "runtime": "46m", "videoSource": "WEBDL", "fileId": 2212, "fileName": "T:\video\Film\series\Homeland\Homeland S04 720p\Homeland S04E02 - 720p.WEB-DL.DD5.1.H264.mkv", "fileDate": "2016-08-26 19:16:23", "fileSize": "1.52 GB", "season": 4, "episode": 2, "audioCodecs": [ { "codec": "A_AC3", "codecFormat": "AC-3", "bitrate": 448, "channels": 6, "languageCode": "fr", "language": "français" } ], "subtitles": [ { "format": "UTF-8", "languageCode": "fr", "language": "français", "defaultFlag": true, "forcedFlag": true } ] }, ......

but api/video/episodes.json?&seriesid=5&seasonid=56&dataitems=plot,files,rating

duplicate episode in the return "results": [ { "id": 1097, "seriesId": 5, "seasonId": 56, "season": 4, "episode": 1, "title": "Dommages collatéraux", "originalTitle": "The Drone Queen", "plot": "Alors que Saul tente de s'adapter au secteur privé à New York par amour pour sa bien-aimée Mira, Carrie est à la tête de l'unité des renseignements de Kaboul, en Afghanistan. Lorsqu'un informateur lui faut savoir qu'une cible importante a été localisée, elle doit prendre une décision cruciale : agir dans la hâte sans avoir de confirmation visuelle. Elle donne finalement son feu vert pour lancer une attaque qui va engrendrer des \"dommages collatéraux\". De nombreux civils présents sur les lieux ont été tués. Le scandale menace d'éclater...", "firstAired": "2014-10-05", "watched": false, "videoimage": "h/ho/Homeland_0000_004_001.episode.videoimage.h2WIhOIaWQ6jI0yHWcbFcOcrJ3I.default.jpg", "files": [ { "id": 1204, "extra": false, "container": "Matroska", "codec": "V_MPEG4/ISO/AVC", "codecFormat": "AVC", "codecProfile": "High@L3.1", "bitrate": 4255, "overallBitrate": 4704, "fps": 25, "width": 1280, "height": 720, "aspectRatio": "1.777:1", "runtime": "46m", "videoSource": "WEBDL", "fileId": 2211, "fileName": "T:\video\Film\series\Homeland\Homeland S04 720p\Homeland S04E01 - 720p.WEB-DL.DD5.1.H264.mkv", "fileDate": "2016-08-27 05:43:38", "fileSize": "1.54 GB", "season": 4, "episode": 1, "audioCodecs": [ { "codec": "A_AC3", "codecFormat": "AC-3", "bitrate": 448, "channels": 6, "languageCode": "fr", "language": "français" } ], "subtitles": [ { "format": "UTF-8", "languageCode": "fr", "language": "français", "defaultFlag": true, "forcedFlag": true } ] } ] }, { "id": 1097, "seriesId": 5, "seasonId": 56, "season": 4, "episode": 1, "title": "Dommages collatéraux", "originalTitle": "The Drone Queen", "plot": "Alors que Saul tente de s'adapter au secteur privé à New York par amour pour sa bien-aimée Mira, Carrie est à la tête de l'unité des renseignements de Kaboul, en Afghanistan. Lorsqu'un informateur lui faut savoir qu'une cible importante a été localisée, elle doit prendre une décision cruciale : agir dans la hâte sans avoir de confirmation visuelle. Elle donne finalement son feu vert pour lancer une attaque qui va engrendrer des \"dommages collatéraux\". De nombreux civils présents sur les lieux ont été tués. Le scandale menace d'éclater...", "firstAired": "2014-10-05", "watched": false, "videoimage": "h/ho/Homeland_0000_004_001.episode.videoimage.qTyrANBsakwZjpGkPYi6Qt3oeO0.default.jpg", "files": [ { "id": 1204, "extra": false, "container": "Matroska", "codec": "V_MPEG4/ISO/AVC", "codecFormat": "AVC", "codecProfile": "High@L3.1", "bitrate": 4255, "overallBitrate": 4704, "fps": 25, "width": 1280, "height": 720, "aspectRatio": "1.777:1", "runtime": "46m", "videoSource": "WEBDL", "fileId": 2211, "fileName": "T:\video\Film\series\Homeland\Homeland S04 720p\Homeland S04E01 - 720p.WEB-DL.DD5.1.H264.mkv", "fileDate": "2016-08-27 05:43:38", "fileSize": "1.54 GB", "season": 4, "episode": 1, "audioCodecs": [ { "codec": "A_AC3", "codecFormat": "AC-3", "bitrate": 448, "channels": 6, "languageCode": "fr", "language": "français" } ], "subtitles": [ { "format": "UTF-8", "languageCode": "fr", "language": "français", "defaultFlag": true, "forcedFlag": true } ] } ] },

jluc2808 commented 8 years ago

taking a much carefully look i found why the duplicated results in the api/video/episodes.json?&seriesid=5&seasonid=56&dataitems=plot,files,rating

as each episode have 2 videoimage stored , each episode have 2 separate results to solve could you group the videoimage in the same result like file contents "videoimage": [ { "h/ho/Homeland_0000_004_001.episode.videoimage.qTyrANBsakwZjpGkPYi6Qt3oeO0.default.jpg" }, { "h/ho/Homeland_0000_004_001.episode.videoimage.h2WIhOIaWQ6jI0yHWcbFcOcrJ3I.default.jpg" } ],

modmax commented 8 years ago

The problem is right now, that the videoimages are directly loaded with the episodes. If one episode has more than one videoimage, then duplicate entries may occur.

This can only be solved if "videoimage" in the episode will be replaced with "videoimages", which then containes several videoimages which will be fetched by an additional query. This will lead to minor change in the layout of the reponse object which should then be handled by the client.

If you approve with this, then I will make the changes.

jluc2808 commented 8 years ago

i don't fill good with that evolution, because instead of one API call , we have many API call to perform and a loop thru all episode one API call to get the episode list and other args than the videoimage , plus a loop for as many episode on the list and for each episode an API call to get the videoimage(s)

modmax commented 8 years ago

??? There should be no other API call; it's just another database call in order to fetch the images ... :-) So I told about an additional query (which I ment to be in the database) and no additional API call.

But then the response object will change, so that you will have to change your client. Instead of just one videoimage a list of videoimages will be returned.

jluc2808 commented 8 years ago

sorry i havn't understood that the query was inside the same API call, in that case of course it's a good solution

jluc2808 commented 8 years ago

did you implement the modification in the last release commited ?

jluc2808 commented 7 years ago

+1