Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XBVR scraper so that it actually works... #1259

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions scrapers/xbvrdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,57 @@
docker cp xbvr:/root/.config/xbvr/main.db xbvr.db
This script needs python3 and sqlite3
'''

def lookup_scene(id):
c=conn.cursor()
c.execute('select title,synopsis,site,cover_url,scene_url,date(release_date, "localtime") from scenes where id=?',(id,))
c.execute('SELECT title,synopsis,site,cover_url,scene_url,date(release_date, "localtime"),scene_id FROM scenes WHERE id=?',(id,))
row=c.fetchone()
res={}
res['title']=row[0]
res['details']=row[1]
res['studio']={"name":row[2]}
res['studio']={'name': row[2]}
res['image']=row[3]
res['url']=row[4]
res['date']=row[5]
c.execute("select tags.name from scene_tags,tags where scene_tags.tag_id=tags.id and scene_tags.scene_id=? ;",(id,))
row = c.fetchall()
res['tags']=[{"name":x[0]} for x in row]
c.execute("select actors.name from scene_cast,actors where actors.id=scene_cast.actor_id and scene_cast.scene_id=? ;",(id,))
res['code']=row[6]
tags = c.execute("SELECT tags.name FROM scene_tags, tags WHERE scene_tags.tag_id=tags.id AND scene_tags.scene_id=? ;", (id,))
tag_names = [x[0] for x in tags]
# Conditional Tag Related Stuff Goes Here
# Check if the "JAVR" tag is present in the tags list
if 'javr' in tag_names:
# If so, append the "Censored" and "JAV" tags as well
# anything scraped via "JAVR" in XBVR is automatically both Censored and JAV!
tag_names.append('JAV')
tag_names.append('Censored')
else:
# "JAVR" is now an alias to "Virtual Reality" in StashDB
tag_names.append('Virtual Reality')
#NaughtyAmerica Studio/Tag Mapping - WIP - looking for a better/less "babby's first Python script filled with if statements" way to do this
if row[2] == "NaughtyAmerica VR":
if '2 chicks same time' in tag_names:
res['studio'] = {'name': '2 Chicks Same Time'}
if 'after school' in tag_names:
res['studio'] = {'name': 'After School'}
if 'american daydreams' in tag_names:
res['studio'] = {'name': 'American Daydreams'}
if 'pse porn star experience' in tag_names:
res['studio'] = {'name': 'PSE Porn Star Experience'}
res['tags'] = [{"name": x} for x in tag_names]
c.execute("SELECT actors.name FROM scene_cast,actors WHERE actors.id=scene_cast.actor_id AND scene_cast.scene_id=? ;",(id,))
row = c.fetchall()
res['performers']=[{"name":x[0]} for x in row]
return res

def find_scene_id(title):
c = conn.cursor()
c.execute('SELECT scene_id FROM files WHERE filename=?', (title,))
c.execute('SELECT scene_id FROM files WHERE filename LIKE ?', (title,))
id=c.fetchone()
if id == None:
c.execute('SELECT id FROM scenes WHERE scene_id=?', (title,))
c.execute('SELECT scene_id FROM files WHERE filename LIKE ?', (title+'____',))
id=c.fetchone()
if id is not None:
return id[0]
c.execute('SELECT id FROM scenes WHERE scene_id LIKE ?', (title,))
id = c.fetchone()
if id is not None:
return id[0]
Expand All @@ -48,7 +74,7 @@ def find_scene_id(title):
if 'originals' in t:
t.remove('originals')
title='%'.join(t)+'%'
c.execute('select id from scenes where title like ?',(title+'%',))
c.execute('SELECT id FROM scenes WHERE title LIKE ?',(title+'%',))
id=c.fetchone()
if id is not None:
return id[0]
Expand All @@ -60,9 +86,10 @@ def find_scene_id(title):
print("Error, the sqlite database xbvr.db does not exist in the scrapers directory.",file=sys.stderr)
print("Copy this database from the docker container and give it the name xbvr.db",file=sys.stderr)
print("docker cp xbvr:/root/.config/xbvr/main.db xbvr.db",file=sys.stderr)
print("for Windows users:",file=sys.stderr)
print("copy %APPDATA%\xbvr\main.db xbvr.db",file=sys.stderr)
exit(1)


conn = sqlite3.connect('xbvr.db',detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)

if sys.argv[1] == "query":
Expand Down
2 changes: 1 addition & 1 deletion scrapers/xbvrdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ galleryByFragment:
- python3
- xbvrdb.py
- gallery_query
# Last Updated March 13, 2022
# Last Updated January 31, 2022