Skip to content

Commit 037a1b4

Browse files
authored
feat: add Has Image Filter
* Update RescrapeButton.vue Updated the Rescrape Scene function to work with scenes that have scrape_id and belong to a configured scraper. By toggling it's needs_update and running that scraper. It can be useful in case of single scenes without images. I've had to add a small delay (200ms) as it was not triggering the forceUpdate when making the API call, even when checking if this.item.needs_update was true. * Replaced github.com/cosmtrek/air with github.com/air-verse/air The repo github.com/cosmtrek/air doesn't exist anymore. When running Gitpod, it suggests using github.com/air-verse/air instead. * Replaced github.com/cosmtrek/air with github.com/air-verse/air The repo github.com/cosmtrek/air doesn't exist anymore. When running Gitpod, it suggests using github.com/air-verse/air instead. * Added the missing Has Image case
1 parent 80c7a82 commit 037a1b4

File tree

4 files changed

+44
-33
lines changed

4 files changed

+44
-33
lines changed

.gitpod.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN export PATH=$(echo "$PATH" | sed -e 's|:/workspace/go/bin||' -e 's|:/home/gi
1111
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
1212

1313
RUN go install -v \
14-
github.com/cosmtrek/air@latest && \
14+
github.com/air-verse/air@latest && \
1515
sudo rm -rf $GOPATH/src && \
1616
sudo rm -rf $GOPATH/pkg
1717
# user Go packages

.gitpod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ image:
22
file: .gitpod.dockerfile
33
tasks:
44
- name: Continuous Build
5-
command: yarn config set ignore-engines true && yarn global add concurrently && go install github.com/cosmtrek/air@latest && cd /workspace/xbvr && go generate && go get && yarn && yarn dev
5+
command: yarn config set ignore-engines true && yarn global add concurrently && go install github.com/air-verse/air@latest && cd /workspace/xbvr && go generate && go get && yarn && yarn dev
66
ports:
77
- port: 9999
88
onOpen: open-preview

pkg/models/model_scene.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ func queryScenes(db *gorm.DB, r RequestSceneList) (*gorm.DB, *gorm.DB) {
885885
where = `scenes.scene_id like "povr-%"`
886886
case "SLR Scraper":
887887
where = `scenes.scene_id like "slr-%"`
888+
case "Has Image":
889+
where = "cover_url not in ('','http://localhost/dont_cause_errors')"
888890
case "VRPHub Scraper":
889891
where = `scenes.scene_id like "vrphub-%"`
890892
case "VRPorn Scraper":
Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<a class="button is-dark is-outlined is-small"
3-
@click="rescrapeSingleScene()"
4-
:title="'Rescrape scene'">
3+
@click="rescrapeScene()"
4+
:title="'Rescrape Scene'">
55
<b-icon pack="mdi" icon="web-refresh" size="is-small"/>
66
</a>
77
</template>
@@ -12,44 +12,53 @@ export default {
1212
name: 'RescrapeButton',
1313
props: { item: Object },
1414
methods: {
15-
async rescrapeSingleScene () {
15+
delay(ms) {
16+
return new Promise(resolve => setTimeout(resolve, ms));
17+
},
18+
async rescrapeScene () {
1619
let site = ""
1720
18-
if (this.item.scene_url.toLowerCase().includes("dmm.co.jp")) {
19-
ky.post('/api/task/scrape-javr', { json: { s: "r18d", q: this.item.scene_id } })
21+
this.$store.commit('sceneList/toggleSceneList', {scene_id: this.item.scene_id, list: 'needs_update'})
22+
if (this.item.scraper_id && this.item.needs_update) {
23+
await this.delay(200);
24+
ky.get(`/api/task/scrape?site=${this.item.scraper_id}`)
2025
} else {
26+
if (this.item.scene_url.toLowerCase().includes("dmm.co.jp")) {
27+
ky.post('/api/task/scrape-javr', { json: { s: "r18d", q: this.item.scene_id } })
28+
} else {
2129
22-
const sites = await ky.get('/api/options/sites').json()
23-
console.info(sites)
30+
const sites = await ky.get('/api/options/sites').json()
31+
console.info(sites)
2432
25-
for (const element of sites) {
26-
if (this.item.scene_url.toLowerCase().includes(element.id)) {
27-
site = element.id
33+
for (const element of sites) {
34+
if (this.item.scene_url.toLowerCase().includes(element.id)) {
35+
site = element.id
36+
}
2837
}
29-
}
3038
31-
if (this.item.scene_url.toLowerCase().includes("sexlikereal.com")) {
32-
site = "slr-single_scene"
33-
}
34-
if (this.item.scene_url.toLowerCase().includes("czechvrnetwork.com")) {
35-
site = "czechvr-single_scene"
36-
}
37-
if (this.item.scene_url.toLowerCase().includes("povr.com")) {
38-
site = "povr-single_scene"
39-
}
40-
if (this.item.scene_url.toLowerCase().includes("vrporn.com")) {
41-
site = "vrporn-single_scene"
42-
}
43-
if (this.item.scene_url.toLowerCase().includes("vrphub.com")) {
44-
site = "vrphub-single_scene"
39+
if (this.item.scene_url.toLowerCase().includes("sexlikereal.com")) {
40+
site = "slr-single_scene"
41+
}
42+
if (this.item.scene_url.toLowerCase().includes("czechvrnetwork.com")) {
43+
site = "czechvr-single_scene"
44+
}
45+
if (this.item.scene_url.toLowerCase().includes("povr.com")) {
46+
site = "povr-single_scene"
47+
}
48+
if (this.item.scene_url.toLowerCase().includes("vrporn.com")) {
49+
site = "vrporn-single_scene"
50+
}
51+
if (this.item.scene_url.toLowerCase().includes("vrphub.com")) {
52+
site = "vrphub-single_scene"
53+
}
54+
if (site == "") {
55+
this.$buefy.toast.open({message: `No scrapers exist for this domain`, type: 'is-danger', duration: 5000})
56+
return
57+
}
58+
ky.post(`/api/task/singlescrape`, {timeout: false, json: { site: site, sceneurl: this.item.scene_url, additionalinfo:[] }})
4559
}
46-
if (site == "") {
47-
this.$buefy.toast.open({message: `No scrapers exist for this domain`, type: 'is-danger', duration: 5000})
48-
return
49-
}
50-
ky.post(`/api/task/singlescrape`, {timeout: false, json: { site: site, sceneurl: this.item.scene_url, additionalinfo:[] }})
5160
}
5261
}
5362
}
5463
}
55-
</script>
64+
</script>

0 commit comments

Comments
 (0)