Fix handling when the channel scraper fails
This commit is contained in:
parent
cc77cd9a6a
commit
f440a5b38c
|
@ -247,6 +247,8 @@ export default Vue.extend({
|
||||||
this.updateShowProgressBar(true)
|
this.updateShowProgressBar(true)
|
||||||
this.setProgressBarPercentage(0)
|
this.setProgressBarPercentage(0)
|
||||||
|
|
||||||
|
let count = 0
|
||||||
|
|
||||||
feedData.forEach(async (channel, index) => {
|
feedData.forEach(async (channel, index) => {
|
||||||
const channelId = channel.xmlurl.replace('https://www.youtube.com/feeds/videos.xml?channel_id=', '')
|
const channelId = channel.xmlurl.replace('https://www.youtube.com/feeds/videos.xml?channel_id=', '')
|
||||||
let channelInfo
|
let channelInfo
|
||||||
|
@ -256,6 +258,7 @@ export default Vue.extend({
|
||||||
channelInfo = await this.getChannelInfoLocal(channelId)
|
channelInfo = await this.getChannelInfoLocal(channelId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof channelInfo.author !== 'undefined') {
|
||||||
const subscription = {
|
const subscription = {
|
||||||
id: channelId,
|
id: channelId,
|
||||||
name: channelInfo.author,
|
name: channelInfo.author,
|
||||||
|
@ -263,17 +266,27 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
subscriptions.push(subscription)
|
subscriptions.push(subscription)
|
||||||
|
}
|
||||||
|
|
||||||
const progressPercentage = ((subscriptions.length + 1) / feedData.length) * 100
|
count++
|
||||||
|
|
||||||
|
const progressPercentage = (count / feedData.length) * 100
|
||||||
this.setProgressBarPercentage(progressPercentage)
|
this.setProgressBarPercentage(progressPercentage)
|
||||||
|
|
||||||
if (subscriptions.length === feedData.length) {
|
if (count === feedData.length) {
|
||||||
primaryProfile.subscriptions = primaryProfile.subscriptions.concat(subscriptions)
|
primaryProfile.subscriptions = primaryProfile.subscriptions.concat(subscriptions)
|
||||||
this.updateProfile(primaryProfile)
|
this.updateProfile(primaryProfile)
|
||||||
|
|
||||||
|
if (subscriptions.length < count) {
|
||||||
|
this.showToast({
|
||||||
|
message: this.$t('Settings.Data Settings.One or more subscriptions were unable to be imported')
|
||||||
|
})
|
||||||
|
} else {
|
||||||
this.showToast({
|
this.showToast({
|
||||||
message: this.$t('Settings.Data Settings.All subscriptions have been successfully imported')
|
message: this.$t('Settings.Data Settings.All subscriptions have been successfully imported')
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.updateShowProgressBar(false)
|
this.updateShowProgressBar(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -331,6 +344,8 @@ export default Vue.extend({
|
||||||
this.updateShowProgressBar(true)
|
this.updateShowProgressBar(true)
|
||||||
this.setProgressBarPercentage(0)
|
this.setProgressBarPercentage(0)
|
||||||
|
|
||||||
|
let count = 0
|
||||||
|
|
||||||
newPipeSubscriptions.forEach(async (channel, index) => {
|
newPipeSubscriptions.forEach(async (channel, index) => {
|
||||||
const channelId = channel.url.replace(/https:\/\/(www\.)?youtube\.com\/channel\//, '')
|
const channelId = channel.url.replace(/https:\/\/(www\.)?youtube\.com\/channel\//, '')
|
||||||
let channelInfo
|
let channelInfo
|
||||||
|
@ -340,6 +355,7 @@ export default Vue.extend({
|
||||||
channelInfo = await this.getChannelInfoLocal(channelId)
|
channelInfo = await this.getChannelInfoLocal(channelId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof channelInfo.author !== 'undefined') {
|
||||||
const subscription = {
|
const subscription = {
|
||||||
id: channelId,
|
id: channelId,
|
||||||
name: channelInfo.author,
|
name: channelInfo.author,
|
||||||
|
@ -347,17 +363,27 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
subscriptions.push(subscription)
|
subscriptions.push(subscription)
|
||||||
|
}
|
||||||
|
|
||||||
const progressPercentage = ((subscriptions.length + 1) / newPipeSubscriptions.length) * 100
|
count++
|
||||||
|
|
||||||
|
const progressPercentage = (count / newPipeSubscriptions.length) * 100
|
||||||
this.setProgressBarPercentage(progressPercentage)
|
this.setProgressBarPercentage(progressPercentage)
|
||||||
|
|
||||||
if (subscriptions.length === newPipeSubscriptions.length) {
|
if (count === newPipeSubscriptions.length) {
|
||||||
primaryProfile.subscriptions = primaryProfile.subscriptions.concat(subscriptions)
|
primaryProfile.subscriptions = primaryProfile.subscriptions.concat(subscriptions)
|
||||||
this.updateProfile(primaryProfile)
|
this.updateProfile(primaryProfile)
|
||||||
|
|
||||||
|
if (subscriptions.length < count) {
|
||||||
|
this.showToast({
|
||||||
|
message: this.$t('Settings.Data Settings.One or more subscriptions were unable to be imported')
|
||||||
|
})
|
||||||
|
} else {
|
||||||
this.showToast({
|
this.showToast({
|
||||||
message: this.$t('Settings.Data Settings.All subscriptions have been successfully imported')
|
message: this.$t('Settings.Data Settings.All subscriptions have been successfully imported')
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.updateShowProgressBar(false)
|
this.updateShowProgressBar(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -202,6 +202,7 @@ Settings:
|
||||||
Profile object has insufficient data, skipping item: Profile object has insufficient data, skipping item
|
Profile object has insufficient data, skipping item: Profile object has insufficient data, skipping item
|
||||||
All subscriptions and profiles have been successfully imported: All subscriptions and profiles have been successfully imported
|
All subscriptions and profiles have been successfully imported: All subscriptions and profiles have been successfully imported
|
||||||
All subscriptions have been successfully imported: All subscriptions have been successfully imported
|
All subscriptions have been successfully imported: All subscriptions have been successfully imported
|
||||||
|
One or more subscriptions were unable to be imported: One or more subscriptions were unable to be imported
|
||||||
Invalid subscriptions file: Invalid subscriptions file
|
Invalid subscriptions file: Invalid subscriptions file
|
||||||
This might take a while, please wait: This might take a while, please wait
|
This might take a while, please wait: This might take a while, please wait
|
||||||
Invalid history file: Invalid history file
|
Invalid history file: Invalid history file
|
||||||
|
|
Loading…
Reference in New Issue