Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions grails-app/assets/javascripts/streama/controllers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use strict';

angular.module('streama').controller('MovieDetailCtrl', [
'$scope',
'$state',
'$rootScope',
'$stateParams',
'apiService',
function ($scope, $state, $rootScope, $stateParams, apiService) {

$scope.currentMovie = null;
$scope.relatedActors = [];
$scope.loading = false;

$scope.init = function () {
if ($stateParams.id) {
$scope.loading = true;
apiService.movie.getMovie($stateParams.id).then(function (response) {
$scope.currentMovie = response.data;
$scope.fetchRelatedActors($stateParams.id);
$scope.loading = false;
}, function (error) {
$scope.loading = false;
console.error('Error loading movie:', error);
});
}
};

$scope.fetchRelatedActors = function (movieId) {
apiService.movie.getRelatedActors(movieId).then(function (response) {
$scope.relatedActors = response.data || [];
}, function (error) {
console.error('Error fetching related actors:', error);
$scope.relatedActors = [];
});
};

$scope.playMovie = function (movie) {
$state.go('player', { videoId: movie.id });
};

$scope.markWatched = function (movie) {
apiService.video.markWatched(movie.id).then(function () {
movie.watched = true;
});
};

$scope.init();
}
]);
68 changes: 68 additions & 0 deletions grails-app/controllers/streama/MovieShowController.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package streama

import grails.converters.JSON
import grails.transaction.Transactional
import static org.springframework.http.HttpStatus.*

@Transactional(readOnly = true)
class MovieShowController {

def theMovieDbService
def taggingService
def videoService
static responseFormats = ['json', 'xml']

def show(MovieShow movieShowInstance) {
if(movieShowInstance == null){
render status: NOT_FOUND
return
}

def apiResponse = [
id: movieShowInstance.id,
title: movieShowInstance.title,
original_title: movieShowInstance.originalTitle,
overview: movieShowInstance.overview,
tagline: movieShowInstance.tagline,
release_date: movieShowInstance.releaseDate,
backdrop_path: movieShowInstance.backdropPath,
poster_path: movieShowInstance.posterPath,
vote_average: movieShowInstance.voteAverage,
genre: movieShowInstance.genre,
type: movieShowInstance.type,
currentVolume: movieShowInstance.currentVolume,
apiId: movieShowInstance.apiId,
imdb_id: movieShowInstance.imdbId,
status: movieShowInstance.status,
percentage_complete: movieShowInstance.percentageComplete,
firstAired: movieShowInstance.firstAired,
language: movieShowInstance.language,
addedBy: movieShowInstance.addedBy,
apiBackdrop16x9: movieShowInstance.apiBackdrop16x9,
apiPosterThumb: movieShowInstance.apiPosterThumb,
]

def actorMapping = movieShowInstance.actorMappings
def actors = actorMapping.collect { actorMappingInstance ->
def actor = actorMappingInstance.actor
def character = actorMappingInstance.character
def profilePath = actor.profilePath
def tmdbId = actor.tmdbId
return [
id: actor.id,
name: actor.name,
character: character,
profile_path: profilePath,
tmdb_id: tmdbId
]
}
apiResponse.actors = actors

if(params.get('flat') == 'true'){
params.remove('flat')
render apiResponse as JSON
return
}
respond apiResponse
}
}
18 changes: 18 additions & 0 deletions grails-app/domain/streama/Actor.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package streama

class Actor {

String name
String imdbId
String bio
Date dateCreated
Date lastUpdated

static hasMany = [movies: ActorMapping]

static constraints = {
name blank: false
imdbId nullable: true
bio nullable: true, maxSize: 2000
}
}
2 changes: 1 addition & 1 deletion grails-app/domain/streama/Movie.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Movie extends Video{
File backdrop_image


static hasMany = [tags: Tag, genre: Genre]
static hasMany = [tags: Tag, genre: Genre, actors: Actor]

static constraints = {
}
Expand Down