Replaced zettai with anitomy-js

This commit is contained in:
Kylart 2019-05-20 01:02:37 +02:00
parent a7f8e278d4
commit 478437385b
16 changed files with 2872 additions and 1250 deletions

3991
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,27 +23,27 @@
"test:unit": "vue-cli-service test:unit"
},
"dependencies": {
"anitomy-js": "^3.1.0",
"buttercup": "^2.12.0",
"chalk": "^2.4.2",
"electron-updater": "^4.0.6",
"lodash": "^4.17.11",
"lru-cache": "^5.1.1",
"mal-scraper": "^2.6.0",
"mal-scraper": "^2.6.1",
"matroska-subtitles": "^2.0.3",
"mime": "^2.4.2",
"mime": "^2.4.3",
"moment": "^2.24.0",
"nyaapi": "^2.0.5",
"rage-edit": "^1.2.0",
"range-parser": "^1.2.0",
"range-parser": "^1.2.1",
"register-service-worker": "^1.6.2",
"rimraf": "^2.6.3",
"velocity-animate": "^1.5.2",
"vue": "^2.6.10",
"vue-router": "^3.0.2",
"vuetify": "^1.5.9",
"vuex": "^3.1.0",
"webtorrent": "^0.103.1",
"zettai": "^2.0.2"
"vue-router": "^3.0.6",
"vuetify": "^1.5.14",
"vuex": "^3.1.1",
"webtorrent": "^0.103.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.5.5",
@ -60,6 +60,7 @@
"cross-env": "^5.2.0",
"electron": "^4.1.4",
"electron-builder": "^20.40.2",
"electron-rebuild": "^1.8.4",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.2.2",
"lint-staged": "^8.1.5",

View File

@ -1,9 +1,9 @@
export { default as engines } from './feeds'
export { default as parseName } from './parseName'
export { default as mal } from './mal'
export { default as kitsu } from './kitsu.io'
export { default as anilist } from './anilist'
export { default as localFiles } from './localFiles'
export { default as parseSubtitles } from './subtitles'
export { getCreds, setupCreds } from './vault'
export { default as sendToWindows } from './sendToWindows'
export { getCreds, setupCreds } from './vault'
export { parseName } from './parseName'

View File

@ -1,3 +1 @@
import { parseAnime } from 'zettai'
export default parseAnime
export { parseSync as parseName } from 'anitomy-js'

View File

@ -14,18 +14,19 @@ function formatMagnets (data, searchData, feed) {
const isPantsu = feed === 'pantsu'
data.forEach((elem) => {
const parsed = Object.assign({}, parse(elem.name))
const ep = parseInt(parsed.episodeOrMovieNumber)
const parsed = parse(elem.name)
const ep = +parsed.episode_number
eps.push(ep)
if (ep <= searchData.untilEp && ep >= searchData.fromEp) {
magnets.push({
name: parsed.title,
originalName: elem.name,
name: parsed.anime_title || 'Unknown',
link: isPantsu ? elem.magnet : elem.links.magnet,
nb: ep,
quality: parsed.resolution,
fansub: parsed.releaseGroup
quality: parsed.video_resolution || 'Unknown',
fansub: parsed.release_group || 'Unknown'
})
}
})

View File

@ -22,16 +22,10 @@ async function getLatest (event, { feed, quality, term, fansub = '' }) {
logger.info('Retrieving latest releases...')
const result = (await engine.search(query, 150, { filter: '0', category: '1_0' }))
.map((elem) => {
const tmp = elem
// We have to copy the result of `parse` so that
// parsedName won't be always a reference to the same
// variable...
tmp.parsedName = Object.assign({}, parse(elem.name))
return tmp
})
.map((elem) => ({
...elem,
parsedName: parse(elem.name)
}))
logger.info('Sending latest releases.')

View File

@ -18,9 +18,17 @@ function sendLocalFiles (dir) {
.filter(
(file) => extensions.includes(extname(file.toLowerCase()))
)
.map((elem) => Object.assign({
path: join(dir, elem)
}, parseName(elem)))
.map((elem) => {
const parsed = parseName(elem)
return {
path: join(dir, elem),
ep: parsed.episode_number,
title: parsed.anime_title,
releaseGroup: parsed.release_group,
...parsed
}
})
}
function sendLocalInfo (name) {

View File

@ -16,11 +16,11 @@
key='normal'
)
v-layout.text(fill-height, column, justify-space-between)
v-flex.entry-title(xs2) {{ info.parsedName.title }}
v-flex.entry-title(xs2) {{ name }}
v-flex.text-xs-center(v-if='!picture', xs2)
v-progress-circular(indeterminate)
v-flex.entry-ep(xs2, v-if='info.parsedName.episodeOrMovieNumber')
span Ep. {{ info.parsedName.episodeOrMovieNumber }}
v-flex.entry-ep(xs2, v-if='episodeLabel')
span Ep. {{ episodeLabel }}
v-container.overlay(
v-else
@ -42,7 +42,7 @@
v-icon.large more_horiz
v-card-actions
.fansub.ellipsis(v-show='!hasFansub') {{ info.parsedName.releaseGroup }}
.fansub.ellipsis(v-show='!hasFansub') {{ info.parsedName.release_group }}
v-spacer
template(v-for='list in lists')
v-tooltip(top, lazy)
@ -89,13 +89,16 @@ export default {
return this.$store.state.releases.params.fansub !== 'None'
},
name () {
return this.info.parsedName.title
return this.info.parsedName.anime_title
},
lists: {
get () {
return this.$store.state.watchLists.listNames.filter(({ list }) => ['watchList', 'watching'].includes(list))
},
set () {}
},
episodeLabel () {
return this.info.parsedName.episode_number || 'N/A'
}
},
@ -107,7 +110,7 @@ export default {
this.overlay = false
},
watch () {
const { parsedName: { title, episodeOrMovieNumber: ep } } = this.info
const { parsedName: { anime_title: title, episode_number: ep } } = this.info
const magnet = 'magnet' in this.info
? this.info.magnet
@ -130,14 +133,14 @@ export default {
? this.$store.state.config.config.fansub
: params.fansub,
quality: params.quality,
name: this.info.parsedName.title,
name: this.name,
fromEp: -Infinity,
untilEp: Infinity,
feed: params.feed
})
},
more () {
if (this.allInfo[this.info.parsedName.title]) {
if (this.allInfo[this.name]) {
this.$store.commit('releases/setCurrent', this.info.parsedName)
}
},

View File

@ -43,7 +43,7 @@
v-for='(entry, i) in entries',
:key='entry.name'
)
card(:info='entry', :ref='entry.parsedName.title')
card(:info='entry', :ref='entry.name')
.pag-container
v-pagination(

View File

@ -183,7 +183,7 @@ export default {
allInfo: 'getInfo'
}),
title () {
return this.current.title.replace(':', '')
return (this.current.anime_title || this.current.title).replace(':', '')
},
info () {
return this.allInfo[this.title] || {}

View File

@ -82,7 +82,7 @@ export default {
mounted () {
this.getInfo()
if (this.file.eps) this.currentEp = this.file.eps[0].episodeOrMovieNumber
if (this.file.eps) this.currentEp = this.file.eps[0].ep
},
data: () => ({
@ -115,15 +115,15 @@ export default {
},
eps () {
return (this.file.eps || [])
.map((e) => e.episodeOrMovieNumber)
.map((e) => e.ep)
.reverse()
},
title () {
return `${this.file.title} - ${this.currentEp || this.file.episodeOrMovieNumber || this.file.animeType2 || 'N/A'}`
return `${this.file.title} - ${this.currentEp || this.file.ep || this.file.animeType2 || 'N/A'}`
},
path () {
return this.currentEp
? this.file.eps.find((ep) => ep.episodeOrMovieNumber === this.currentEp).path
? this.file.eps.find((ep) => ep.ep === this.currentEp).path
: this.file.path
}
},

View File

@ -153,7 +153,7 @@ export default {
this.$store.dispatch('streaming/play', {
isTorrent: next.hasOwnProperty('link'),
link: next.path || next.link,
name: `${next.title} - ${next.episodeOrMovieNumber}`,
name: `${next.title} - ${next.ep}`,
neighbours: null
})
})

View File

@ -1,4 +1,4 @@
import { parseAnime } from 'zettai'
import { parseSync } from 'anitomy-js'
export default {
data: () => ({
@ -63,12 +63,12 @@ export default {
const fileExtension = path.split('.').slice(-1)[0]
if (this.isValidFile(fileExtension)) {
const { title, episodeOrMovieNumber: ep } = Object.assign({}, parseAnime(fullName))
const { video_title: title, volume_number: ep } = parseSync(fullName)
this.$store.dispatch('streaming/play', {
link: path,
isTorrent: this.torrentExtension.includes(fileExtension),
name: `${title} - ${ep}`,
name: `${title} - ${+ep}`,
neighbours: null
})
}

View File

@ -19,7 +19,7 @@
class='trans layout row wrap justify-space-around', tag='div'
)
template(v-for='file in groupedFiles')
v-flex(xs12, sm6, md3, lg3, xl2, :key='`${file.title} - ${file.episodeOrMovieNumber || ""}`')
v-flex(xs12, sm6, md3, lg3, xl2, :key='`${file.title} - ${file.ep || ""}`')
card(:reset='resetting', :file='file', @more='setCurrent', @refresh='refresh')
</template>
@ -57,14 +57,14 @@ export default {
const { files = [] } = this
return files.reduce((acc, file) => {
if (!file.episodeOrMovieNumber) {
if (!file.ep) {
acc.push(file)
return acc
}
const isIn = acc.find((f) => f.title === file.title)
const epInfo = {
episodeOrMovieNumber: file.episodeOrMovieNumber,
ep: file.ep,
path: file.path
}

View File

@ -8,7 +8,11 @@ export default {
state.info[sanitize(key)] = value
},
addEps (state, { name, data }) {
state.info[sanitize(name)].episodesInfo = data
const localInfo = state.info[sanitize(`local/${name}`)]
const globalInfo = state.info[sanitize(name)]
if (localInfo) state.info[sanitize(`local/${name}`)].episodesInfo = data
if (globalInfo) state.info[sanitize(name)].episodesInfo = data
},
addEpsLinks (state, { name, data }) {
state.info[name].episodesLinks = data

View File

@ -65,12 +65,12 @@ export default {
previous: {
link: previous.link,
title,
episodeOrMovieNumber: +ep - 1
ep: +ep - 1
},
next: {
link: next.link,
title,
episodeOrMovieNumber: +ep + 1
ep: +ep + 1
}
})
@ -88,7 +88,7 @@ export default {
...(rootState.services.kitsu.lists || []).map(({ title }) => title)
]
const candidates = currentEntries.filter(({ parsedName }) => watching.includes(parsedName.title))
const candidates = currentEntries.filter(({ parsedName }) => watching.includes(parsedName.anime_title))
if (!candidates.length) {
log('No candidates, returning...')
@ -96,7 +96,7 @@ export default {
return
}
const currentIndex = candidates.findIndex(({ parsedName }) => parsedName.title === title)
const currentIndex = candidates.findIndex(({ parsedName }) => parsedName.anime_title === title)
next = currentIndex === -1
? candidates[0]
@ -111,14 +111,14 @@ export default {
commit('setNeighbours', {
previous: {
link: previous.links.magnet,
title: previous.parsedName.title,
episodeOrMovieNumber: previous.parsedName.episodeOrMovieNumber
title: previous.parsedName.anime_title,
ep: previous.parsedName.episode_number
},
next: next
? {
link: next.links.magnet,
title: next.parsedName.title,
episodeOrMovieNumber: next.parsedName.episodeOrMovieNumber
title: next.parsedName.anime_title,
ep: next.parsedName.episode_number
}
: null
})