Skip to content

Commit

Permalink
fix broken images in several places
Browse files Browse the repository at this point in the history
  • Loading branch information
dularion committed Feb 28, 2021
1 parent 9c97665 commit 83a9cf4
Show file tree
Hide file tree
Showing 26 changed files with 65 additions and 34 deletions.
Expand Up @@ -3,7 +3,7 @@
<div class="row">
<div class="col-md-6">
<h1>
File Manager
File Manager <span class="text-muted text-xs">({{filesCount}} items)</span>
</h1>
</div>
</div>
Expand Down Expand Up @@ -68,7 +68,7 @@ <h1>
<td>{{file.contentType}}</td>
<td>{{file.fileExists}}</td>
<td>
<div ng-repeat="video in file.videos"><img width="40px" ng-src="https://image.tmdb.org/t/p/w92/{{video.poster_path}}"/></div>
<div ng-repeat="video in file.videos"><img width="40px" ng-src="{{video.poster_path}}"/></div>
<div class="fade-50" ng-if="!file.videos.length">
None
</div>
Expand Down
@@ -1,7 +1,7 @@

<div class="row">
<div class="col-xs-8">
<h1>Genre</h1>
<h1>Genre <span class="text-muted text-xs">({{vm.genres.length}} items)</span></h1>
<p>Here you can manage the genres for Videos / TvShows.</p>
<p>Usually, Genre are automatically added alongside TMDb-videos & shows. But if TMDb isn't enabled or you want to add your own custom Genres, you can do so here.</p>
</div>
Expand Down
Expand Up @@ -113,7 +113,7 @@ <h1>

<div class="col-sm-4 col-lg-3" >
<img ng-if="!movie.poster_path && !movie.poster_image_src" ng-src="{{basePath}}assets/poster-not-found.png"/>
<img ng-if="movie.poster_path" ng-src="https://image.tmdb.org/t/p/w500/{{movie.poster_path}}"/>
<img ng-if="movie.poster_path" ng-src="{{movie.poster_path}}"/>
<img ng-if="movie.poster_image_src" ng-src="{{movie.poster_image_src}}"/>
</div>
</div>
Expand Down Expand Up @@ -146,7 +146,7 @@ <h5>Suggested by TheMovieDb.org</h5>
</div>
</div>
<div class="media-item" >
<img ng-src="https://image.tmdb.org/t/p/w300/{{movie.poster_path}}"/>
<img ng-src="{{movie.poster_path}}"/>
</div>
<div class="media-meta">Release: {{movie.release_date.substring(0, 4)}} | <i class="ion-ios-star"></i> {{movie.vote_average}}</div>
</div>
Expand Down
@@ -1,7 +1,8 @@
<div class="row">
<div class="col-md-6">
<h1>
Movies <video-sort-order-dropdown ng-model="vm.movie.sorter" ng-model-options="{getterSetter: true}" dropdown-type="'movie'"/>
Movies <span class="text-muted text-xs">({{vm.movie.total}} items)</span>
<video-sort-order-dropdown ng-model="vm.movie.sorter" ng-model-options="{getterSetter: true}" dropdown-type="'movie'"/>
</h1>

<input placeholder="{{vm.searchText}}" type="text" ng-model="vm.movie.filter.title" ng-change="vm.doSearch(vm.movie.filter.title)"
Expand Down Expand Up @@ -64,7 +65,7 @@ <h3>Want to add a new Movie?</h3>
</div>
</div>
<div class="media-item" >
<img ng-src="https://image.tmdb.org/t/p/w300/{{movie.poster_path}}"/>
<img ng-src="{{movie.poster_path}}"/>
</div>
<div class="media-meta">Release: {{::movie.release_date.substring(0, 4)}} | <i class="ion-ios-star"></i> {{::movie.vote_average}}</div>
</div>
Expand Down
Expand Up @@ -24,7 +24,7 @@ <h1>Dashboard Highlights</h1>
<tr ng-repeat="notification in notifications | orderBy: '-dateCreated'">
<td>{{notification.dateCreated | date:'short'}}</td>
<td>
<img ng-if="notification.media.poster_path" ng-src="https://image.tmdb.org/t/p/w92/{{notification.media.poster_path}}" style="max-width: 50px; margin-right: 10px;"/>
<img ng-if="notification.media.poster_path" ng-src="{{notification.media.poster_path}}" style="max-width: 50px; margin-right: 10px;"/>
{{notification.media.title || notification.media.name}} <span ng-if="notification.media.release_date">({{notification.media.release_date.substring(0,4)}})</span>
</td>
<td>
Expand Down
Expand Up @@ -30,11 +30,11 @@ <h1>Notification Queue</h1>
<tr ng-repeat="notification in notifications | orderBy: '-dateCreated'" ng-class="{'fade-50': notification.isCompleted}">
<td>{{notification.dateCreated | date:'short'}}</td>
<td ng-if="notification.movie">
<img ng-if="notification.movie.poster_path" ng-src="https://image.tmdb.org/t/p/w92/{{notification.movie.poster_path}}" style="max-width: 50px; margin-right: 10px;"/>
<img ng-if="notification.movie.poster_path" ng-src="{{notification.movie.poster_path}}" style="max-width: 50px; margin-right: 10px;"/>
{{notification.movie.title}} ({{notification.movie.release_date.substring(0,4)}})
</td>
<td ng-if="notification.tvShow">
<img ng-if="notification.tvShow.poster_path" ng-src="https://image.tmdb.org/t/p/w92/{{notification.tvShow.poster_path}}" style="max-width: 50px; margin-right: 10px;"/>
<img ng-if="notification.tvShow.poster_path" ng-src="{{notification.tvShow.poster_path}}" style="max-width: 50px; margin-right: 10px;"/>
{{notification.tvShow.name}} ({{notification.tvShow.first_air_date.substring(0,4)}})
</td>
<td>{{notification.description}}</td>
Expand Down
Expand Up @@ -84,7 +84,7 @@ <h1>

<div class="col-sm-4">
<div ng-if="!show.manualInput">
<img ng-show="show.poster_path" ng-src="https://image.tmdb.org/t/p/w500/{{show.poster_path}}"/>
<img ng-show="show.poster_path" ng-src="{{show.poster_path}}"/>
<img ng-show="!show.poster_path" ng-src="{{basePath}}assets/poster-not-found.png"/>
</div>

Expand Down
@@ -1,7 +1,7 @@
<div class="row">
<div class="col-md-6">
<h1>
Shows
Shows <span class="text-muted text-xs">({{tvShow.total}} items)</span>
<video-sort-order-dropdown ng-model="tvShow.sorter" ng-model-options="{getterSetter: true}" dropdown-type="'tvShow'"/>
</h1>
</div>
Expand Down Expand Up @@ -36,7 +36,7 @@ <h1>
ng-repeat="show in tvShow.list"
ui-sref="admin.show({showId: show.id})">
<div class="media-item" >
<img ng-if="show.poster_path" ng-src="https://image.tmdb.org/t/p/w300/{{show.poster_path}}"/>
<img ng-if="show.poster_path" ng-src="{{show.poster_path}}"/>
<img ng-if="!show.poster_path && !show.manualInput" ng-src="{{basePath}}assets/poster-not-found.png"/>

<img ng-show="show.manualInput && show.poster_image_src" ng-src="{{show.poster_image_src}}">
Expand Down Expand Up @@ -69,7 +69,7 @@ <h3>Want to add a new Show?</h3>
</div>
</div>
<div class="media-item" >
<img ng-src="https://image.tmdb.org/t/p/w300/{{show.poster_path}}"/>
<img ng-src="{{show.poster_path}}"/>
</div>
<div class="media-meta">Release: {{::show.release_date.substring(0, 4)}} | <i class="ion-ios-star"></i> {{::show.vote_average}}</div>
</div>
Expand Down
@@ -1,7 +1,7 @@
<button class="btn btn-primary pull-right btn-lg" ng-click="openGenericVideoModal()">Create generic video</button>

<h1>
Other Videos
Other Videos <span class="text-muted text-xs">({{videos.length}} items)</span>
<video-sort-order-dropdown ng-model="currentSort" dropdown-type="'movie'"/>
</h1>

Expand Down
Expand Up @@ -96,7 +96,7 @@ <h4>{{'VIDEO.GENRE' | translate}}</h4>
</ul>
</div>

<img ng-if="media.still_path" ng-src="https://image.tmdb.org/t/p/w300/{{media.still_path}}"/>
<img ng-if="media.still_path" ng-src="{{media.still_path}}"/>

<div ng-if="media.trailerKey">
<h4>{{'VIDEO.TRAILER' | translate}}</h4>
Expand All @@ -105,7 +105,7 @@ <h4>{{'VIDEO.TRAILER' | translate}}</h4>
</div>
</div>
<div class="col-sm-4">
<img ng-if="media.poster_path && !media.poster_image_src" ng-src="https://image.tmdb.org/t/p/w300/{{media.poster_path}}"/>
<img ng-if="media.poster_path && !media.poster_image_src" ng-src="{{media.poster_path}}"/>
<img ng-if="media.poster_image_src" ng-src="{{media.poster_image_src}}"/>
</div>
</div>
Expand Down
Expand Up @@ -34,7 +34,7 @@ <h2>{{selectedItem.name}}</h2>

<div ng-switch-when="movie">
<div class="col-md-4" ng-if="selectedItem.poster_path">
<img ng-src="https://image.tmdb.org/t/p/w300/{{selectedItem.poster_path}}"/>
<img ng-src="{{selectedItem.poster_path}}"/>
</div>
<div class="col-md-8">
<h2>{{selectedItem.title}}</h2>
Expand Down
Expand Up @@ -78,7 +78,7 @@ <h4>Sort</h4>
<td>{{(activity.lastUpdated || activity.dateCreated) | date:'short'}}</td>
<td style="width: 185px;">
<img ng-if="activity.video.poster_path || activity.video.show.poster_path"
ng-src="https://image.tmdb.org/t/p/w92/{{activity.video.show.poster_path || activity.video.poster_path}}"
ng-src="{{activity.video.show.poster_path || activity.video.poster_path}}"
style="max-width: 50px; margin-right: 10px; float: left;"/>
<div>{{activity.video.title || activity.video.name}}</div>
<div class="text-muted" ng-if="activity.video.canonicalName === 'streama.Episode'">s{{activity.video.season_number| padnumber:2}}e{{activity.video.episode_number | padnumber:2}}</div>
Expand Down
3 changes: 3 additions & 0 deletions grails-app/assets/stylesheets/_util.scss
Expand Up @@ -269,6 +269,9 @@ a{
.text-sm{
font-size: 0.75em;
}
.text-xs{
font-size: 0.50em;
}



Expand Down
Expand Up @@ -14,7 +14,7 @@ class GenericVideoController {
def index(Integer max) {
params.max = Math.min(max ?: 10, 100)
JSON.use('admin') {
respond GenericVideo.where{deleted != true}.list(), [status: OK]
respond GenericVideo.where{deleted != true}.list(max: 9999), [status: OK]
}
}

Expand Down
13 changes: 11 additions & 2 deletions grails-app/domain/streama/TvShow.groovy
Expand Up @@ -90,8 +90,17 @@ class TvShow implements SimpleInstance {
return listEpisodesWithFiles().min { it.seasonEpisodeMerged }
}

def getPosterPath(){
String TMDB_BASE_PATH = 'https://image.tmdb.org/t/p/w300/'
def getPosterPath(Integer width = 300){
if(this.poster_image){
return this.poster_image.src
}
if(!this.poster_path){
return
}
String TMDB_BASE_PATH = "https://image.tmdb.org/t/p/w${width}/"
if(this.poster_path?.startsWith('http')){
return this.poster_path
}
return TMDB_BASE_PATH + this.poster_path
}

Expand Down
12 changes: 10 additions & 2 deletions grails-app/domain/streama/Video.groovy
Expand Up @@ -164,13 +164,21 @@ class Video implements SimpleInstance{

def getPosterPath(Integer width = 300){
String TMDB_BASE_PATH = "https://image.tmdb.org/t/p/w${width}/"

if(this instanceof Episode){
if(this.show.poster_path?.startsWith('http')){
return this.show.poster_path
}
return TMDB_BASE_PATH + this.show.poster_path
}else if(this instanceof GenericVideo){
return this.poster_image?.getSrc()
}else{
return TMDB_BASE_PATH + this.poster_path
}

if(this.poster_path?.startsWith('http')){
return this.poster_path
}

return TMDB_BASE_PATH + this.poster_path
}


Expand Down
Expand Up @@ -24,7 +24,7 @@ class MediaDetailMarshallerService {
result['overview'] = tvShow.overview
result['apiId'] = tvShow.apiId
result['backdrop_path'] = tvShow.backdrop_path
result['poster_path'] = tvShow.poster_path
result['poster_path'] = tvShow.getPosterPath()
result['first_air_date'] = tvShow.first_air_date
result['original_language'] = tvShow.original_language
result['vote_average'] = tvShow.vote_average
Expand All @@ -47,7 +47,7 @@ class MediaDetailMarshallerService {
result['mediaType'] = 'movie'
result['dateCreated'] = movie.dateCreated
result['lastUpdated'] = movie.lastUpdated
result['poster_path'] = movie.poster_path
result['poster_path'] = movie.getPosterPath()
result['release_date'] = movie.release_date
result['title'] = movie.title
result['overview'] = movie.overview
Expand Down
Expand Up @@ -70,7 +70,7 @@ class PlayerMarshallerService {
returnArray['title'] = video.title
returnArray['release_date'] = video.release_date
returnArray['backdrop_path'] = video.buildImagePath('backdrop_path', "w1280")
returnArray['poster_path'] = video.poster_path
returnArray['poster_path'] = video.getPosterPath()
returnArray['trailerKey'] = video.trailerKey
returnArray['nextVideo'] = video.suggestNextVideo()?.getSimpleInstance()

Expand Down
2 changes: 2 additions & 0 deletions grails-app/views/episode/show.gson
Expand Up @@ -10,4 +10,6 @@ json g.render(episode, [deep:true, excludes: ['files']]){
hasFiles episode.getVideoFiles() ? true : false
nextEpisode {id {((Episode)episode.getNextEpisode())?.id}}
viewedStatus episode.getViewingStatus()

poster_path episode.getPosterPath()
}
4 changes: 2 additions & 2 deletions grails-app/views/mail/notification.gsp
Expand Up @@ -212,7 +212,7 @@
<g:each in="${notificationQueues.findAll{it.movie}}" var="notification">
<tr>
<td width="100px">
<img src="https://image.tmdb.org/t/p/w92/${notification.movie.poster_path}"/>
<img src="${notification.movie.getPosterPath(92)}"/>
</td>
<td>
<p><strong>${notification.movie.title} (${notification.movie.release_date?.substring(0,4)})</strong></p>
Expand All @@ -231,7 +231,7 @@
<g:each in="${notificationQueues.findAll{it.tvShow}}" var="notification">
<tr>
<td width="100px">
<img src="https://image.tmdb.org/t/p/w92/${notification.tvShow.poster_path}"/>
<img src="${notification.tvShow.getPosterPath(92)}"/>
</td>
<td>
<p><strong>${notification.tvShow.name} (${notification.tvShow.first_air_date?.substring(0,4)})</strong></p>
Expand Down
1 change: 1 addition & 0 deletions grails-app/views/movie/_movie.gson
Expand Up @@ -10,6 +10,7 @@ json g.render(movie, [deep:true, excludes: ['poster_image']]){
files movie.files?.collect{it.simpleInstance}
videoFiles movie.getVideoFiles()*.getSimpleInstance()
subtitles movie.getSubtitles()*.getSimpleInstance()
poster_path movie.getPosterPath()
poster_image_src movie.poster_image?.src
inWatchlist movie.inWatchlist()
status movie.getStatus()
Expand Down
4 changes: 2 additions & 2 deletions grails-app/views/notificationQueue/_notificationQueue.gson
Expand Up @@ -7,15 +7,15 @@ model {
json g.render(notificationQueue){
if(notificationQueue.movie){
movie {
poster_path notificationQueue.movie?.poster_image
poster_path notificationQueue.movie?.getPosterPath()
title notificationQueue.movie?.title
release_date notificationQueue.movie?.release_date
}
}

if(notificationQueue.tvShow){
tvShow {
poster_path notificationQueue.tvShow?.poster_path
poster_path notificationQueue.tvShow?.getPosterPath()
name notificationQueue.tvShow?.name
first_air_date notificationQueue.tvShow?.first_air_date
}
Expand Down
1 change: 1 addition & 0 deletions grails-app/views/tvShow/_tvShow.gson
Expand Up @@ -10,4 +10,5 @@ json g.render(tvShow, [deep: true]){
episodesWithFilesCount tvShow.getFilteredEpisodes().findAll{it.files}.size()
episodesCount tvShow.getFilteredEpisodes().size()
inWatchlist tvShow.inWatchlist()
poster_path tvShow.getPosterPath()
}
4 changes: 2 additions & 2 deletions grails-app/views/userActivity/_userActivity.gson
Expand Up @@ -8,9 +8,9 @@ model {
json g.render(userActivity, [excludes: ['user']]){
userId userActivity.userId
username userActivity.user.username
def videoData = userActivity.video?.getSimpleInstance(['poster_path', 'release_date', 'episode_number', 'season_number'])
def videoData = userActivity.video?.getSimpleInstance(['poster_path:getPosterPath()', 'release_date', 'episode_number', 'season_number'])
if(userActivity.video instanceof Episode && userActivity.video.show){
videoData.show = userActivity.video.show?.getSimpleInstance(['name', 'id', 'poster_path', 'first_air_date'])
videoData.show = userActivity.video.show?.getSimpleInstance(['name', 'id', 'poster_path:getPosterPath()', 'first_air_date'])
}

video videoData
Expand Down
2 changes: 2 additions & 0 deletions grails-app/views/video/show.gson
Expand Up @@ -12,6 +12,8 @@ json g.render(video, [deep:true, excludes: ['files']]){
viewedStatus video.getViewingStatus()
inWatchlist video.inWatchlist()

poster_path video.getPosterPath()

// if(video instanceof Episode){
//// nextEpisode {
//// id video.nextEpisode?.id
Expand Down
6 changes: 5 additions & 1 deletion grails-app/views/watchlistEntry/_watchlistEntry.gson
Expand Up @@ -21,7 +21,7 @@ json g.render(watchlistEntry, [deep:true, includes: ['id', 'dateCreated', 'lastU

mediaType 'movie'
release_date movie.release_date
poster_path movie.poster_path
poster_path movie.getPosterPath()
backdrop_path movie.backdrop_path
poster_image_src movie.poster_image?.src
inWatchlist movie.inWatchlist()
Expand All @@ -31,13 +31,15 @@ json g.render(watchlistEntry, [deep:true, includes: ['id', 'dateCreated', 'lastU

mediaType 'genericVideo'
release_date genericVideo.release_date
poster_path genericVideo.getPosterPath()
poster_image_src genericVideo.poster_image?.src
inWatchlist genericVideo.inWatchlist()
}
if (watchlistEntry.video instanceof Episode) {
Episode episode = watchlistEntry.video as Episode

mediaType 'episode'
poster_path episode.getPosterPath()
poster_image_src episode.getPosterPath()
inWatchlist episode.inWatchlist()
}
Expand All @@ -48,6 +50,8 @@ json g.render(watchlistEntry, [deep:true, includes: ['id', 'dateCreated', 'lastU
TvShow tvShow = watchlistEntry.tvShow as TvShow
id tvShow.id
name tvShow.name

poster_path tvShow.getPosterPath()
poster_image_src tvShow.poster_image?.src
episodesWithFilesCount tvShow.getFilteredEpisodes().findAll{it.files}.size()
episodesCount tvShow.getFilteredEpisodes().size()
Expand Down

0 comments on commit 83a9cf4

Please sign in to comment.