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

Commit5d2fb4a

Browse files
authored
fix: Move multiple sites to Custom List to allow for them to be used as alternative sites (#1876)
* Draft PS-Porn migration to CustomDue to a URL change on SLR it is needed to update the URL. Chose to migrate it to a custom scraper in addition to fix the URL. Will remove the scraper from the List if no scenes have been found for the PS-Porn scraper* Testing* Working ready for PRSome final testing to due. Adds some sites that have mains available so users may set them to alts* Go Fmt* Clean Up* ImprovmentsMigrates any MasterSiteIds to its new custom id.* Go Fmt* Add check for existing siteIn case user create a custom site due to a URL change on the parent site. We shouldn't also create our own entry. This will check to ensure it doesn't exists and will only add if the new id isn't present* Clean UP* More Clean Up* Optimization* Go Fmt
1 parent8504091 commit5d2fb4a

File tree

4 files changed

+89
-30
lines changed

4 files changed

+89
-30
lines changed

‎pkg/config/scraper_list.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,77 @@ func SetSiteId(configList *[]ScraperConfig, customId string) {
156156
}
157157

158158
}
159+
160+
funcMigrateFromOfficalToCustom(idstring,urlstring,namestring,companystring,avatarUrlstring,customIdstring,suffixstring)error {
161+
162+
db,_:=models.GetDB()
163+
deferdb.Close()
164+
165+
varscenes []models.Scene
166+
db.Where("scraper_id = ?",id).Find(&scenes)
167+
168+
iflen(scenes)!=0 {
169+
common.Log.Infoln(name+` Scenes found migration needed`)
170+
171+
// Update scene data to reflect change
172+
db.Model(&models.Scene{}).Where("scraper_id = ?",id).Update("needs_update",true)
173+
174+
// Determine the new id from the URL using the same template as the scraper list code
175+
tmp:=strings.TrimRight(url,"/")
176+
newId:=strings.ToLower(tmp[strings.LastIndex(tmp,"/")+1:])+`-`+customId
177+
178+
varscraperConfigScraperList
179+
scraperConfig.Load()
180+
181+
// Data taken from offical scraper list
182+
scraper:=ScraperConfig{URL:url,Name:name,Company:company,AvatarUrl:avatarUrl}
183+
184+
// Update any alt sites that is using the old id to the new id
185+
updateMasterSite:=func(sites []ScraperConfig) {
186+
foridx,site:=rangesites {
187+
ifsite.MasterSiteId==id {
188+
sites[idx].MasterSiteId=newId
189+
}
190+
}
191+
}
192+
193+
updateMasterSite(scraperConfig.CustomScrapers.SlrScrapers)
194+
updateMasterSite(scraperConfig.CustomScrapers.PovrScrapers)
195+
updateMasterSite(scraperConfig.CustomScrapers.VrpornScrapers)
196+
updateMasterSite(scraperConfig.CustomScrapers.VrphubScrapers)
197+
198+
// Append our scraper to the the Custom Scraper list unless its new id already exists
199+
switchcustomId {
200+
case"slr":
201+
ifCheckMatchingSite(scraper,scraperConfig.CustomScrapers.SlrScrapers)==false {
202+
scraperConfig.CustomScrapers.SlrScrapers=append(scraperConfig.CustomScrapers.SlrScrapers,scraper)
203+
}
204+
case"povr":
205+
ifCheckMatchingSite(scraper,scraperConfig.CustomScrapers.PovrScrapers)==false {
206+
scraperConfig.CustomScrapers.PovrScrapers=append(scraperConfig.CustomScrapers.PovrScrapers,scraper)
207+
}
208+
case"vrporn":
209+
ifCheckMatchingSite(scraper,scraperConfig.CustomScrapers.VrpornScrapers)==false {
210+
scraperConfig.CustomScrapers.VrpornScrapers=append(scraperConfig.CustomScrapers.VrpornScrapers,scraper)
211+
}
212+
case"vrphub":
213+
ifCheckMatchingSite(scraper,scraperConfig.CustomScrapers.VrphubScrapers)==false {
214+
scraperConfig.CustomScrapers.VrphubScrapers=append(scraperConfig.CustomScrapers.VrphubScrapers,scraper)
215+
}
216+
}
217+
218+
// Save the new list file
219+
fName:=filepath.Join(common.AppDir,"scrapers.json")
220+
list,_:=json.MarshalIndent(scraperConfig,""," ")
221+
os.WriteFile(fName,list,0644)
222+
223+
common.Log.Infoln(name+` migration complete. Please restart XBVR and run `+name+` scraper to complete migration`)
224+
225+
}else {
226+
227+
common.Log.Infoln(`No `+name+` Scenes found no migration needed. Removing DB entry`)
228+
229+
}
230+
231+
returndb.Delete(&models.Site{ID:id}).Error
232+
}

‎pkg/config/scrapers.json

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,6 @@
175175
"company":"",
176176
"avatar_url":""
177177
},
178-
{
179-
"url":"https://www.sexlikereal.com/studios/fuckpassvr",
180-
"name":"FuckPassVR",
181-
"company":"FuckPassVR",
182-
"avatar_url":"https://cdn-vr.sexlikereal.com/images/studio_creatives/logotypes/1/352/logo_crop_1635153994.png"
183-
},
184178
{
185179
"url":"https://www.sexlikereal.com/studios/heathering",
186180
"name":"Heathering",
@@ -319,12 +313,6 @@
319313
"company":"POV Central",
320314
"avatar_url":"https://mcdn.vrporn.com/files/20191125091909/POVCentralLogo.jpg"
321315
},
322-
{
323-
"url":"https://www.sexlikereal.com/studios/ps-porn",
324-
"name":"PS-Porn",
325-
"company":"Paula Shy",
326-
"avatar_url":"https://mcdn.vrporn.com/files/20201221090642/PS-Porn-400x400.jpg"
327-
},
328316
{
329317
"url":"https://www.sexlikereal.com/studios/realhotvr",
330318
"name":"RealHotVR",
@@ -502,21 +490,6 @@
502490
"avatar_url":"https://mcdn.vrporn.com/files/20200421094123/vrclubz_logo_NEW-400x400_webwhite.png"
503491
}
504492
],
505-
"vrphub": [
506-
{
507-
"id":"vrphub-vrhush",
508-
"url":"https://vrphub.com/category/vr-hush",
509-
"name":"VRHush",
510-
"company":"VRHush",
511-
"avatar_url":"https://cdn-nexpectation.secure.yourpornpartner.com/sites/vrh/favicon/apple-touch-icon-180x180.png"
512-
},
513-
{
514-
"id":"vrphub-stripzvr",
515-
"url":"https://vrphub.com/category/stripzvr/",
516-
"name":"StripzVR - VRP Hub",
517-
"company":"StripzVR",
518-
"avatar_url":"https://www.stripzvr.com/wp-content/uploads/2018/09/cropped-favicon-192x192.jpg"
519-
}
520-
]
493+
"vrphub": []
521494
}
522495
}

‎pkg/migrations/migrations.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,18 @@ func Migrate() {
20722072
returnnil
20732073
},
20742074
},
2075+
{
2076+
ID:"0081-Offical-Site-Removals-With-Main-Site-Aviable",
2077+
Migrate:func(tx*gorm.DB)error {
2078+
2079+
err:=config.MigrateFromOfficalToCustom("ps-porn","https://www.sexlikereal.com/studios/ps-porn-vr","PS-Porn","Paula Shy","https://mcdn.vrporn.com/files/20201221090642/PS-Porn-400x400.jpg","slr","(SLR)")
2080+
err=config.MigrateFromOfficalToCustom("fuckpassvr","https://www.sexlikereal.com/studios/fuckpassvr","FuckPassVR","FuckPassVR","https://cdn-vr.sexlikereal.com/images/studio_creatives/logotypes/1/352/logo_crop_1635153994.png","slr","(SLR)")
2081+
err=config.MigrateFromOfficalToCustom("vrphub-vrhush","https://vrphub.com/category/vr-hush","VRHush","VRHush","https://cdn-nexpectation.secure.yourpornpartner.com/sites/vrh/favicon/apple-touch-icon-180x180.png","vrphub","(VRP Hub)")
2082+
err=config.MigrateFromOfficalToCustom("vrphub-stripzvr","https://vrphub.com/category/stripzvr/","StripzVR - VRP Hub","StripzVR","https://www.stripzvr.com/wp-content/uploads/2018/09/cropped-favicon-192x192.jpg","vrphub","(VRP Hub)")
2083+
returnerr
2084+
2085+
},
2086+
},
20752087
})
20762088

20772089
iferr:=m.Migrate();err!=nil {

‎pkg/scrape/vrphub.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ func init() {
273273
scrapers.Load()
274274
for_,scraper:=rangescrapers.XbvrScrapers.VrphubScrapers {
275275
switchscraper.ID {
276-
case"vrphub-vrhush":
276+
case"vr-hush-vrphub":
277277
addVRPHubScraper(scraper.ID,scraper.Name,scraper.Company,scraper.AvatarUrl,false,scraper.URL,vrhushCallback)
278-
case"vrphub-stripzvr":
278+
case"stripzvr-vrphub":
279279
addVRPHubScraper(scraper.ID,scraper.Name,scraper.Company,scraper.AvatarUrl,false,scraper.URL,stripzvrCallback)
280280
}
281281
addVRPHubScraper(scraper.ID,scraper.Name,scraper.Company,scraper.AvatarUrl,false,scraper.URL,noop)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp