Skip to content

Commit a313a93

Browse files
authored
Fix create_movie() deprecation in TMDBMarkers Plugin (#607)
1 parent 279c985 commit a313a93

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

plugins/TPDBMarkers/TPDBMarkers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ settings:
1818
displayName: Disable the Scene Markers hook
1919
type: BOOLEAN
2020
createMovieFromScene:
21-
displayName: Create Movie from scene
22-
description: If there is a Movie linked to the scene in the timestamp.trade database automatically create a movie in stash with that info
21+
displayName: Create Group from scene
22+
description: If there is a Group linked to the scene in the timestamp.trade database automatically create a group in stash with that info
2323
type: BOOLEAN
2424
runOnScenesWithMarkers:
2525
displayName: Run on scenes that already have markers.

plugins/TPDBMarkers/tpdbMarkers.py

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ def processScene(scene):
5858
mp.import_scene_markers(stash, markers, scene["id"], 15)
5959
elif (len(scene["scene_markers"]) == 0 or settings["mergeMarkers"]):
6060
mp.import_scene_markers(stash, markers, scene["id"], 15)
61-
# skip if there is already a movie linked
62-
if settings["createMovieFromScene"] and len(scene.get("movies", [])) == 0:
63-
movies=[]
64-
for m in data["movies"]:
65-
movie=processMovie(m)
66-
if movie:
67-
movies.append({"movie_id": movie["id"],"scene_index":None})
68-
log.debug(movies)
69-
if len(movies) > 0:
70-
stash.update_scene({'id':scene["id"],"movies":movies})
61+
# skip if there is already a group linked
62+
if settings["createMovieFromScene"] and len(scene.get("groups", [])) == 0:
63+
groups=[]
64+
for g in data["groups"]:
65+
group=processGroup(g)
66+
if group:
67+
groups.append({"group_id": group["id"],"scene_index":None})
68+
log.debug(groups)
69+
if len(groups) > 0:
70+
stash.update_scene({'id':scene["id"],"groups":groups})
7171
else:
7272
log.error('bad response from tpdb: %s' % (res.status_code,))
7373

@@ -127,45 +127,45 @@ def processAll():
127127
log.progress((i / count))
128128
time.sleep(1)
129129

130-
def processMovie(m):
131-
log.debug(m)
132-
log.debug(m.keys())
133-
# check if the movie exists with the url, then match to the scene
134-
sm = stash.find_groups(
130+
def processGroup(g):
131+
log.debug(g)
132+
log.debug(g.keys())
133+
# check if the group exists with the url, then match to the scene
134+
sg = stash.find_groups(
135135
f={
136136
"url": {
137137
"modifier": "EQUALS",
138-
"value": m["url"],
138+
"value": g["url"],
139139
}
140140
}
141141
)
142-
log.debug("sm: %s" % (sm,))
143-
if len(sm) >0:
144-
return sm[0]
145-
# find the movie by name
146-
sm=stash.find_groups(q=m['title'])
147-
for mov in sm:
148-
if mov['name']==m['title']:
149-
return mov
150-
151-
152-
# just create the movie with the details from tpdb
153-
new_movie={
154-
'name': m['title'],
155-
'date': m['date'],
156-
'synopsis': m['description'],
157-
'front_image': m['image'],
158-
'back_image': m['back_image'],
159-
'urls': [m['url']],
142+
log.debug("sg: %s" % (sg,))
143+
if len(sg) >0:
144+
return sg[0]
145+
# find the group by name
146+
sg=stash.find_groups(q=g['title'])
147+
for grp in sg:
148+
if grp['name']==g['title']:
149+
return grp
150+
151+
152+
# just create the group with the details from tpdb
153+
new_group={
154+
'name': g['title'],
155+
'date': g['date'],
156+
'synopsis': g['description'],
157+
'front_image': g['image'],
158+
'back_image': g['back_image'],
159+
'urls': [g['url']],
160160
}
161-
if m['site']:
162-
studio=stash.find_studio(m['site'],create=True)
161+
if g['site']:
162+
studio=stash.find_studio(g['site'],create=True)
163163
if studio:
164-
new_movie['studio_id']=studio['id']
164+
new_group['studio_id']=studio['id']
165165

166-
mov=stash.create_movie(new_movie)
167-
log.debug(mov)
168-
return mov
166+
grp=stash.create_group(new_group)
167+
log.debug(grp)
168+
return grp
169169

170170

171171

0 commit comments

Comments
 (0)