Updated to new mal-scraper

Code style
This commit is contained in:
Kylart 2017-03-01 10:06:53 +01:00
parent 2b72e00d10
commit 5153d50636
11 changed files with 18 additions and 18 deletions

View File

@ -6,7 +6,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.indigo-red.min.css">
<link rel="stylesheet" href="node_modules/vue-material/dist/vue-material.css">
<link rel="stylesheet" href="app/style.css">
<link rel="stylesheet" href="src/style.css">
<script src="https://code.getmdl.io/1.2.1/material.min.js"></script>
</head>
<body>

10
main.js
View File

@ -34,7 +34,7 @@ function createWindow () {
scrollBounce: true
})
// and load the index.html of the app.
// and load the index.html of the src.
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
@ -51,7 +51,7 @@ function createWindow () {
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// in an array if your src supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
@ -84,7 +84,7 @@ exports.openDownloader = () => {
downloaderWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// in an array if your src supports multi windows, this is the time
// when you should delete the corresponding element.
downloaderWindow = null
})
@ -133,12 +133,12 @@ app.on('window-all-closed', function () {
})
app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// On OS X it's common to re-create a window in the src when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})
// In this file you can include the rest of your app's specific main process
// In this file you can include the rest of your src's specific main process
// code. You can also put them in separate files and require them here.

View File

@ -23,7 +23,7 @@
"electron": "^1.4.15",
"find-remove": "^1.0.0",
"is-online": "^5.2.0",
"mal-scraper": "^1.0.9",
"mal-scraper": "latest",
"malapi": "0.0.3",
"node-nyaa-api": "latest",
"parse-torrent": "^5.8.1",

View File

@ -109,7 +109,7 @@ function getLatest() {
// Make the actual research
try {
mal.fromName(tmp.join(' ')).then(result => {
mal.fromName(tmp.join(' ')).then( (result) => {
releases.releases.push({
realTitle: animes[anime].title,
title: getNameOnly(animes[anime].title),
@ -118,19 +118,19 @@ function getLatest() {
picture: result.image,
published: animes[anime].published
})
}).then(() => {
}).then( () => {
if (releases.releases.length > 29) {
releases.releases.sort(byProperty('published'))
releases.releases.reverse()
sorted = true
}
}).then(() => {
}).then( () => {
// 35 elements is too much, reducing to 18
if (sorted)
while (releases.releases.length > 18)
releases.releases.pop()
}).then(() => {
setTimeout(() => {
}).then( () => {
setTimeout( () => {
if (loader.show) {
loader.show = false
releases.show = true
@ -169,7 +169,7 @@ function startTorrent(file_url, name) {
function makeResearchOnMal(name) {
mal.fromName(name).then(anime => {
mal.fromName(name).then( (anime) => {
info.infos.title = anime.title
info.infos.japTitle = anime.alternativeTitles.japanese[0].slice(10)
info.infos.image = anime.image
@ -192,7 +192,7 @@ function makeResearchOnMal(name) {
}
function getNews() {
let tmp = malScraper.getNewsNoDetails(() => {
let tmp = malScraper.getNewsNoDetails( () => {
news.news = tmp
})
}
@ -217,7 +217,7 @@ function getCurrentSeason() {
}
function fillSeason(seasonalInfo) {
seasonalInfo.info.forEach((elem) => {
seasonalInfo.info.forEach( (elem) => {
switch (elem.type) {
case 'TV':
season.TVs.push(elem)
@ -303,7 +303,7 @@ let downloader = new Vue({
for (let article in articles)
animes.push(articles[article])
animes.forEach((elem) => {
animes.forEach( (elem) => {
const url = elem.link
const epNumber = parseInt(elem.title.split(' ').reverse()[1])
@ -336,7 +336,7 @@ let downloader = new Vue({
for (let article in articles)
animes.push(articles[article])
animes.forEach((elem) => {
animes.forEach( (elem) => {
const url = elem.link
const epNumber = parseInt(elem.title.split(' ').reverse()[1])
const name = elem.title.split(' ').slice(0, -1).join(' ')
@ -574,7 +574,7 @@ let season = new Vue({
getGenres: function (genres) {
let result = ''
genres.forEach((elem) => {
genres.forEach( (elem) => {
result += `${elem}, `
})