Adapted to mal-scraper 2.5.0 and fixed malform and malPage (can't really use malForm tho since API still dead)

This commit is contained in:
GARNIER Joris 2019-03-09 19:57:32 +01:00
parent 5ae5ce73e9
commit 31d7a73d9a
7 changed files with 41 additions and 43 deletions

View File

@ -54,6 +54,8 @@ const actOnList = (req, res) => {
api.actOnList(type, id, opts)
.then((data) => {
if (data.includes('404 Not Found')) throw new Error(404)
logger.info('(Act on List):' + data)
res.status(typeof data === 'string' ? 200 : 204).send()
})

View File

@ -14,7 +14,7 @@
overlay(v-show='overlay')
video-modal(v-show='$store.state.streaming.player.show')
magnets-modal
//- mal-form
mal-form
//- Used for displaying any info
v-snackbar(
@ -38,6 +38,7 @@ import MagnetsModal from 'components/magnets/modal.vue'
import VideoModal from 'components/video/modal.vue'
import Overlay from 'components/global/overlay.vue'
import Env from 'components/global/env.vue'
import MalForm from 'components/global/malForm.vue'
// Mixins
import Meta from 'mixins/global/meta'
@ -55,6 +56,7 @@ export default {
// Global
TorrentDialog,
MalForm,
MagnetsModal,
VideoModal,
Overlay,

View File

@ -214,13 +214,13 @@ export default {
return this.$store.state.mal.entry
},
entryTitle () {
return ': ' + (this.entry.title || this.entry.name)
return ': ' + (this.entry.animeTitle || this.entry.name)
},
nbEpisodes () {
return this.entry.nbEpisodes || this.entry.episodes
return this.entry.animeNumEpisodes || this.entry.episodes
},
isEdit () {
return this.entry.lastUpdate
return !!this.entry.animeTitle
},
addOrEdit () {
return this.isEdit ? 'Edit' : 'Add'
@ -232,7 +232,7 @@ export default {
this.form = this.initForm
},
submit () {
const id = this.entry.id
const id = this.entry.id || this.entry.animeId
const opts = this.$_.clone(this.form)
opts.tags = opts.tags.join(', ')
@ -284,12 +284,10 @@ export default {
if (this.isEdit) {
this.form.status = obj.status
this.form.score = obj.score || null
this.form.episode = obj.nbWatchedEpisode || null
this.form.date_start = obj.startDate || null
this.form.date_finish = obj.endDate || null
this.form.episode = obj.numWatchedEpisodes || null
this.form.tags = obj.tags.length ? obj.tags.split(', ') : []
this.form.date_start = obj.myStartDate === '0000-00-00' ? null : obj.myStartDate
this.form.date_finish = obj.myEndDate === '0000-00-00' ? null : obj.myEndDate
this.form.date_start = obj.startDateString === '0000-00-00' ? null : obj.startDateString
this.form.date_finish = obj.endDateString === '0000-00-00' ? null : obj.endDateString
}
const { id } = obj

View File

@ -4,14 +4,15 @@
v-flex.centered(xs12, sm2)
.headline.pl-4 MyAnimeList
v-flex.centered.pr-2(xs10, sm3, md3, offset-sm1)
v-select(
v-autocomplete(
v-model='tagsFilter',
:items='customTags',
label='Tags',
persistent-hint,
hint='Looking for special tags?',
single-line,
clearable, dense, chips, tags
clearable, dense,
multiple, deletable-chips, small-chips
)
v-flex.centered.pl-2(xs8, sm3, md3, offset-md1)
v-text-field(
@ -38,19 +39,19 @@
:rows-per-page-items='rowsPerPage'
)
template(slot='items', slot-scope='props')
td.text-xs-center
td.pa-0.text-xs-center
img.entry-image(:src='props.item.image')
td.text-xs-left.entry-title
td.pa-0.text-xs-left.entry-title
span.pl-3 {{ props.item.title }}
td.text-xs-center {{ props.item.score }}
td.text-xs-center {{ props.item.type }}
td.text-xs-center {{ props.item.progress }}
td.text-xs-center {{ props.item.status }}
td.text-xs-center.ellipsis.entry-tags
td.pa-0.text-xs-center {{ props.item.score }}
td.pa-0.text-xs-center {{ props.item.type }}
td.pa-0.text-xs-center {{ props.item.progress }}
td.pa-0.text-xs-center {{ props.item.status }}
td.pa-0.text-xs-center.ellipsis.entry-tags
v-tooltip(top)
span(slot='activator') {{ props.item.tags }}
span {{ props.item.tags }}
td
td.pa-0
v-btn.blue--text.darken-1(icon, flat, @click.stop='showForm(props.item.id)')
v-icon edit
v-btn.blue--text.darken-1(icon, flat, @click.stop='showInfo(props.item.title, props.item.link)')

View File

@ -10,30 +10,23 @@ export default {
4: 'Dropped',
6: 'Plan to watch'
}
const types = {
1: 'TV',
2: 'OVA',
3: 'Movie',
4: 'Special',
5: 'ONA'
}
_.each(state.watchLists, (entry) => {
const dec = (+entry.nbWatchedEpisode / +entry.nbEpisodes) || 1
const dec = (+entry.numWatchedEpisodes / +entry.animeNumEpisodes) || 1
const toAdd = {
score: entry.score || 'N/A',
progress: (entry.nbWatchedEpisode || '??') + ' / ' + (entry.nbEpisodes || '??'),
progressDec: (dec === 1 ? entry.nbWatchedEpisode : dec),
title: entry.title,
type: types[entry.type],
image: entry.picture,
id: entry.id,
progress: (entry.numWatchedEpisodes || '??') + ' / ' + (entry.animeNumEpisodes || '??'),
progressDec: (dec === 1 ? entry.numWatchedEpisodes : dec),
title: entry.animeTitle,
type: entry.animeMediaTypeString,
image: entry.animeImagePath,
id: entry.animeId,
status: status[entry.status],
statusNum: entry.status,
start: entry.myStartDate === '0000-00-00' ? null : entry.myStartDate,
end: entry.myEndDate === '0000-00-00' ? null : entry.myEndDate,
link: 'https://myanimelist.net/anime/' + entry.id + '/' + entry.title,
start: entry.startDateString === '0000-00-00' ? null : entry.startDateString,
end: entry.endDateString === '0000-00-00' ? null : entry.endDateString,
link: 'https://myanimelist.net' + entry.animeUrl,
tags: entry.tags || 'No tags',
nbCorrespondingTags: 0
}

View File

@ -10,7 +10,7 @@ export default {
setEntry (state, itemOrID) {
const id = itemOrID.id || itemOrID
// Need to find the right entry in the lists if it's in there
state.entry = _.find(state.watchLists, (o) => o.id === id) || itemOrID
state.entry = _.find(state.watchLists, (o) => o.animeId === id) || itemOrID
},
isAdding (state, bool) {
state.isAdding = bool

View File

@ -48,7 +48,7 @@
"express": "^4.16.4",
"lodash": "^4.17.11",
"lru-cache": "^4.1.3",
"mal-scraper": "^2.4.5",
"mal-scraper": "^2.5.0",
"matroska-subtitles": "^2.0.3",
"mime": "^2.4.0",
"moment": "^2.23.0",
@ -154,9 +154,11 @@
"oneClick": false,
"allowToChangeInstallationDirectory": true
},
"fileAssociations": [{
"ext": "torrent",
"name": "Torrent files"
}]
"fileAssociations": [
{
"ext": "torrent",
"name": "Torrent files"
}
]
}
}