recloudstream / cloudstream

Android app for streaming and downloading media.
GNU General Public License v3.0
6.47k stars 517 forks source link

Add Discover Menu #671

Open EHMilon opened 11 months ago

EHMilon commented 11 months ago

Describe your suggested feature

CloudStream 3 is a wonderful project. I really love this app. Before explore this app, I used Stremio. I'm missing The Discover Menu, which is not present in CS3. I have some Request to CloudStream 3 Developers. Create a Discover menu using TMDB API for displaying all the latest Movies & TV Series. Here I edit some images, how it should look and work. Please look very carefully, specially the Menu bar.

In Discover menu, If someone click on a movie, then it will open in Search and search the movie in all CS3 extension. Suppose someone wanted to watch Barbie, he can click on the image, and it would search for it on all CS3 extensions.

New Project (2)

As a Movie lover, it will help me to keep track of any new movies Update. In home menu, we choose a particular provider. There has a chance that a new movie is not updated on this provider. But the same movie have other providers. In home menu Movies & TV Series are display categories wise like Popular, Latest. It's not offering to scroll all Movies & TV Series. But if you create Discover Menu, it will give us access to Non-Stop Scrolling.

If you implement Discover menu using TMDB API in CS3. It will also help to find Screen Cast (actors), Tags such as Action, Comedy, Country Specific and lot more.

tags

I did a lot of work on it. Hope you don't disappoint me. I think it's hard, but not impossible to do.

Other details

You can use the TMDB API to fetch movie images and display them in your app. The TMDB API provides endpoints to retrieve movie details, including a variety of images related to movies, including movie posters, backdrops, and more, using their unique movie IDs. You can make HTTP requests to the TMDB API to fetch the movie details and then use the movie image URLs to display the images in your app's Discover Menu interface.

Here's a general outline of how you can do this:

Get an API Key: Sign up for a free API key from TMDB if you haven't already.

Make API Requests: Use the TMDB API to make requests for movie details. When you retrieve movie details, you will receive URLs to images associated with the movie.

Display Images: Once you have the image URLs, you can use them in your app to display movie posters or other images. This might involve downloading and caching the images for better performance.

Example:

import android.os.AsyncTask
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ImageView
import com.bumptech.glide.Glide
import org.json.JSONObject
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.HttpURLConnection
import java.net.URL

class MainActivity : AppCompatActivity() {

    // Replace with your TMDB API key
    private val apiKey = "your_api_key"

    // List of TMDB movie IDs
    private val tmdbMovieIds = listOf(123, 456, 789) // Replace with your movie IDs

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Initialize ImageView references in your layout
        val imageView1: ImageView = findViewById(R.id.imageView1)
        val imageView2: ImageView = findViewById(R.id.imageView2)
        val imageView3: ImageView = findViewById(R.id.imageView3)

        // Fetch movie images and display them in ImageViews
        for ((index, tmdbId) in tmdbMovieIds.withIndex()) {
            FetchMovieImageTask(apiKey, index, imageView1, imageView2, imageView3).execute(tmdbId)
        }
    }

    // AsyncTask to fetch movie image for a given TMDB ID
    private inner class FetchMovieImageTask(
        private val apiKey: String,
        private val imageViewIndex: Int,
        private val imageViews: Array<ImageView>
    ) : AsyncTask<Int, Void, String>() {

        override fun doInBackground(vararg params: Int?): String {
            val tmdbId = params[0] ?: return ""
            val imageUrl = fetchMovieImage(tmdbId)
            return imageUrl
        }

        override fun onPostExecute(result: String?) {
            super.onPostExecute(result)
            if (result != null && imageViewIndex < imageViews.size) {
                // Load the movie image into the corresponding ImageView using Glide or another image loading library
                Glide.with(this@MainActivity)
                    .load(result)
                    .into(imageViews[imageViewIndex])
            }
        }

        private fun fetchMovieImage(tmdbId: Int): String {
            val url = URL("https://api.themoviedb.org/3/movie/$tmdbId?api_key=$apiKey")
            val connection = url.openConnection() as HttpURLConnection
            try {
                val reader = BufferedReader(InputStreamReader(connection.inputStream))
                val response = StringBuilder()
                var line: String?
                while (reader.readLine().also { line = it } != null) {
                    response.append(line)
                }
                return parseMovieImage(response.toString())
            } finally {
                connection.disconnect()
            }
        }

        private fun parseMovieImage(response: String): String {
            val jsonObject = JSONObject(response)
            val posterPath = jsonObject.optString("poster_path")
            if (posterPath.isNotEmpty()) {
                return "https://image.tmdb.org/t/p/w500$posterPath"
            }
            return ""
        }
    }
}

You can also use OMDB API. I don't Know Kotlin. If I know, I will be happy to contributes with this amazing app. Please add Discover Menu feature in your CloudStream 3 app. @LagradOst

Acknowledgements

recloudstream[bot] commented 11 months ago

Hello EHMilon. Please do not report any provider bugs here. This repository does not contain any providers. Please find the appropriate repository and report your issue there or join the discord.

Found provider name: Stremio

Luna712 commented 11 months ago

I am not sure why I was mentioned, I am not involved in the development of CloudStream except for a few minor things I do PRs for every once in a while when I can.

Rayforest commented 11 months ago

Great idea if you ask me. But it would maybe take ages to code. So better to use an alternate app for discovering movies ig and then copy paste the movie title to cs3 or if the app has Simkl then sync them. What should be of higher priority is to maintain all the existing providers and make sure they continue functioning. Also torrent streaming would be nice to have

Rayforest commented 11 months ago

Is there any good open source app which provides a good list of movies to watch as well as a discover section? I would love to try one of those

LagradOst commented 11 months ago

damn, this is a really good UI example. I really like this example

IndusAryan commented 11 months ago

cloudstream is a media center that doesnt come with anything already bundled bottom navigation bar can only house 5 items

EHMilon commented 11 months ago

damn, this is a really good UI example. I really like this example

@EHMilon. Glad to hear that you like it. In Discover menu UI, I can help you in this point. How it should look. Please give me a chance to work on it. @LagradOst

Luna712 commented 10 months ago

For the record I really like this UI example as well, it is very well done. And looks very nice. But I agree it might take a long time to create but it could work very well if it could be done.

EHMilon commented 10 months ago

I am not sure why I was mentioned, I am not involved in the development of CloudStream except for a few minor things I do PRs for every once in a while when I can.

Sorry, I think you are developer also. No problem, I removed your mention.

EHMilon commented 10 months ago

For the record I really like this UI example as well, it is very well done. And looks very nice. But I agree it might take a long time to create but it could work very well if it could be done.

Thank you.

Luna712 commented 10 months ago

cloudstream is a media center that doesnt come with anything already bundled bottom navigation bar can only house 5 items

@IndusAryan

I wonder if downloads and any future proper watch history (IE inspired by something like the history tab QuickNovel has) could be moved to library in some capacity so still only 5 items in the bottem navigation also? Just a thought though, might be a better way also. I think you could also reduce the icon size for each item to add a 6th item and make it look nice still though. More items could definitely be added to the TV navigation but I agree it might be a bit tricky as well on phone layout.

LagradOst commented 10 months ago

I wonder if downloads and any future proper watch history (IE inspired by something like the history tab QuickNovel has) could be moved to library in some capacity so still only 5 items in the bottem navigation also? Just a thought though, might be a better way also. I think you could also reduce the icon size for each item to add a 6th item and make it look nice still though. More items could definitely be added to the TV navigation but I agree it might be a bit tricky as well on phone layout.

no, 5 icons are already much 6 icons will never happend

EHMilon commented 10 months ago

I wonder if downloads and any future proper watch history (IE inspired by something like the history tab QuickNovel has) could be moved to library in some capacity so still only 5 items in the bottem navigation also? Just a thought though, might be a better way also. I think you could also reduce the icon size for each item to add a 6th item and make it look nice still though. More items could definitely be added to the TV navigation but I agree it might be a bit tricky as well on phone layout.

no, 5 icons are already much 6 icons will never happend

First of all the Download Menu is not mandatory. To be Honest, I never use it. If you think that it should be kept, then library menu is the perfect place for it. @IndusAryan

IndusAryan commented 10 months ago

u don't use it doesn't mean its not mandatory,everyone uses it that too multiple times and shifting downloads to setting is larger headache as layout inside sub settings forgets the navigation graph due to bug and shifting download fragment there will cause various crashes only

EHMilon commented 10 months ago

u don't use it doesn't mean its not mandatory,everyone uses it that too multiple time and shifting downloads to setting is larger headache as layout inside sub settings forgets the navigation graph due to bug and shifting download fragment their will cause various crashes only

Then what is the solution. What you think? @IndusAryan

IndusAryan commented 10 months ago

no discover button on bottom bar and on homepage, there are already quicksearch and profile icon and on bottom, there are 2 floating buttons of random and selecting extension. so probably discover(tmdb) will be in the extension list if based on extension template

EHMilon commented 10 months ago

no discover button on bottom bar and on homepage, there are already quicksearch and profile icon and on bottom, there are 2 floating buttons of random and selecting extension. so probably discover(tmdb) will be in the extension list if based on extension template

Tell me where is the download menu on YouTube and any Browser. If you download something in CS3, you can easily find where you save it.

Rayforest commented 10 months ago

so probably discover(tmdb) will be in the extension list if based on extension template

Please, don't make this discover page to be an extension. Or be in the extension list. That would defeat the purpose. It should be something that comes inbuilt into the app, like a separate page (as the likes of homepage, library etc), and not as something that needs to be additionally installed like a repo or an extension

Useless-Panda commented 10 months ago

+1

vvkvivekl commented 7 months ago

This is an interesting enhancement.

We can have a Discover Fab Button in the Search section itself. Same as we have on Home Tab.

I have tried to create possible UI

Descover Propose