Skip to content

Commit

Permalink
feat: add Has Image Filter
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Asparghus authored Aug 5, 2024
1 parent 80c7a82 commit 037a1b4
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitpod.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN export PATH=$(echo "$PATH" | sed -e 's|:/workspace/go/bin||' -e 's|:/home/gi
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH

RUN go install -v \
github.com/cosmtrek/air@latest && \
github.com/air-verse/air@latest && \
sudo rm -rf $GOPATH/src && \
sudo rm -rf $GOPATH/pkg
# user Go packages
Expand Down
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ image:
file: .gitpod.dockerfile
tasks:
- name: Continuous Build
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
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
ports:
- port: 9999
onOpen: open-preview
Expand Down
2 changes: 2 additions & 0 deletions pkg/models/model_scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,8 @@ func queryScenes(db *gorm.DB, r RequestSceneList) (*gorm.DB, *gorm.DB) {
where = `scenes.scene_id like "povr-%"`
case "SLR Scraper":
where = `scenes.scene_id like "slr-%"`
case "Has Image":
where = "cover_url not in ('','http://localhost/dont_cause_errors')"
case "VRPHub Scraper":
where = `scenes.scene_id like "vrphub-%"`
case "VRPorn Scraper":
Expand Down
71 changes: 40 additions & 31 deletions ui/src/components/RescrapeButton.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<a class="button is-dark is-outlined is-small"
@click="rescrapeSingleScene()"
:title="'Rescrape scene'">
@click="rescrapeScene()"
:title="'Rescrape Scene'">
<b-icon pack="mdi" icon="web-refresh" size="is-small"/>
</a>
</template>
Expand All @@ -12,44 +12,53 @@ export default {
name: 'RescrapeButton',
props: { item: Object },
methods: {
async rescrapeSingleScene () {
delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
},
async rescrapeScene () {
let site = ""
if (this.item.scene_url.toLowerCase().includes("dmm.co.jp")) {
ky.post('/api/task/scrape-javr', { json: { s: "r18d", q: this.item.scene_id } })
this.$store.commit('sceneList/toggleSceneList', {scene_id: this.item.scene_id, list: 'needs_update'})
if (this.item.scraper_id && this.item.needs_update) {
await this.delay(200);
ky.get(`/api/task/scrape?site=${this.item.scraper_id}`)
} else {
if (this.item.scene_url.toLowerCase().includes("dmm.co.jp")) {
ky.post('/api/task/scrape-javr', { json: { s: "r18d", q: this.item.scene_id } })
} else {
const sites = await ky.get('/api/options/sites').json()
console.info(sites)
const sites = await ky.get('/api/options/sites').json()
console.info(sites)
for (const element of sites) {
if (this.item.scene_url.toLowerCase().includes(element.id)) {
site = element.id
for (const element of sites) {
if (this.item.scene_url.toLowerCase().includes(element.id)) {
site = element.id
}
}
}
if (this.item.scene_url.toLowerCase().includes("sexlikereal.com")) {
site = "slr-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("czechvrnetwork.com")) {
site = "czechvr-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("povr.com")) {
site = "povr-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("vrporn.com")) {
site = "vrporn-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("vrphub.com")) {
site = "vrphub-single_scene"
if (this.item.scene_url.toLowerCase().includes("sexlikereal.com")) {
site = "slr-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("czechvrnetwork.com")) {
site = "czechvr-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("povr.com")) {
site = "povr-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("vrporn.com")) {
site = "vrporn-single_scene"
}
if (this.item.scene_url.toLowerCase().includes("vrphub.com")) {
site = "vrphub-single_scene"
}
if (site == "") {
this.$buefy.toast.open({message: `No scrapers exist for this domain`, type: 'is-danger', duration: 5000})
return
}
ky.post(`/api/task/singlescrape`, {timeout: false, json: { site: site, sceneurl: this.item.scene_url, additionalinfo:[] }})
}
if (site == "") {
this.$buefy.toast.open({message: `No scrapers exist for this domain`, type: 'is-danger', duration: 5000})
return
}
ky.post(`/api/task/singlescrape`, {timeout: false, json: { site: site, sceneurl: this.item.scene_url, additionalinfo:[] }})
}
}
}
}
</script>
</script>

0 comments on commit 037a1b4

Please sign in to comment.