diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f35fbb..bc050a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: CI on: + push: + branches: + - main workflow_dispatch: jobs: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5f7011..3c17e64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,9 @@ name: Test on: + push: + branches: + - main workflow_dispatch: jobs: diff --git a/README.md b/README.md index bfb04c5..dda28a5 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,43 @@ -# release_schedule +# Release Schedule -A new Flutter project. +A small app using the Wikidata API to show upcoming movies. -## Getting Started +You can try out the live web version at [daniel-michel.github.io/release_schedule](https://daniel-michel.github.io/release_schedule). -This project is a starting point for a Flutter application. +Android and Linux builds can be found in the latest build run: [](https://github.com/daniel-michel/release_schedule/actions/workflows/build.yml) -A few resources to get you started if this is your first Flutter project: +Currently, only a simple list of upcoming movies is shown: +![](screenshots/movie_list.png) -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) +The floating button at the bottom right can be used to load the upcoming movies and the button at the top right to clear the movies that where already loaded. -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. + +## Wikidata API + +The Implementation can be found at [./lib/api/wikidata_movie_api.dart](./lib/api/wikidata_movie_api.dart). + +To get information about the upcoming movies multiple APIs are used. + +First the SPARQL API is used to retrieve upcoming movies using the endpoint "https://query.wikidata.org/sparql" with the following query: +```sql +SELECT + ?movie + ?movieLabel + (MIN(?releaseDate) as ?minReleaseDate) +WHERE { + ?movie wdt:P31 wd:Q11424; # Q11424 is the item for "film" + wdt:P577 ?releaseDate; # P577 is the "publication date" property + wdt:P1476 ?title. + FILTER (xsd:date(?releaseDate) >= xsd:date("$date"^^xsd:dateTime)) + + SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } +} +GROUP BY ?movie ?movieLabel +ORDER BY ?minReleaseDate +LIMIT $limit +``` +Where `$limit` is the maximum number of movies that are retrieved and `$date` the starting date from which movies are retrieved. +`$limit` is currently set to 100 and `$date` one week before the current one. +However, because there are multiple publication dates for most movies, the retrieved movies just need to have one publication date that is on or after `$date` for the movie to be included in the result. The `minReleaseDate` is not necessarily the release date displayed in the App, therefore some movies in the App might show up as having been released a long time ago. + +To get additional information about the movies and all release dates (in case some are before `$date` and some after) the API endpoint "https://www.wikidata.org/w/api.php?action=wbgetentities" is used. diff --git a/screenshots/movie_list.png b/screenshots/movie_list.png new file mode 100644 index 0000000..107dcd8 Binary files /dev/null and b/screenshots/movie_list.png differ