KawAnime/pages/releases.vue

281 lines
8.1 KiB
Vue
Raw Normal View History

2017-09-20 14:44:58 +00:00
<template lang="pug">
2017-08-31 12:36:09 +00:00
v-container#container.container.pa-0(fluid, grid-list-xs)
transition(name='fade', v-if='releases.length')
v-layout(row, wrap, justify-center, style='margin: 0 1% 0 1%;')
v-flex.time-container(md4, sm4, xs8)
span.update-time Updated {{ lastUpdateTime }}.
v-flex(md4, sm1, hidden-xs-only)
v-flex(md2, sm3, xs10)
v-select.select(
:items='fansubList',
2017-09-19 07:23:46 +00:00
v-model='$store.state.releases.params.fansub',
label='Fansub',
dark, single-line,
hint='Pick a fansub',
persistent-hint
)
v-flex(md1, sm2, xs10)
v-select.select(
:items='qualityList',
2017-09-19 07:23:46 +00:00
v-model='$store.state.releases.params.quality',
label='Quality',
dark,
single-line,
hint='Which quality ?',
persistent-hint
)
v-flex.refresh-button-container(md1, sm1, xs12)
v-btn.refresh-button(icon, @click='refresh()')
v-icon(large) refresh
template(v-for='item in releases')
v-flex.elem(xs12, sm6, md4, xl3, :key='item.name')
v-card.elem-content.elevation-3(v-ripple='true')
v-card-text.elem-card
2017-08-31 12:36:09 +00:00
v-container.pa-0(fluid)
2017-10-07 20:27:10 +00:00
v-layout.elem-card-layout(row, wrap)
2017-09-20 14:44:58 +00:00
v-flex.elem-title.pa-0(xs9)
v-tooltip(top)
h6.white--text(slot='activator') {{ item.rawName }}
span {{ item.rawName }}
v-flex.elem-ep.text-xs-right.pa-0(xs3)
v-tooltip(top)
h6.white--text(slot='activator') {{ epLabel(item.ep) }}
span {{ epLabel(item.ep, true) }}
v-flex.elem-image.pa-0(xl4, lg4, md5, xs4)
img.picture(
:src='item.picture',
onerror="this.src='static/images/error.jpg'",
height='200'
)
v-flex.pa-0(xl8, lg8, md7, xs8)
.elem-text-links
.synopsis.pl-1 {{ item.synopsis || 'No synopsis yet.' }}
div.text-xs-right(v-if='isFollowed(item.rawName)')
span.following-status.not-selectable {{ isFollowed(item.rawName) }}
.links
a.download-button(:href='item.magnetLink')
v-btn.btn--light-flat-pressed(dark, flat, @click='print(item)') Download
v-menu(open-on-hover, transition='slide-x-transition')
v-btn(flat, dark, slot='activator') More
v-list.dark
v-list-tile(@click='openModal(item.rawName, item.fullSynopsis)')
v-list-tile-action
v-icon more
v-list-tile-title Check synopsis
v-list-tile(@click='downloadAll(item.rawName)')
v-list-tile-action
v-icon file_download
v-list-tile-title Download all episodes
v-list-tile(@click='searchThis(item.rawName)')
v-list-tile-action
v-icon info_outline
v-list-tile-title Information
v-list-tile(@click='showChoices(item.rawName)')
v-list-tile-action
v-icon add_box
v-list-tile-title Add to
loader(v-else)
v-dialog(v-model='modal', max-width='70%', @keydown.esc='modal = false')
v-card
v-card-title.headline {{ modalTitle }}
v-divider
v-card-text.subheading {{ modalText }}
v-card-actions
v-spacer
v-btn.blue--text.darken-1(flat, @click='modal = false') Thanks!
choice-window(:entry='choiceTitle')
2017-04-15 14:16:14 +00:00
</template>
<script>
export default {
mounted () {
if (this.releases.length) {
2017-08-14 20:49:23 +00:00
this.updateTime()
}
setInterval(() => {
if (this.releases.length) {
2017-08-14 20:49:23 +00:00
this.updateTime()
}
2017-08-23 14:57:40 +00:00
}, 15 * 1000)
},
2017-04-15 14:16:14 +00:00
data () {
return {
choiceTitle: '',
2017-04-15 14:16:14 +00:00
modal: false,
modalTitle: '',
modalText: '',
qualityList: ['480p', '720p', '1080p'],
lastUpdateTime: 'a few seconds ago'
2017-04-15 14:16:14 +00:00
}
},
computed: {
releases () {
2017-09-19 07:23:46 +00:00
return this.$store.state.releases.releases
},
fansubList () {
2017-09-19 07:23:46 +00:00
return this.$store.state.releases.fansubs
}
},
2017-04-15 14:16:14 +00:00
methods: {
epLabel (ep, isTooltip = false) {
// HorribleSubs specific atm
return /\[[0-9]{3,4}p\]/.test(ep)
? 'Batch'
: `${isTooltip ? 'Episode' : 'Ep'} ${ep}`
},
2017-05-13 14:38:17 +00:00
openModal (title, text) {
2017-04-15 14:16:14 +00:00
this.modalTitle = title
this.modalText = text
2017-04-15 14:16:14 +00:00
this.modal = true
},
2017-05-13 14:38:17 +00:00
downloadAll (name) {
console.log(`[${(new Date()).toLocaleTimeString()}]: Sending a request to download all episodes of ${name}.`)
2017-04-15 14:16:14 +00:00
2017-09-19 07:23:46 +00:00
const {quality, fansub} = this.$store.state.releases.params
this.$store.dispatch('downloader/download', {
name,
quality,
fansub,
fromEp: 0,
untilEp: 20000,
choice: 'si'
2017-04-15 14:16:14 +00:00
})
},
async refresh () {
2017-09-19 07:23:46 +00:00
await this.$store.dispatch('releases/refresh')
this.updateTime()
2017-04-30 12:40:01 +00:00
},
2017-05-13 14:38:17 +00:00
print (item) {
2017-05-03 18:22:07 +00:00
console.log(`[${(new Date()).toLocaleTimeString()}]: Downloading ${item.name}.`)
},
showChoices (name) {
this.choiceTitle = name
this.$store.commit('setAddToChoice', true)
},
2017-08-14 20:49:23 +00:00
updateTime () {
2017-09-19 07:23:46 +00:00
const updated = this.$store.state.releases.updateTime
if (updated) {
this.lastUpdateTime = updated.fromNow()
}
},
searchThis (name) {
this.$store.dispatch('search/fromName', name)
},
isFollowed (name) {
return this.$store.state.watchLists.lists.watching.includes(name)
? 'Watching'
: this.$store.state.watchLists.lists.watchList.includes(name)
? 'Watch List'
: ''
}
2017-04-15 14:16:14 +00:00
}
}
</script>
2017-10-16 00:33:08 +00:00
<style lang="stylus" scoped>
@import '~stylus/functions'
2017-05-13 14:38:17 +00:00
p
2017-10-16 00:33:08 +00:00
margin-bottom 0
2017-04-18 15:34:36 +00:00
div.input-group
2017-10-16 00:33:08 +00:00
padding-bottom 5px !important
padding-top 8px !important
2017-04-22 13:32:44 +00:00
2017-05-13 14:38:17 +00:00
/* ----- Refresh button ----- */
.refresh-button-container
2017-10-16 00:33:08 +00:00
display inline-block
text-align center
padding 0
align-self center
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.time-container
2017-10-16 00:33:08 +00:00
height 70px
display flex
align-items center
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.update-time
2017-10-16 00:33:08 +00:00
padding-left 20px
font-weight 600
font-size 16px
font-style italic
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.elem
2017-10-16 00:33:08 +00:00
margin-bottom 10px
display inline-block
padding 1px 5px !important
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.elem-content
2017-10-16 00:33:08 +00:00
background-color rgb(60, 60, 60)
cursor default
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.elem-content:hover
2017-10-16 00:33:08 +00:00
hover_background(0.4s)
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.elem-card
2017-10-16 00:33:08 +00:00
padding 0 10px 0 0
2017-04-15 14:16:14 +00:00
2017-10-07 20:27:10 +00:00
.elem-card-layout
2017-10-16 00:33:08 +00:00
padding-left 1px
2017-10-07 20:27:10 +00:00
2017-05-13 14:38:17 +00:00
.elem-title h6
2017-10-16 00:33:08 +00:00
padding-left 10px
margin-top 10px
margin-bottom 10px
line-height 26px
white-space nowrap
text-overflow ellipsis
overflow hidden
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.elem-ep h6
2017-10-16 00:33:08 +00:00
margin-top 10px
white-space nowrap
text-overflow ellipsis
overflow hidden
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.elem-image
2017-10-16 00:33:08 +00:00
height 200px
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.picture
2017-10-16 00:33:08 +00:00
max-width 95%
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.elem-text-links
2017-10-16 00:33:08 +00:00
height 100%
position relative
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.synopsis
2017-10-16 00:33:08 +00:00
text-align justify
display block
text-overflow ellipsis
word-wrap break-word
overflow hidden
max-height 9em
line-height 1.5em
2017-04-15 14:16:14 +00:00
.following-status
2017-10-27 05:47:29 +00:00
padding 2px 2px 2px 3px
letter-spacing 1px
font-size 15px
border 1px solid rgba(255, 255, 255, 0.3)
2017-05-13 14:38:17 +00:00
.links
2017-10-16 00:33:08 +00:00
height 25%
position absolute
bottom 5px
right -2px
display flex
2017-04-15 14:16:14 +00:00
2017-05-13 14:38:17 +00:00
.download-button
2017-10-16 00:33:08 +00:00
text-decoration none
margin-right 0
2017-04-15 14:16:14 +00:00
2017-07-11 07:44:55 +00:00
.subheading
2017-10-16 00:33:08 +00:00
padding 30px
text-align justify
text-align-last center
white-space pre-wrap
2017-04-15 14:16:14 +00:00
</style>