Skip to content

Commit

Permalink
Darkroom filenames & Previews attribute (#1409)
Browse files Browse the repository at this point in the history
* Darkroom & Previews

* update filenames (requires forced update to change existing scenes)

* add has_preview attribute

* scraper: update darkroomvr filename template

DarkroomVR changed naming convention of it's downloads

* Update darkroomvr.go

---------

Co-authored-by: crwxaj <[email protected]>
  • Loading branch information
theRealKLH and crwxaj authored Oct 17, 2023
1 parent fd0c499 commit 760376a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/api/scenes.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ func (i SceneResource) getFilters(req *restful.Request, resp *restful.Response)
outAttributes = append(outAttributes, "Has Simple Cuepoints")
outAttributes = append(outAttributes, "Has HSP Cuepoints")
outAttributes = append(outAttributes, "In Trailer List")
outAttributes = append(outAttributes, "Has Preview")
outAttributes = append(outAttributes, "Has Subscription")
outAttributes = append(outAttributes, "Rating 0")
outAttributes = append(outAttributes, "Rating .5")
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 @@ -756,6 +756,8 @@ func queryScenes(db *gorm.DB, r RequestSceneList) (*gorm.DB, *gorm.DB) {
where = "exists (select 1 from scene_cuepoints where scene_cuepoints.scene_id = scenes.id and track is not null)"
case "In Trailer List":
where = "trailerlist = 1"
case "Has Preview":
where = "has_video_preview = 1"
case "Has Subscription":
where = "is_subscribed = 1"
case "Rating":
Expand Down
17 changes: 11 additions & 6 deletions pkg/scrape/darkroomvr.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,24 @@ func DarkRoomVR(wg *sync.WaitGroup, updateSite bool, knownScenes []string, out c
sc.Released = tmpDate.Format("YYYY-MM-DD")
})

// Scene ID
e.ForEach(`a[href*="signup.php?vid"]`, func(id int, e *colly.HTMLElement) {
url := e.Attr("href")
sc.SiteID = url[strings.LastIndex(url, "=")+1:]
})

// Filenames (only a guess for now, according to the sample files)
suffixes := []string{"4k", "5k", "5k10", "6k", "7k", "960p", "1440p", "psvr_1440p"}
base := e.Request.URL.Path
base = strings.TrimPrefix(base, "/video/")
for _, suffix := range suffixes {
sc.Filenames = append(sc.Filenames, "drvr-"+base+"-"+suffix+"_180_LR.mp4")
}

// Scene ID
e.ForEach(`a[href*="signup.php?vid"]`, func(id int, e *colly.HTMLElement) {
url := e.Attr("href")
sc.SiteID = url[strings.LastIndex(url, "=")+1:]
})
release := strings.TrimSuffix(e.ChildAttr(`meta[property="og:video"]`, "content"), "-ws_4k.mp4")
relname := release[strings.LastIndex(release, "/")+1:]
for _, suffix := range suffixes {
sc.Filenames = append(sc.Filenames, relname+"-"+suffix+".mp4")
}

// trailer details
sc.TrailerType = "load_json"
Expand Down

0 comments on commit 760376a

Please sign in to comment.