Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(listview): tmdb can return duplicate movies from it's api, this c… #708

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

gageorsburn
Copy link

…hange filters out duplicates

Description

Screenshot (if UI-related)

To-Dos

  • Successful build yarn build
  • Translation keys yarn i18n:extract
  • Database migration (if required)

Issues Fixed or Closed

  • Fixes #XXXX

@Gauvino
Copy link
Contributor

Gauvino commented Apr 17, 2024

Do you have a movie to test this PR which appear duplicated, or the step to reproduce this error ?

@gageorsburn
Copy link
Author

@Gauvino I'm surprised nobody has raised this. It's coming from the upstream TMDB API (https://api.themoviedb.org/3/discover/movie).

It seems to be inconsistent and not always reproducible because it's coming from them. The best thing jellyseerr can do on it's side is to guard against duplicates in API responses.

I have screenshots I can show but that's really the best I can do. I were to be like, "look it's happening right now with this movie" it would likely be different by the time you read my message lol.

Screenshot_2024-04-15_095926

I'm guessing it stems from some bug TMBD has in their pagination code as when I was messing around with it, it was typically the last item in a page, and the first item in the next page.

@gageorsburn
Copy link
Author

gageorsburn commented Apr 26, 2024

Here's an API example that I can show that's happening currently.

Screenshot 2024-04-26 015457

If you look at the last result of the first page and the first result of the the second page you can see the duplicates coming from them.

GET https://api.themoviedb.org/3/discover/movie?api_key=db55323b8d3e4154498498a75642b381&page=1

{
  "page": 1,
  "results": [
    {
      "adult": false,
      "backdrop_path": "/4woSOUD0equAYzvwhWBHIJDCM88.jpg",
      "genre_ids": [
        28,
        27,
        53
      ],
      "id": 1096197,
      "original_language": "en",
      "original_title": "No Way Up",
      "overview": "Characters from different backgrounds are thrown together when the plane they're travelling on crashes into the Pacific Ocean. A nightmare fight for survival ensues with the air supply running out and dangers creeping in from all sides.",
      "popularity": 2111.241,
      "poster_path": "/hu40Uxp9WtpL34jv3zyWLb5zEVY.jpg",
      "release_date": "2024-01-18",
      "title": "No Way Up",
      "video": false,
      "vote_average": 6.3,
      "vote_count": 432
    },
    {
      "adult": false,
      "backdrop_path": "/qrGtVFxaD8c7et0jUtaYhyTzzPg.jpg",
      "genre_ids": [
        28,
        878,
        12,
        14
      ],
      "id": 823464,
      "original_language": "en",
      "original_title": "Godzilla x Kong: The New Empire",
      "overview": "Following their explosive showdown, Godzilla and Kong must reunite against a colossal undiscovered threat hidden within our world, challenging their very existence – and our own.",
      "popularity": 1754.673,
      "poster_path": "/gmGK5Gw5CIGMPhOmTO0bNA9Q66c.jpg",
      "release_date": "2024-03-27",
      "title": "Godzilla x Kong: The New Empire",
      "video": false,
      "vote_average": 6.606,
      "vote_count": 750
    },
    {
      "adult": false,
      "backdrop_path": "/FUnAVgaTs5xZWXcVzPJNxd9qGA.jpg",
      "genre_ids": [
        878,
        28,
        18,
        12
      ],
      "id": 934632,
      "original_language": "en",
      "original_title": "Rebel Moon — Part Two: The Scargiver",
      "overview": "The rebels gear up for battle against the ruthless forces of the Motherworld as unbreakable bonds are forged, heroes emerge — and legends are made.",
      "popularity": 1575.948,
      "poster_path": "/lV70XeG15PNNg3S1mwaoNk3LVHk.jpg",
      "release_date": "2024-04-19",
      "title": "Rebel Moon — Part Two: The Scargiver",
      "video": false,
      "vote_average": 6.179,
      "vote_count": 425
    },
    {
      "adult": false,
      "backdrop_path": "/1XDDXPXGiI8id7MrUxK36ke7gkX.jpg",
      "genre_ids": [
        16,
        28,
        10751,
        35,
        14
      ],
      "id": 1011985,
      "original_language": "en",
      "original_title": "Kung Fu Panda 4",
      "overview": "Po is gearing up to become the spiritual leader of his Valley of Peace, but also needs someone to take his place as Dragon Warrior. As such, he will train a new kung fu practitioner for the spot and will encounter a villain called the Chameleon who conjures villains from the past.",
      "popularity": 1513.697,
      "poster_path": "/kDp1vUBnMpe8ak4rjgl3cLELqjU.jpg",
      "release_date": "2024-03-02",
      "title": "Kung Fu Panda 4",
      "video": false,
      "vote_average": 7.139,
      "vote_count": 1283
    },
    {
      "adult": false,
      "backdrop_path": "/8uVKfOJUhmybNsVh089EqLHUYEG.jpg",
      "genre_ids": [
        878,
        12
      ],
      "id": 693134,
      "original_language": "en",
      "original_title": "Dune: Part Two",
      "overview": "Follow the mythic journey of Paul Atreides as he unites with Chani and the Fremen while on a path of revenge against the conspirators who destroyed his family. Facing a choice between the love of his life and the fate of the known universe, Paul endeavors to prevent a terrible future only he can foresee.",
      "popularity": 1395.205,
      "poster_path": "/1pdfLvkbY9ohJlCjQH2CZjjYVvJ.jpg",
      "release_date": "2024-02-27",
      "title": "Dune: Part Two",
      "video": false,
      "vote_average": 8.264,
      "vote_count": 3330
    },
    {
      "adult": false,
      "backdrop_path": "/pIFGZRCWjdQwECoXcphCCe1tl0B.jpg",
      "genre_ids": [
        27,
        9648,
        53
      ],
      "id": 1041613,
      "original_language": "en",
      "original_title": "Immaculate",
      "overview": "An American nun embarks on a new journey when she joins a remote convent in the Italian countryside. However, her warm welcome quickly turns into a living nightmare when she discovers her new home harbours a sinister secret and unspeakable horrors.",
      "popularity": 1271.662,
      "poster_path": "/fdZpvODTX5wwkD0ikZNaClE4AoW.jpg",
      "release_date": "2024-03-20",
      "title": "Immaculate",
      "video": false,
      "vote_average": 6.15,
      "vote_count": 264
    },
    {
      "adult": false,
      "backdrop_path": "/qnVm19Vu2Sc14LoEj82pmqAYr3p.jpg",
      "genre_ids": [
        12,
        28,
        18
      ],
      "id": 845111,
      "original_language": "fr",
      "original_title": "Les trois mousquetaires : Milady",
      "overview": "D'Artagnan, on a quest to rescue the abducted Constance, runs into the mysterious Milady de Winter again. The tension between the Catholics and the Protestants finally escalates, as the king declares war — forcing the now four musketeers into battle. But as the war goes on, they are tested physically, mentally and emotionally.",
      "popularity": 1025.73,
      "poster_path": "/rtosxP5sXuoRFPH4sVbMccLIPiV.jpg",
      "release_date": "2023-12-13",
      "title": "The Three Musketeers: Milady",
      "video": false,
      "vote_average": 6.535,
      "vote_count": 324
    },
    {
      "adult": false,
      "backdrop_path": "/fUC5VsQcU3m6zmYMD96R7RqPuMn.jpg",
      "genre_ids": [
        28,
        80,
        53
      ],
      "id": 1105407,
      "original_language": "en",
      "original_title": "Damaged",
      "overview": "A Chicago detective travels to Scotland after an emerging serial killer’s crimes match those that he investigated five years earlier, one of which was the crime scene of his murdered girlfriend.",
      "popularity": 873.261,
      "poster_path": "/tMO0YLXgJZBnIAjoTSz26zE33YN.jpg",
      "release_date": "2024-04-12",
      "title": "Damaged",
      "video": false,
      "vote_average": 4.9,
      "vote_count": 37
    },
    {
      "adult": false,
      "backdrop_path": "/keVfqCMKmJ55nHzmqR2Q5K7LwJt.jpg",
      "genre_ids": [
        28,
        53,
        10752
      ],
      "id": 784651,
      "original_language": "hi",
      "original_title": "फाइटर",
      "overview": "Top IAF aviators come together in the face of imminent danger, to form Air Dragons. Fighter unfolds their camaraderie, brotherhood and battles, internal and external.",
      "popularity": 751.861,
      "poster_path": "/zDZowwb9GZGEctAu2PCpjiPQAMM.jpg",
      "release_date": "2024-01-24",
      "title": "Fighter",
      "video": false,
      "vote_average": 5.07,
      "vote_count": 43
    },
    {
      "adult": false,
      "backdrop_path": "/7ZP8HtgOIDaBs12krXgUIygqEsy.jpg",
      "genre_ids": [
        878,
        28,
        14,
        12
      ],
      "id": 601796,
      "original_language": "ko",
      "original_title": "외계+인 1부",
      "overview": "Gurus in the late Goryeo dynasty try to obtain a fabled, holy sword, and humans in 2022 hunt down an alien prisoner that is locked in a human's body. The two parties cross paths when a time-traveling portal opens up.",
      "popularity": 731.743,
      "poster_path": "/8QVDXDiOGHRcAD4oM6MXjE0osSj.jpg",
      "release_date": "2022-07-20",
      "title": "Alienoid",
      "video": false,
      "vote_average": 6.84,
      "vote_count": 287
    },
    {
      "adult": false,
      "backdrop_path": "/lP0G6f00CjOKdRECyGrT0kaMSrL.jpg",
      "genre_ids": [
        18
      ],
      "id": 383634,
      "original_language": "ja",
      "original_title": "肉体の門",
      "overview": "Prostitutes in burnt out Tokyo ghetto of post-WWII Japan peddle their flesh and save one-third of their money for a proposed dancehall to be named Paradise. The hookers live in a bombed-out building, but they accept the precarious situation with typical resolve.",
      "popularity": 563.498,
      "poster_path": "/raNbLci95MJ3L3dMnG7L7bD37lY.jpg",
      "release_date": "1988-04-09",
      "title": "Carmen 1945",
      "video": false,
      "vote_average": 3,
      "vote_count": 7
    },
    {
      "adult": false,
      "backdrop_path": "/pwGmXVKUgKN13psUjlhC9zBcq1o.jpg",
      "genre_ids": [
        28,
        14
      ],
      "id": 634492,
      "original_language": "en",
      "original_title": "Madame Web",
      "overview": "Forced to confront revelations about her past, paramedic Cassandra Webb forges a relationship with three young women destined for powerful futures...if they can all survive a deadly present.",
      "popularity": 717.893,
      "poster_path": "/rULWuutDcN5NvtiZi4FRPzRYWSh.jpg",
      "release_date": "2024-02-14",
      "title": "Madame Web",
      "video": false,
      "vote_average": 5.618,
      "vote_count": 1134
    },
    {
      "adult": false,
      "backdrop_path": "/oe7mWkvYhK4PLRNAVSvonzyUXNy.jpg",
      "genre_ids": [
        28,
        53
      ],
      "id": 359410,
      "original_language": "en",
      "original_title": "Road House",
      "overview": "Ex-UFC fighter Dalton takes a job as a bouncer at a Florida Keys roadhouse, only to discover that this paradise is not all it seems.",
      "popularity": 706.13,
      "poster_path": "/bXi6IQiQDHD00JFio5ZSZOeRSBh.jpg",
      "release_date": "2024-03-08",
      "title": "Road House",
      "video": false,
      "vote_average": 7.025,
      "vote_count": 1554
    },
    {
      "adult": false,
      "backdrop_path": "/cIztAxDn3H8JylRaJwiHHpkGe53.jpg",
      "genre_ids": [
        10751,
        35,
        16
      ],
      "id": 1239146,
      "original_language": "en",
      "original_title": "Woody Woodpecker Goes to Camp",
      "overview": "After getting kicked out of the forest, Woody thinks he's found a forever home at Camp Woo Hoo — until an inspector threatens to shut down the camp.",
      "popularity": 644.046,
      "poster_path": "/mMnzNYvpqLLLdgF5TMmXfuy6wzx.jpg",
      "release_date": "2024-04-12",
      "title": "Woody Woodpecker Goes to Camp",
      "video": false,
      "vote_average": 6.61,
      "vote_count": 82
    },
    {
      "adult": false,
      "backdrop_path": "/2KGxQFV9Wp1MshPBf8BuqWUgVAz.jpg",
      "genre_ids": [
        16,
        28,
        12,
        35,
        10751
      ],
      "id": 940551,
      "original_language": "en",
      "original_title": "Migration",
      "overview": "After a migrating duck family alights on their pond with thrilling tales of far-flung places, the Mallard family embarks on a family road trip, from New England, to New York City, to tropical Jamaica.",
      "popularity": 637.694,
      "poster_path": "/ldfCF9RhR40mppkzmftxapaHeTo.jpg",
      "release_date": "2023-12-06",
      "title": "Migration",
      "video": false,
      "vote_average": 7.524,
      "vote_count": 1233
    },
    {
      "adult": false,
      "backdrop_path": "/unCdljyU2FuUBDUcdZezeI9yaaj.jpg",
      "genre_ids": [
        878,
        9648,
        53,
        28
      ],
      "id": 720321,
      "original_language": "en",
      "original_title": "Breathe",
      "overview": "Air-supply is scarce in the near future, forcing a mother and daughter to fight for survival when two strangers arrive desperate for an oxygenated haven.",
      "popularity": 620.367,
      "poster_path": "/wTW2t8ocWDlHns8I7vQxuqkyK58.jpg",
      "release_date": "2024-04-04",
      "title": "Breathe",
      "video": false,
      "vote_average": 5.136,
      "vote_count": 55
    },
    {
      "adult": false,
      "backdrop_path": "/uv2twFGMk2qBdyJBJAVcrpRtSa9.jpg",
      "genre_ids": [
        10752,
        28,
        18
      ],
      "id": 929590,
      "original_language": "en",
      "original_title": "Civil War",
      "overview": "In the near future, a group of war journalists attempt to survive while reporting the truth as the United States stands on the brink of civil war.",
      "popularity": 561.261,
      "poster_path": "/sh7Rg8Er3tFcN9BpKIPOMvALgZd.jpg",
      "release_date": "2024-04-10",
      "title": "Civil War",
      "video": false,
      "vote_average": 7.444,
      "vote_count": 390
    },
    {
      "adult": false,
      "backdrop_path": "/qekky2LbtT1wtbD5MDgQvjfZQ24.jpg",
      "genre_ids": [
        28,
        53
      ],
      "id": 984324,
      "original_language": "fr",
      "original_title": "Le salaire de la peur",
      "overview": "When an explosion at an oil well threatens hundreds of lives, a crack team is called upon to make a deadly desert crossing with nitroglycerine in tow.",
      "popularity": 530.225,
      "poster_path": "/jFK2ZLQUzo9pea0jfMCHDfvWsx7.jpg",
      "release_date": "2024-03-28",
      "title": "The Wages of Fear",
      "video": false,
      "vote_average": 5.717,
      "vote_count": 189
    },
    {
      "adult": false,
      "backdrop_path": "/dcnSWFCtk4b2aIzkhq6IDbzoIf1.jpg",
      "genre_ids": [
        28,
        35
      ],
      "id": 942047,
      "original_language": "en",
      "original_title": "Outsource",
      "overview": "A police chief hires an old friend, who is an international spy, to help him search for a wanted suspect in the Philippines. When the chief dies, all evidence points towards the spy, and he must go to extremes to defend himself.",
      "popularity": 529.557,
      "poster_path": "/zIAF0UXtCJTJOYNYWiBfyifaaOi.jpg",
      "release_date": "2022-01-18",
      "title": "Outsource",
      "video": false,
      "vote_average": 2,
      "vote_count": 5
    },
    {
      "adult": false,
      "backdrop_path": "/5cCfqeUH2f5Gnu7Lh9xepY9TB6x.jpg",
      "genre_ids": [
        14,
        12,
        35
      ],
      "id": 967847,
      "original_language": "en",
      "original_title": "Ghostbusters: Frozen Empire",
      "overview": "The Spengler family returns to where it all started – the iconic New York City firehouse – to team up with the original Ghostbusters, who've developed a top-secret research lab to take busting ghosts to the next level. But when the discovery of an ancient artifact unleashes an evil force, Ghostbusters new and old must join forces to protect their home and save the world from a second Ice Age.",
      "popularity": 507.139,
      "poster_path": "/6faYaQyiBPhqAizldJKq21mIVaE.jpg",
      "release_date": "2024-03-20",
      "title": "Ghostbusters: Frozen Empire",
      "video": false,
      "vote_average": 6.409,
      "vote_count": 331
    }
  ],
  "total_pages": 43777,
  "total_results": 875527
}

GET https://api.themoviedb.org/3/discover/movie?api_key=db55323b8d3e4154498498a75642b381&page=2

{
  "page": 2,
  "results": [
    {
      "adult": false,
      "backdrop_path": "/5cCfqeUH2f5Gnu7Lh9xepY9TB6x.jpg",
      "genre_ids": [
        14,
        12,
        35
      ],
      "id": 967847,
      "original_language": "en",
      "original_title": "Ghostbusters: Frozen Empire",
      "overview": "The Spengler family returns to where it all started – the iconic New York City firehouse – to team up with the original Ghostbusters, who've developed a top-secret research lab to take busting ghosts to the next level. But when the discovery of an ancient artifact unleashes an evil force, Ghostbusters new and old must join forces to protect their home and save the world from a second Ice Age.",
      "popularity": 381.355,
      "poster_path": "/6faYaQyiBPhqAizldJKq21mIVaE.jpg",
      "release_date": "2024-03-20",
      "title": "Ghostbusters: Frozen Empire",
      "video": false,
      "vote_average": 6.405,
      "vote_count": 330
    },
    {
      "adult": false,
      "backdrop_path": "/umyOinNa6vqqnqoVc9QqzyaapUz.jpg",
      "genre_ids": [
        27
      ],
      "id": 938614,
      "original_language": "en",
      "original_title": "Late Night with the Devil",
      "overview": "A live broadcast of a late-night talk show in 1977 goes horribly wrong, unleashing evil into the nation's living rooms.",
      "popularity": 632.951,
      "poster_path": "/u3YQJctMzFN2wAvnkmXy41bXhFv.jpg",
      "release_date": "2024-03-19",
      "title": "Late Night with the Devil",
      "video": false,
      "vote_average": 7.23,
      "vote_count": 178
    },
    {
      "adult": false,
      "backdrop_path": "/fypydCipcWDKDTTCoPucBsdGYXW.jpg",
      "genre_ids": [
        878,
        12,
        28
      ],
      "id": 653346,
      "original_language": "en",
      "original_title": "Kingdom of the Planet of the Apes",
      "overview": "Several generations in the future following Caesar's reign, apes are now the dominant species and live harmoniously while humans have been reduced to living in the shadows. As a new tyrannical ape leader builds his empire, one young ape undertakes a harrowing journey that will cause him to question all that he has known about the past and to make choices that will define a future for apes and humans alike.",
      "popularity": 471.896,
      "poster_path": "/fAjyUDKABSehK6pHWvh9ket5X3z.jpg",
      "release_date": "2024-05-08",
      "title": "Kingdom of the Planet of the Apes",
      "video": false,
      "vote_average": 0,
      "vote_count": 0
    },
    {
      "adult": false,
      "backdrop_path": "/e3gVl1gnxEFKLTF6pn6KRqUPi9K.jpg",
      "genre_ids": [
        10749,
        18
      ],
      "id": 1127166,
      "original_language": "it",
      "original_title": "Fabbricante di lacrime",
      "overview": "Adopted together after a tough childhood in an orphanage, Nica and Rigel realize that unexpected but irresistible feelings pull them together.",
      "popularity": 396.158,
      "poster_path": "/uoBHsxSgfc3PQsSn98RfnbePHOy.jpg",
      "release_date": "2024-04-03",
      "title": "The Tearsmith",
      "video": false,
      "vote_average": 6.538,
      "vote_count": 436
    },
    {
      "adult": false,
      "backdrop_path": "/atPlFdUrQl2U9MtUwujrrjnQHBA.jpg",
      "genre_ids": [
        28,
        80,
        18,
        53
      ],
      "id": 654739,
      "original_language": "ko",
      "original_title": "발신제한",
      "overview": "On his way to work, a bank manager receives an anonymous call claiming there's a bomb under his car seat, and if anyone exits the car, it will explode unless he can pay a ransom.",
      "popularity": 389.651,
      "poster_path": "/y2Aimt8isimtigec3e4kB2G9FMR.jpg",
      "release_date": "2021-06-23",
      "title": "Hard Hit",
      "video": false,
      "vote_average": 7.654,
      "vote_count": 172
    },
    {
      "adult": false,
      "backdrop_path": "/qwK9soQmmJ7kRdjLZVXblw3g7AQ.jpg",
      "genre_ids": [
        28,
        12,
        53,
        80
      ],
      "id": 7451,
      "original_language": "en",
      "original_title": "xXx",
      "overview": "Xander Cage is your standard adrenaline junkie with no fear and a lousy attitude. When the US Government \"recruits\" him to go on a mission, he's not exactly thrilled. His mission: to gather information on an organization that may just be planning the destruction of the world, led by the nihilistic Yorgi.",
      "popularity": 409.57,
      "poster_path": "/xeEw3eLeSFmJgXZzmF2Efww0q3s.jpg",
      "release_date": "2002-08-09",
      "title": "xXx",
      "video": false,
      "vote_average": 5.929,
      "vote_count": 4015
    },
    {
      "adult": false,
      "backdrop_path": "/nb3xI8XI3w4pMVZ38VijbsyBqP4.jpg",
      "genre_ids": [
        18,
        36
      ],
      "id": 872585,
      "original_language": "en",
      "original_title": "Oppenheimer",
      "overview": "The story of J. Robert Oppenheimer's role in the development of the atomic bomb during World War II.",
      "popularity": 406.163,
      "poster_path": "/8Gxv8gSFCU0XGDykEGv7zR1n2ua.jpg",
      "release_date": "2023-07-19",
      "title": "Oppenheimer",
      "video": false,
      "vote_average": 8.11,
      "vote_count": 7777
    },
    {
      "adult": false,
      "backdrop_path": "/9c0lHTXRqDBxeOToVzRu0GArSne.jpg",
      "genre_ids": [
        878,
        28
      ],
      "id": 935271,
      "original_language": "en",
      "original_title": "After the Pandemic",
      "overview": "Set in a post-apocalyptic world where a global airborne pandemic has wiped out 90% of the Earth's population and only the young and immune have endured as scavengers. For Ellie and Quinn, the daily challenges to stay alive are compounded when they become hunted by the merciless Stalkers.",
      "popularity": 409.79,
      "poster_path": "/p1LbrdJ53dGfEhRopG71akfzOVu.jpg",
      "release_date": "2022-03-01",
      "title": "After the Pandemic",
      "video": false,
      "vote_average": 4.798,
      "vote_count": 57
    },
    {
      "adult": false,
      "backdrop_path": "/lzWHmYdfeFiMIY4JaMmtR7GEli3.jpg",
      "genre_ids": [
        878,
        12
      ],
      "id": 438631,
      "original_language": "en",
      "original_title": "Dune",
      "overview": "Paul Atreides, a brilliant and gifted young man born into a great destiny beyond his understanding, must travel to the most dangerous planet in the universe to ensure the future of his family and his people. As malevolent forces explode into conflict over the planet's exclusive supply of the most precious resource in existence-a commodity capable of unlocking humanity's greatest potential-only those who can conquer their fear will survive.",
      "popularity": 430.737,
      "poster_path": "/d5NXSklXo0qyIYkgV94XAgMIckC.jpg",
      "release_date": "2021-09-15",
      "title": "Dune",
      "video": false,
      "vote_average": 7.789,
      "vote_count": 11390
    },
    {
      "adult": false,
      "backdrop_path": "/oBIQDKcqNxKckjugtmzpIIOgoc4.jpg",
      "genre_ids": [
        28,
        53,
        10752
      ],
      "id": 969492,
      "original_language": "en",
      "original_title": "Land of Bad",
      "overview": "When a Delta Force special ops mission goes terribly wrong, Air Force drone pilot Reaper has 48 hours to remedy what has devolved into a wild rescue operation. With no weapons and no communication other than the drone above, the ground mission suddenly becomes a full-scale battle when the team is discovered by the enemy.",
      "popularity": 374.146,
      "poster_path": "/h3jYanWMEJq6JJsCopy1h7cT2Hs.jpg",
      "release_date": "2024-01-25",
      "title": "Land of Bad",
      "video": false,
      "vote_average": 7.25,
      "vote_count": 640
    },
    {
      "adult": false,
      "backdrop_path": "/aINel9503ompOlGKn4sIVMg09Un.jpg",
      "genre_ids": [
        9648,
        27,
        53
      ],
      "id": 838209,
      "original_language": "ko",
      "original_title": "파묘",
      "overview": "After tracing the origin of a disturbing supernatural affliction to a wealthy family's ancestral gravesite, a team of paranormal experts relocates the remains—and soon discovers what happens to those who dare to mess with the wrong grave.",
      "popularity": 430.058,
      "poster_path": "/m4xzX3yuroKerFOltY1yY05nqcQ.jpg",
      "release_date": "2024-02-22",
      "title": "Exhuma",
      "video": false,
      "vote_average": 7.8,
      "vote_count": 50
    },
    {
      "adult": false,
      "backdrop_path": "/ilK1JRbMjo4sMJtNKLOKnqRf1RH.jpg",
      "genre_ids": [
        10752,
        28,
        36
      ],
      "id": 976906,
      "original_language": "en",
      "original_title": "Spitfire Over Berlin",
      "overview": "August 1944. With the American Eighth Air Force poised to strike over Nazi Germany, British Intelligence learns that they could be flying into a deadly trap. With only hours to spare, Flight Lieutenant Edward Barnes must fly a life and death mission over Berlin in his unarmed Spitfire to obtain photographic evidence and save the lives of 1200 men.",
      "popularity": 547.208,
      "poster_path": "/xtPPOPTad1qopK6uDe3VlYUa22o.jpg",
      "release_date": "2022-05-13",
      "title": "Spitfire Over Berlin",
      "video": false,
      "vote_average": 3.4,
      "vote_count": 11
    },
    {
      "adult": false,
      "backdrop_path": "/cJiZwrwHiU9edbHEDDqCsna0xtS.jpg",
      "genre_ids": [
        35,
        878,
        28
      ],
      "id": 533535,
      "original_language": "en",
      "original_title": "Deadpool & Wolverine",
      "overview": "Third entry in the \"Deadpool\" franchise. Plot TBA.",
      "popularity": 353.303,
      "poster_path": "/7cvdeitoAiDtcpWXxOTAb44OFNn.jpg",
      "release_date": "2024-07-24",
      "title": "Deadpool & Wolverine",
      "video": false,
      "vote_average": 0,
      "vote_count": 0
    },
    {
      "adult": false,
      "backdrop_path": "/sRLC052ieEzkQs9dEtPMfFxYkej.jpg",
      "genre_ids": [
        878,
        18,
        28
      ],
      "id": 848326,
      "original_language": "en",
      "original_title": "Rebel Moon — Part One: A Child of Fire",
      "overview": "When the ruthless forces of the Motherworld threaten a quiet farming village on a distant moon, a mysterious outsider becomes its best hope for survival.",
      "popularity": 315.12,
      "poster_path": "/ui4DrH1cKk2vkHshcUcGt2lKxCm.jpg",
      "release_date": "2023-12-15",
      "title": "Rebel Moon — Part One: A Child of Fire",
      "video": false,
      "vote_average": 6.372,
      "vote_count": 1730
    },
    {
      "adult": false,
      "backdrop_path": "/ySgY4jBvZ6qchrxKnBg4M8tZp8V.jpg",
      "genre_ids": [
        27,
        53,
        35
      ],
      "id": 1111873,
      "original_language": "en",
      "original_title": "Abigail",
      "overview": "After a group of would-be criminals kidnap the 12 year old ballerina daughter of a powerful underworld figure, all they have to do to collect a $50 million ransom is watch the girl overnight. In an isolated mansion, the captors start to dwindle, one by one, and they discover, to their mounting horror, that they’re locked inside with no normal little girl.",
      "popularity": 378.658,
      "poster_path": "/5Uq8P6MPj9Ppsns5t82AiCiUaWE.jpg",
      "release_date": "2024-04-18",
      "title": "Abigail",
      "video": false,
      "vote_average": 6.892,
      "vote_count": 51
    },
    {
      "adult": false,
      "backdrop_path": "/4CcUgdiGe83MeqJW1NyJVmZqRrF.jpg",
      "genre_ids": [
        18,
        10749
      ],
      "id": 937287,
      "original_language": "en",
      "original_title": "Challengers",
      "overview": "Tennis player turned coach Tashi has taken her husband, Art, and transformed him into a world-famous Grand Slam champion. To jolt him out of his recent losing streak, she signs him up for a \"Challenger\" event — close to the lowest level of pro tournament — where he finds himself standing across the net from his former best friend and Tashi's former boyfriend.",
      "popularity": 361.52,
      "poster_path": "/esLooowdB92I3dVI3ENlPPpTuWT.jpg",
      "release_date": "2024-04-18",
      "title": "Challengers",
      "video": false,
      "vote_average": 7.2,
      "vote_count": 61
    },
    {
      "adult": false,
      "backdrop_path": "/yyFc8Iclt2jxPmLztbP617xXllT.jpg",
      "genre_ids": [
        35,
        10751,
        14
      ],
      "id": 787699,
      "original_language": "en",
      "original_title": "Wonka",
      "overview": "Willy Wonka – chock-full of ideas and determined to change the world one delectable bite at a time – is proof that the best things in life begin with a dream, and if you’re lucky enough to meet Willy Wonka, anything is possible.",
      "popularity": 354.288,
      "poster_path": "/qhb1qOilapbapxWQn9jtRCMwXJF.jpg",
      "release_date": "2023-12-06",
      "title": "Wonka",
      "video": false,
      "vote_average": 7.191,
      "vote_count": 2873
    },
    {
      "adult": false,
      "backdrop_path": "/4XM8DUTQb3lhLemJC51Jx4a2EuA.jpg",
      "genre_ids": [
        28,
        80,
        53
      ],
      "id": 385687,
      "original_language": "en",
      "original_title": "Fast X",
      "overview": "Over many missions and against impossible odds, Dom Toretto and his family have outsmarted, out-nerved and outdriven every foe in their path. Now, they confront the most lethal opponent they've ever faced: A terrifying threat emerging from the shadows of the past who's fueled by blood revenge, and who is determined to shatter this family and destroy everything—and everyone—that Dom loves, forever.",
      "popularity": 364.855,
      "poster_path": "/fiVW06jE7z9YnO4trhaMEdclSiC.jpg",
      "release_date": "2023-05-17",
      "title": "Fast X",
      "video": false,
      "vote_average": 7.13,
      "vote_count": 5069
    },
    {
      "adult": false,
      "backdrop_path": "/deLWkOLZmBNkm8p16igfapQyqeq.jpg",
      "genre_ids": [
        14,
        28,
        12
      ],
      "id": 763215,
      "original_language": "en",
      "original_title": "Damsel",
      "overview": "A young woman's marriage to a charming prince turns into a fierce fight for survival when she's offered up as a sacrifice to a fire-breathing dragon.",
      "popularity": 385.276,
      "poster_path": "/AgHbB9DCE9aE57zkHjSmseszh6e.jpg",
      "release_date": "2024-03-07",
      "title": "Damsel",
      "video": false,
      "vote_average": 7.141,
      "vote_count": 1668
    },
    {
      "adult": false,
      "backdrop_path": "/kaIfm5ryEOwYg8mLbq8HkPuM1Fo.jpg",
      "genre_ids": [
        28,
        12,
        878
      ],
      "id": 284053,
      "original_language": "en",
      "original_title": "Thor: Ragnarok",
      "overview": "Thor is imprisoned on the other side of the universe and finds himself in a race against time to get back to Asgard to stop Ragnarok, the destruction of his home-world and the end of Asgardian civilization, at the hands of a powerful new threat, the ruthless Hela.",
      "popularity": 278.547,
      "poster_path": "/rzRwTcFvttcN1ZpX2xv4j3tSdJu.jpg",
      "release_date": "2017-10-02",
      "title": "Thor: Ragnarok",
      "video": false,
      "vote_average": 7.593,
      "vote_count": 20136
    }
  ],
  "total_pages": 43777,
  "total_results": 875540
}

Also, here's a very recent discussion saying that tmdb makes no guarantees that every movie returned will be unique and it's expected behavior for them.

https://www.themoviedb.org/talk/662119b83f48330186740cd0

@Jimmyscene
Copy link

Jimmyscene commented Apr 26, 2024

At a quick glance, you probably want to add that filter to the useDiscover hook instead of the ListView, which seems like it's a bit more generic.

Disclaimer I do not maintain this repo

@Fallenbagel
Copy link
Owner

Is this related to:
sct/overseerr#3500

@gageorsburn
Copy link
Author

gageorsburn commented Apr 27, 2024

Seems like it. I only noticed the issue when looking for something to watch and checked the issues here, but not at overseerr.. I will say feels like a lazy response in that issue.

I actually abhor writing JavaScript and don't do nearly any react so there's a bunch about state I don't know. However, I would assume a solution that stores a hashmap of every id added, and as items are added, look ups against the hashmap for the id are done before adding a new item. That would solve any performance problems by using a tiny bit more memory. I just have no idea where to do those things in this codebase.

Edit: Pushed a cleaner fix.

@gageorsburn gageorsburn force-pushed the fix-duplicate-movies branch 2 times, most recently from 20b3eb6 to f887fff Compare April 27, 2024 03:57
fixing duplicate movies that can be returned from the tmdb api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants