Skip to content

Commit

Permalink
refactor: add new Episode data param on search method
Browse files Browse the repository at this point in the history
  • Loading branch information
rhenwinch committed Jun 22, 2024
1 parent 748e7e8 commit 00686ae
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 47 deletions.
25 changes: 25 additions & 0 deletions .run/generate plugins.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="generate plugins" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="make" />
<option value="generateUpdaterJson" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Flixclusive Provider Repo Template

Template for an [Flixclusive](https://github.com/rhenwinch/Flixclusive) providers repo
Template for a [Flixclusive](https://github.com/rhenwinch/Flixclusive) providers repo

⚠️ Make sure you check "Include all branches" when using this template
⚠️ Make sure you check **"Include all branches"** when using this template


## Getting started with writing your first providers
Expand Down
13 changes: 7 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.flixclusive.gradle.FlixclusiveExtension

import com.android.build.gradle.BaseExtension
import com.flixclusive.gradle.FlixclusiveProviderExtension


buildscript {
Expand Down Expand Up @@ -37,7 +38,7 @@ allprojects {
}
}

fun Project.flixclusive(configuration: FlixclusiveExtension.() -> Unit) = extensions.getByName<FlixclusiveExtension>("flixclusive").configuration()
fun Project.flxProvider(configuration: FlixclusiveProviderExtension.() -> Unit) = extensions.getByName<FlixclusiveProviderExtension>("flxProvider").configuration()

fun Project.android(configuration: BaseExtension.() -> Unit) = extensions.getByName<BaseExtension>("android").configuration()

Expand All @@ -48,7 +49,7 @@ subprojects {
apply(plugin = "kotlin-android")

// Fill out with your info
flixclusive {
flxProvider {
/**
*
* Add the author(s) of this repository.
Expand Down Expand Up @@ -89,15 +90,15 @@ subprojects {
}

dependencies {
val flixclusive by configurations
val getProviderStubs by configurations
val implementation by configurations
val testImplementation by configurations
val coreLibraryDesugaring by configurations

coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")

// Stubs for all Flixclusive classes
flixclusive("com.flixclusive:flixclusive:pre-release") {
getProviderStubs("rhenwinch:Flixclusive:pre-release") {
isChanging = true
}

Expand All @@ -124,4 +125,4 @@ subprojects {

task<Delete>("clean") {
delete(rootProject.buildDir)
}
}
12 changes: 1 addition & 11 deletions providers/MyFirstProvider/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,10 @@ android {
}
}

flixclusive {
flxProvider {
// ====== Provider Description =======
description.set("My first provider!")

/**
*
* Versions by level/hierarchy.
* Increment one of these to trigger the updater
* */
versionMajor = 1
versionMinor = 0
versionPatch = 0
Expand All @@ -53,11 +48,6 @@ flixclusive {
""".trimIndent()
) // OPTIONAL

/**
* Image or Gif that will be shown at the top of your changelog page
* */
// changelogMedia.set("https://cool.png") // OPTIONAL

/**
* Add additional authors to this plugin
* */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.github.yournamehere.my_first_provider

import android.content.Context
import com.flixclusive.core.util.film.FilmType
import com.flixclusive.model.provider.ProviderCatalog
import com.flixclusive.model.provider.SourceLink
import com.flixclusive.model.provider.Subtitle
import com.flixclusive.model.tmdb.Film
import com.flixclusive.model.tmdb.FilmDetails
import com.flixclusive.model.tmdb.FilmSearchItem
import com.flixclusive.model.tmdb.Movie
import com.flixclusive.model.tmdb.TMDBEpisode
import com.flixclusive.model.tmdb.SearchResponseData
import com.flixclusive.model.tmdb.TvShow
import com.flixclusive.model.tmdb.common.tv.Episode
import com.flixclusive.provider.Provider
import com.flixclusive.provider.ProviderApi
import com.flixclusive.provider.dto.FilmInfo
import com.flixclusive.provider.dto.SearchResults
import com.flixclusive.provider.util.FlixclusiveWebView
import com.flixclusive.provider.util.WebViewCallback
import okhttp3.OkHttpClient
Expand All @@ -35,56 +36,77 @@ class MyFirstProviderApi(
override val baseUrl: String
get() = super.baseUrl


/**
* Whether this provider needs to use a WebView to scrape content
* */
override val useWebView: Boolean
get() = super.useWebView

/**
*
* The list of [ProviderCatalog] that this provider supports. Defaults to empty
* */
override val catalogs: List<ProviderCatalog>
get() = super.catalogs

/**
*
* Called when the app needs to fetch items from
* this provider's [catalogs] list.
* */
override suspend fun getCatalogItems(
catalog: ProviderCatalog,
page: Int
): SearchResponseData<FilmSearchItem> {
return super.getCatalogItems(catalog, page)
}

/**
* Retrieves detailed information about a film.
* @param filmId The ID of the film.
* @param filmType The type of film.
* @return a [FilmInfo] instance containing the film's information.
* @param film The Film object of the film to retrieve details for.
* @return a [FilmDetails] instance containing the film's information.
*/
override suspend fun getFilmInfo(
filmId: String,
filmType: FilmType
): FilmInfo {
override suspend fun getFilmDetails(film: Film): FilmDetails {
TODO("Not yet implemented")
}

/**
* Obtains source links for the provided film, season, and episode.
* @param filmId The ID of the film. The ID must come from the [search] method.
* @param watchId The ID of the film. The ID must come from the [search] method.
* @param film The [Film] object of the film. It could either be a [Movie] or [TvShow].
* @param episode The episode number. Defaults to null if the film is a movie.
* @param onLinkLoaded A callback function invoked when a [SourceLink] is loaded.
* @param onSubtitleLoaded A callback function invoked when a [Subtitle] is loaded.
*/
override suspend fun getSourceLinks(
filmId: String,
film: Film,
season: Int?,
episode: Int?,
watchId: String,
film: FilmDetails,
episode: Episode?,
onLinkLoaded: (SourceLink) -> Unit,
onSubtitleLoaded: (Subtitle) -> Unit
) {
TODO("Not yet implemented")
}

/**
* Performs a search for films based on the provided query.
* @param film The [Film] object of the film. It could either be a [Movie] or [TvShow].
* @param page The page number for paginated results. Defaults to 1.
* @return a [SearchResults] instance containing the search results.
* Searches for films based on the provided criteria.
*
* @param title The title of the film to search for.
* @param id The ID of the film to search for (optional).
* @param tmdbId The TMDB ID of the film to search for (optional).
* @param imdbId The IMDB ID of the film to search for (optional).
* @param page The page number of the search results (optional, defaults to 1).
*
* @return A [SearchResponseData] object containing the search results.
*/
override suspend fun search(
film: Film,
page: Int
): SearchResults {
TODO("Not yet implemented")
title: String,
page: Int,
id: String?,
imdbId: String?,
tmdbId: Int?
): SearchResponseData<FilmSearchItem> {
return super.search(title, page, id, imdbId, tmdbId)
}

/**
Expand All @@ -99,7 +121,9 @@ class MyFirstProviderApi(
override fun getWebView(
context: Context,
callback: WebViewCallback,
film: Film,
episode: TMDBEpisode?
): FlixclusiveWebView? = super.getWebView(context, callback, film, episode)
film: FilmDetails,
episode: Episode?
): FlixclusiveWebView? {
return super.getWebView(context, callback, film, episode)
}
}

0 comments on commit 00686ae

Please sign in to comment.