Giter Club home page Giter Club logo

tmdb's Introduction

TMDb - The Movie Database

CI Integration CodeQL Documentation codecov

A Swift Package for The Movie Database (TMDb) https://www.themoviedb.org

Requirements

  • Swift 5.9+
  • OS
    • macOS 13+
    • iOS 16+
    • watchOS 9+
    • tvOS 16+
    • visionOS 1+
    • Windows
    • Linux

Installation

Add the TMDb package as a dependency to your Package.swift file, and add it as a dependency to your target.

// swift-tools-version:5.10

import PackageDescription

let package = Package(
  name: "MyProject",

  dependencies: [
    .package(url: "https://github.com/adamayoung/TMDb.git", from: "12.0.0")
  ],

  targets: [
    .target(name: "MyProject", dependencies: ["TMDb"])
  ]
)

Xcode project

Add the TMDb package to your Project's Package dependencies.

Setup

Get an API Key

Create an API key from The Movie Database web site https://www.themoviedb.org/documentation/api.

Documentation

Documentation and examples of usage can be found at https://adamayoung.github.io/TMDb/documentation/tmdb/

Development

Prerequisites

Install homebrew and the follow formulae

brew install swiftlint swiftformat markdownlint xcbeautify

Before submitting a PR

Unit and Integration Tests

Ensure all new code is covered by unit tests. If any new methods are added to services that make calls to TMDb API endpoints, ensure there are integration tests covering these.

Coding Style

Coding style is enforced by swiftlint and swiftformat.

Use the following command to lint the codebase:

make lint

To format the codebase use:

make format

DocC Documentation

Ensure all public classes, structs, properties and methods are commented

The DocC documentation can be built and hosted locally by

make preview-docs

See DocC | Apple Developer Documentation for more details.

CI Checks

Before submitting a PR, ensure all CI checks will pass:

make ci

CI checks are made up of the follow tasks:

make lint
make lint-markddown
make test
make test-ios
make test-watchos
make test-tvos
make test-visionos
make test-linux
make integration-test
make build-release
make build-docs

In order to run integration tests the following environment variables need to be set.

  • TMDB_API_KEY - Your TMDb API key
  • TMDB_USERNAME - Your TMDb username
  • TMDB_PASSWORD - Your TMDB password

If these environment variables aren't set then integration tests are skipped when not using make.

Running unit tests on Linux requires Docker to be running.

References

License

This library is licensed under the Apache License 2.0. See LICENSE for details.

tmdb's People

Contributors

adamayoung avatar dcamenisch avatar dependabot[bot] avatar jacobhearst avatar joeljfischer avatar tuikku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tmdb's Issues

Network requests do not work in Simulator

Network requests do not seem to work in the Simulator and only on an actual device. The following code was used:

return try await trendingService.tvSeries(inTimeWindow: .week, page: page).results

The call never returns.

This behavior was observed with the newest version of TMDb (bb032f0) and iOS 17.0 (both on device and in the Simulator).

Invalid url for tvEpisodeService.images

Executing the following code

let images = try await tmdb.tvShowEpisodes.images(forEpisode: 43, inSeason: 1, inTVShow: 37854)

results in the following value for images: TVShowEpisodeImageCollection(id: 1153014, stills: []). However, the correct result (as tested on https://developer.themoviedb.org/reference/tv-episode-images) should be:

{
  "id": 1153014,
  "stills": [
    {
      "aspect_ratio": 1.778,
      "height": 720,
      "iso_639_1": null,
      "file_path": "/bYgszCXq8oBIWCmq2kUg0xx3ob6.jpg",
      "vote_average": 5.312,
      "vote_count": 1,
      "width": 1280
    },
    {
      "aspect_ratio": 1.333,
      "height": 300,
      "iso_639_1": null,
      "file_path": "/hsNpOdjCr9OEDttxbzbMwvkCtcw.jpg",
      "vote_average": 5.172,
      "vote_count": 1,
      "width": 400
    },
    {
      "aspect_ratio": 1.778,
      "height": 675,
      "iso_639_1": null,
      "file_path": "/13v7WFhcpNxLvefU3eicgFrjVb2.jpg",
      "vote_average": 0,
      "vote_count": 0,
      "width": 1200
    }
  ]
}

I used the latest release version of the package (9.0.0).

Is it possible to get a list of Tv and Movie Genre?

Hi, I was using the TMDb api until I read about your library, I personally think it is awesome, I do have a question though, is it possible to get just an array of the genres and if it is a way, I've hadn't notice. Thanks for your help ๐Ÿ˜„
Best Regards

Language

Hi, is there any way to change the language of the requests ?

Search All Result Parsing

Hey!

Just wanted to start by saying I appreciate this library! I was actually making all the requests I needed myself, but once I ran into this, I figured I could switch over as this seems like a much better implementation than what I had going. I just had a question regarding using the search feature.

My specific use case requires searching movies and shows simultaneously by using the searchAll(..) method within SearchService. This seems to give a mix of results from TMDb with a generic media type.

I'm trying to figure out how I can decipher whether the Media that gets returned in the MediaPageableList is a Movie or TVShow. Even just knowing whether the ID property in Media is for a Movie or TVShow would suffice.

Is there any way to currently do this? Am I possible approaching this incorrectly or missing something? I would appreciate any help or insight on this!

P.S. I want to avoid searching movies and shows separately since the TMDb endpoint for searching all will return a list of content for what's more relevant whether that's movies, shows, or even people.

Genres on Movies is always nil

Hey there!

It looks like genres is always nil, although the API does return genres_ids.

If there is an sample of something similar, I might be able to send a PR.

Thanks
Steffen

Conform value types to Sendable

I see these warnings when using the async APIs and was wondering if the fix would be as simple as adding conformance to Sendable for the types in question?

image

Disclaimer: this is with StrictConcurrency option activated, so most likely won't show up by default right now.

iOS 13 Support

Hi there,

I hope you're doing well. I wanted to let you know that while using your library, I encountered a compatibility issue. Currently, the library only supports iOS 15 and above, but my project requires a minimum iOS version of 13. To address this, I forked the repository and made the necessary change to Package.swift to enable compatibility with iOS 13. All tests have passed successfully, and the library is working flawlessly.

I believe it would greatly benefit the community if the library could support iOS 13 and higher. I would be grateful if you could consider incorporating this change into the main repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.