Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit401c19e

Browse files
authored
feat: Allow Stash Scraping via new flag rather than Enabled (#1887)
1 parentc7fe17f commit401c19e

File tree

6 files changed

+32
-1
lines changed

6 files changed

+32
-1
lines changed

‎pkg/api/options.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ func (i ConfigResource) WebService() *restful.WebService {
238238
ws.Route(ws.PUT("/sites/limit_scraping/{site}").To(i.toggleLimitScraping).
239239
Metadata(restfulspec.KeyOpenAPITags,tags))
240240

241+
ws.Route(ws.PUT("/sites/scrape_stash/{site}").To(i.toggleScrapeStash).
242+
Metadata(restfulspec.KeyOpenAPITags,tags))
243+
241244
ws.Route(ws.POST("/scraper/force-site-update").To(i.forceSiteUpdate).
242245
Metadata(restfulspec.KeyOpenAPITags,tags))
243246

@@ -355,6 +358,9 @@ func (i ConfigResource) toggleLimitScraping(req *restful.Request, resp *restful.
355358
i.toggleSiteField(req,resp,"LimitScraping")
356359
}
357360

361+
func (iConfigResource)toggleScrapeStash(req*restful.Request,resp*restful.Response) {
362+
i.toggleSiteField(req,resp,"ScrapeStash")
363+
}
358364
func (iConfigResource)toggleSiteField(req*restful.Request,resp*restful.Response,fieldstring) {
359365
db,_:=models.GetDB()
360366
deferdb.Close()
@@ -380,6 +386,9 @@ func (i ConfigResource) toggleSiteField(req *restful.Request, resp *restful.Resp
380386
case"LimitScraping":
381387
site.LimitScraping=!site.LimitScraping
382388
db.Model(&models.Scene{}).Where("scraper_id = ?",site.ID).Update("limit_scraping",site.LimitScraping)
389+
case"ScrapeStash":
390+
site.ScrapeStash=!site.ScrapeStash
391+
db.Model(&models.Scene{}).Where("scrape_stash = ?",site.ID).Update("scrape_stash",site.LimitScraping)
383392
}
384393
site.Save()
385394

‎pkg/migrations/migrations.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,19 @@ func Migrate() {
820820
returnnil
821821
},
822822
},
823+
{
824+
ID:"0082-scrape-stash-flag",
825+
Migrate:func(tx*gorm.DB)error {
826+
typeSitestruct {
827+
ScrapeStashbool`json:"scrape_stash" xbvrbackup:"scrape_stash"`
828+
}
829+
err:=tx.AutoMigrate(Site{}).Error
830+
iferr!=nil {
831+
returnerr
832+
}
833+
returntx.Exec("update sites set scrape_stash = is_enabled").Error
834+
},
835+
},
823836

824837
// ===============================================================================================
825838
// Put DB Schema migrations above this line and migrations that rely on the updated schema below

‎pkg/models/model_site.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Site struct {
1919
LimitScrapingbool`json:"limit_scraping" xbvrbackup:"limit_scraping"`
2020
MasterSiteIDstring`json:"master_site_id" xbvrbackup:"master_site_id"`
2121
MatchingParamsstring`json:"matching_params" gorm:"size:1000" xbvrbackup:"matching_params"`
22+
ScrapeStashbool`json:"scrape_stash" xbvrbackup:"scrape_stash"`
2223
}
2324

2425
func (i*Site)Save()error {

‎pkg/scrape/stashdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func StashDb() {
8686
deferdb.Close()
8787

8888
Config=models.BuildActorScraperRules()
89-
db.Where(&models.Site{IsEnabled:true}).Order("id").Find(&sites)
89+
db.Where(&models.Site{ScrapeStash:true}).Order("id").Find(&sites)
9090

9191
for_,site:=rangesites {
9292
tlog.Infof("Scraping stash studio %s",site.Name)

‎ui/src/store/optionsSites.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const actions = {
2020
asynctoggleLimitScraping({ state},params){
2121
state.items=awaitky.put(`/api/options/sites/limit_scraping/${params.id}`,{json:{}}).json()
2222
},
23+
asynctoggleScrapeStash({ state},params){
24+
state.items=awaitky.put(`/api/options/sites/scrape_stash/${params.id}`,{json:{}}).json()
25+
},
2326
}
2427

2528
exportdefault{

‎ui/src/views/options/sections/OptionsSceneDataScrapers.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
<spanv-if="props.row.master_site_id==''"><b-switchv-model ="props.row.subscribed"@input="$store.dispatch('optionsSites/toggleSubscribed', {id: props.row.id})"/></span>
5151
</b-tooltip>
5252
</b-table-column>
53+
<b-table-columnfield="scrape_stash":label="$t('Scrape Stash')"v-slot="props"width="60"sortable>
54+
<b-tooltipclass="is-info":label="$t('Enables scraping Stashdb for Actors')":delay="250" >
55+
<spanv-if="props.row.master_site_id==''"><b-switchv-model ="props.row.scrape_stash"@input="$store.dispatch('optionsSites/toggleScrapeStash', {id: props.row.id})"/></span>
56+
</b-tooltip>
57+
</b-table-column>
5358
<b-table-columnfield="options"v-slot="props"width="30">
5459
<divclass="menu">
5560
<b-dropdownaria-role="list"class="is-pulled-right"position="is-bottom-left">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp