this post was submitted on 02 Nov 2024
15 points (94.1% liked)

Software recommendations

1163 readers
1 users here now

Do you want to know the best program to do something? Ask it here and discover the best options to choose between. Do not be shy

Anyone can ask for products by making a post. There are no posts because I think people think that they can not post but they can now

Want to get recommendations to non-software topics? Go to Recommendations

rules: instance rules

founded 1 year ago
MODERATORS
 

Not looking for the “best one” in terms of quality of software but more the most used and popular one, ie. an alternative that’s fleshed out.

TMDB is owned by a for profit company so I’d prefer something else.

you are viewing a single comment's thread
view the rest of the comments
[–] horse_battery_staple 4 points 1 month ago* (last edited 1 month ago) (1 children)

To use this application, you will need to replace YOUR_API_KEY with your actual OMDB API key.

Go to www.omdbapi.com  and sign up for an account.
Create a new user and get an API key.
Replace YOUR_API_KEY with the value returned in the email you received after signing up for an account.
Run the application using Python (e.g., python app.py).
Open your favorite web browser and navigate to http://localhost:5000 .

Here's how you can use this API:

Send a GET request to http://localhost:5000/search?q=Movie+Title+You+Want+To+Search+For  to search for movies on the OMDB API.
from flask import Flask, request, jsonify
import requests

app = Flask(__name__)

# Define the OMDB API URL
OMDB_API_URL = 'http://www.omdbapi.com'

# Set up a dictionary to store the movie data from the API
movie_data = {}

@app.route('/search', methods=['GET'])
def search_movies():
    # Get the query parameter from the request
    query = request.args.get('q')

    if not query:
        return jsonify({'error': 'Missing query parameter'}), 400

    # Build the OMDB API URL with the query parameter
    url = f'{OMDB_API_URL}?s={query}&apikey=YOUR_API_KEY'

    try:
        # Send a GET request to the OMDB API
        response = requests.get(url)

        if response.status_code == 200:
            # Parse the JSON response from the OMDB API
            data = response.json()

            # Extract the movie title and URL from the API response
            for i in range(1, int(data['totalResults']) + 1):
                movie_title = data['Search'][i - 1]['Title']
                movie_url = data['Search'][i - 1]['Year'] + ' ' + data['Search'][i - 1]['Type']

                # Store the movie title and URL in the dictionary
                movie_data[movie_title] = {'url': movie_url}

            return jsonify(movie_data)
        else:
            return jsonify({'error': f'Failed to retrieve movie data. Status code: {response.status_code}'}), response.status_code
    except requests.RequestException as e:
        return jsonify({'error': f'Request error: {e}'}), 500

@app.route('/movie/<string:title>', methods=['GET'])
def get_movie_info(title):
    # Get the title from the request path
    title = title.lower()

    if not title:
        return jsonify({'error': 'Missing movie title parameter'}), 400

    # Check if we have data for this movie in our dictionary
    if title in movie_data:
        movie_url = movie_data[title]['url']

        try:
            # Send a GET request to the OMDB API with the URL of the movie
            response = requests.get(movie_url)

            if response.status_code == 200:
                # Parse the JSON response from the OMDB API
                data = response.json()

                # Extract the movie title, genre, release date, and runtime from the API response
                try:
                    movie_title = data['Title']
                    movie_genre = data['Genre'].replace(",", ", ")
                    movie_release_date = data['ReleaseDate']
                    movie_runtime = data['Runtime']

                    return jsonify({
                        'title': movie_title,
                        'genre': movie_genre,
                        'release_date': movie_release_date,
                        'runtime': movie_runtime
                    })
                except KeyError:
                    return jsonify({'error': f'Missing movie information for {movie_title}'}), 404
            else:
                return jsonify({'error': f'Failed to retrieve movie data. Status code: {response.status_code}'}), response.status_code
        except requests.RequestException as e:
            return jsonify({'error': f'Request error: {e}'}), 500
    else:
        return jsonify({'error': f'Movie not found: {title}'}), 404

if __name__ == '__main__':
    app.run(debug=True)

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago) (1 children)

sorry but I’m heavily disabled and only able to use my phone. I can’t use a computer.

[–] horse_battery_staple 2 points 1 month ago (1 children)

No worries, that stub of a flask app is enough for someone to pick up and run with.

If you do find interest in doing development from your phone there are avenues in which to do it.

https://www.circuitbasics.com/programming-with-your-android-smartphone-the-tools-you-need/

https://www.maketecheasier.com/coding-apps-for-ios/

Lastly you can run your code here. Compile your app and then download it from the cloud server

https://www.digitalocean.com/community

I have a friend who is legally blind and can only work with small screens that he can hold very close to his face, and he solely develops on a smartphone.

[–] [email protected] 2 points 1 month ago (1 children)

I used to be a data scientist but with my current limitations I’m unable to program at all. The brain damage is too severe I just don’t have the ability to do that anymore.

[–] horse_battery_staple 1 points 1 month ago

Ok, I'm leaving those resources up for anyone else who may find them useful.