doodle-providers

Doodle Movies App Provider Extensions

Provider

How providers are structured and how to create a new one.

Provider Folder Structure

Each provider lives in its own folder under providers/:

providers/
  myProvider/
    catalog.ts
    meta.ts
    posts.ts
    stream.ts
    episodes.ts (optional)

File Explanations

1. catalog.ts

2. meta.ts

3. posts.ts

4. stream.ts

5. episodes.ts (Optional)

providerContext?

providerContext is an object passed to each function, providing shared utilities and dependencies, such as:

This ensures all providers use the same tools and patterns, making code easier to maintain and extend.

Reference Types

All function signatures and return types should use the interfaces from providers/types.ts:

Example: posts.ts

import { Post, ProviderContext } from "../types";

export const getPosts = async function ({
  filter,
  page,
  providerValue,
  signal,
  providerContext,
}: {
  filter: string;
  page: number;
  providerValue: string;
  signal: AbortSignal;
  providerContext: ProviderContext;
}): Promise<Post[]> {
  // ...implementation...
};

export const getSearchPosts = async function ({
  searchQuery,
  page,
  providerValue,
  signal,
  providerContext,
}: {
  searchQuery: string;
  page: number;
  providerValue: string;
  signal: AbortSignal;
  providerContext: ProviderContext;
}): Promise<Post[]> {
  // ...implementation...
};

Example: catalog.ts

// catalog.ts
export const catalog = [
  { title: "Popular Movies", filter: "/category/popular-movies" },
  { title: "Latest TV Shows", filter: "/category/latest-tv-shows" },
];

export const genres = [
  { title: "Action", filter: "/genre/action" },
  { title: "Drama", filter: "/genre/drama" },
];

Example: meta.ts

// meta.ts
import { Info, ProviderContext } from "../types";

export const getMeta = async function ({
  link,
  providerContext,
}: {
  link: string;
  providerContext: ProviderContext;
}): Promise<Info> {
  // Fetch and parse metadata for the item
  // ...implementation...
  return {
    title: "Example Movie",
    synopsis: "A sample synopsis.",
    image: "https://example.com/image.jpg",
    imdbId: "tt1234567",
    type: "movie",
    linkList: [],
  };
};

Example: stream.ts

// stream.ts
import { Stream, ProviderContext } from "../types";

export const getStream = async function ({
  link,
  type,
  signal,
  providerContext,
}: {
  link: string;
  type: string;
  signal: AbortSignal;
  providerContext: ProviderContext;
}): Promise<Stream[]> {
  // Fetch and return streaming sources
  // ...implementation...
  return [
    {
      server: "ExampleServer",
      link: "https://example.com/stream.m3u8",
      type: "m3u8",
      quality: "1080",
    },
  ];
};

Example: episodes.ts (Optional)

// episodes.ts
import { EpisodeLink, ProviderContext } from "../types";

export const getEpisodes = async function ({
  url,
  providerContext,
}: {
  url: string;
  providerContext: ProviderContext;
}): Promise<EpisodeLink[]> {
  // Fetch and return episode links
  // ...implementation...
  return [
    { title: "Episode 1", link: "https://example.com/ep1" },
    { title: "Episode 2", link: "https://example.com/ep2" },
  ];
};

The linkList property in the object returned by getMeta is used to describe available seasons, episodes, or direct download/stream links for the item.

Example

linkList: [
  {
    title: "Season 2",
    episodesLink: "",
    directLinks: [
      {
        link: "https://example.com/download",
        title: "Episode 1",
        type: "movie",
      },
      // ...more episodes or links
    ],
    quality: "1080",
  },
];

This gives you flexibility to support both providers that need extra requests for episodes and those that can return all links up front.

How to Test Your Provider

  1. Start the Dev Server

    • Run the following command in your terminal:
      npm run auto
      
    • This will start the development server and log a “Mobile test url” (e.g., http://<your-local-ip>:3001).
  2. Configure the Doodle Movies App for Local Testing

    • Open your Doodle Movies app project.
    • Go to src/lib/services/ExtensionManager.ts.
    • Set the following variables in class ExtensionManager:
      private testMode = true;
      private baseUrlTestMode = "http://<your-local-ip>:3001"; // Use the Mobile test url from the dev server
      
    • This tells the app to use your local providers for testing.
  3. Network Requirement

    • Make sure both your development machine (running the dev server) and your mobile device (running the Doodle Movies app) are on the same network.
  4. Test in the App

    • App will now use your local provider code for all requests.

This workflow allows you to quickly test and debug new providers before deploying them.

Follow this structure and naming convention to ensure your provider integrates smoothly with the project.