fix not deletable video if a actor is defined
fix wrongly displaying icon if no one exists --> new icon
This commit is contained in:
parent
283d3dc59b
commit
e4990bd24e
@ -227,7 +227,20 @@ func addToVideoHandlers() {
|
|||||||
MovieId int
|
MovieId int
|
||||||
}
|
}
|
||||||
AddHandler("deleteVideo", VideoNode, &dv, func() []byte {
|
AddHandler("deleteVideo", VideoNode, &dv, func() []byte {
|
||||||
query := fmt.Sprintf("DELETE FROM videos WHERE movie_id=%d", dv.MovieId)
|
// delete tag constraints
|
||||||
|
query := fmt.Sprintf("DELETE FROM video_tags WHERE video_id=%d", dv.MovieId)
|
||||||
|
err := database.Edit(query)
|
||||||
|
|
||||||
|
// delete actor constraints
|
||||||
|
query = fmt.Sprintf("DELETE FROM actors_videos WHERE video_id=%d", dv.MovieId)
|
||||||
|
err = database.Edit(query)
|
||||||
|
|
||||||
|
// respond only if result not successful
|
||||||
|
if err != nil {
|
||||||
|
return database.ManualSuccessResponse(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
query = fmt.Sprintf("DELETE FROM videos WHERE movie_id=%d", dv.MovieId)
|
||||||
return database.SuccessQuery(query)
|
return database.SuccessQuery(query)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,11 @@ func parseFFmpegPic(fileName string) (*string, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
backpic64 := "data:image/jpeg;base64," + base64.StdEncoding.EncodeToString(stdout)
|
strEncPic := base64.StdEncoding.EncodeToString(stdout)
|
||||||
|
if strEncPic == "" {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
backpic64 := fmt.Sprintf("data:image/jpeg;base64,%s", strEncPic)
|
||||||
|
|
||||||
return &backpic64, nil
|
return &backpic64, nil
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import {Spinner} from 'react-bootstrap';
|
|||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
import GlobalInfos from '../../utils/GlobalInfos';
|
import GlobalInfos from '../../utils/GlobalInfos';
|
||||||
import {APINode, callAPIPlain} from '../../utils/Api';
|
import {APINode, callAPIPlain} from '../../utils/Api';
|
||||||
|
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||||
|
import {faPhotoVideo} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
interface PreviewProps {
|
interface PreviewProps {
|
||||||
name: string;
|
name: string;
|
||||||
@ -42,12 +44,21 @@ class Preview extends React.Component<PreviewProps, PreviewState> {
|
|||||||
<div className={style.videopreview + ' ' + themeStyle.secbackground + ' ' + themeStyle.preview}>
|
<div className={style.videopreview + ' ' + themeStyle.secbackground + ' ' + themeStyle.preview}>
|
||||||
<div className={style.previewtitle + ' ' + themeStyle.lighttextcolor}>{this.props.name}</div>
|
<div className={style.previewtitle + ' ' + themeStyle.lighttextcolor}>{this.props.name}</div>
|
||||||
<div className={style.previewpic}>
|
<div className={style.previewpic}>
|
||||||
{this.state.previewpicture !== null ? (
|
{this.state.previewpicture === '' ? (
|
||||||
<img className={style.previewimage} src={this.state.previewpicture} alt='Pic loading.' />
|
<FontAwesomeIcon
|
||||||
) : (
|
style={{
|
||||||
|
color: 'white',
|
||||||
|
marginTop: '55px'
|
||||||
|
}}
|
||||||
|
icon={faPhotoVideo}
|
||||||
|
size='5x'
|
||||||
|
/>
|
||||||
|
) : this.state.previewpicture === null ? (
|
||||||
<span className={style.loadAnimation}>
|
<span className={style.loadAnimation}>
|
||||||
<Spinner animation='border' />
|
<Spinner animation='border' />
|
||||||
</span>
|
</span>
|
||||||
|
) : (
|
||||||
|
<img className={style.previewimage} src={this.state.previewpicture} alt='Pic loading.' />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={style.previewbottom} />
|
<div className={style.previewbottom} />
|
||||||
|
Loading…
Reference in New Issue
Block a user