Skip to content
Merged
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
39 changes: 33 additions & 6 deletions vue/xscratch-app/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export default {
],
dialogue: seg.text,
url: seg.url,
name: 'no name'
name: 'remote:' + seg.text,
id: 'remote:' + seg.text
}
remoteVideoList.push(formattedSeg)
})
Expand Down Expand Up @@ -72,6 +73,7 @@ export default {
const remoteArray = await this.getRemoteVideos()
var videoArray = JSON.parse(response.data.body).videos
remoteArray.forEach(el => {
el.isRemote = true
videoArray.push(el)
})
return videoArray
Expand Down Expand Up @@ -144,12 +146,22 @@ export default {
const response = await this.execute('post', '/tlp/delete', id)
return JSON.parse(response.data.body)
},
async appendVideo (playlistID, videoID) {
const body = {
'id': videoID
async appendVideo (playlistID, video) {
if (!video.isRemote) {
const body = {
'id': video.id
}
const response = await this.execute('post', '/playlists/' + playlistID + '/video', body)
return JSON.parse(response.data.body)
} else {
const body = {
'url': video.url,
'character': video.characters[0],
'text': video.dialogue
}
const response = await this.execute('post', '/playlists/' + playlistID + '/video/remote', body)
return JSON.parse(response.data.body)
}
const response = await this.execute('post', '/playlists/' + playlistID + '/video', body)
return JSON.parse(response.data.body)
},

async removeVideo (playlistID, videoID) {
Expand All @@ -158,6 +170,21 @@ export default {
}
const response = await this.execute('post', '/playlists/' + playlistID + '/video/delete', body)
return JSON.parse(response.data.body)
},

async getCharacters () {
// Empty body
// const body = {
// }

// const response = await this.execute('get', '/characters', body)

const mockResponse = {
'characters': ['Spock', 'Kirk', 'Conner', 'Emmett', 'Nour', 'Vlad', 'Other Character']
}

// TODO change with actual response
return mockResponse.characters
}

}
3 changes: 1 addition & 2 deletions vue/xscratch-app/src/components/AppendVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export default {
loading: false,
fields: [
{ key: 'actions', label: 'Add' },
{ key: 'name', label: 'Video Title', sortable: true, class: 'text-center' },
{ key: 'dialogue', label: 'Dialogue', sortable: true, sortDirection: 'desc' },
{
key: 'characters',
Expand Down Expand Up @@ -135,7 +134,7 @@ export default {
if (el.id === item.id) el.state = 'loading'
})
this.$refs.videotable.refresh()
await api.appendVideo(this.playlist.id, item.id)
await api.appendVideo(this.playlist.id, item)
this.videos.forEach(el => {
if (el.id === item.id) el.state = 'added'
})
Expand Down