Skip to content

WIP Add support for end seconds #521

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
31 changes: 29 additions & 2 deletions plugins/timestampTrade/timestampTrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,19 @@ def processSceneTimestamTrade(s):
previous = {"title": "", "seconds": -1}
for m in data["markers"]:


marker = {
"seconds": m["start_time"] / 1000,
"primary_tag": None,
"tags": [],
"title": m["name"],
}

# Add end time if setting is enabled and data is available
if settings.get("useMarkerEndTimes", False) and "end_time" in m and m["end_time"]:
marker["end_seconds"] = m["end_time"] / 1000
log.debug(f"Added end time: {marker['end_seconds']} seconds for marker '{marker['title']}'")

if settings["addTsTradeTag"]:
marker["tags"].append(int(getTag("[Timestamp]")))

Expand Down Expand Up @@ -567,7 +574,7 @@ def submitScene(query):
}
movies{
scene_index
movie{
movie{
name
url
date
Expand Down Expand Up @@ -613,6 +620,7 @@ def submitScene(query):
scene_markers{
title
seconds
end_seconds
primary_tag{
name
}
Expand Down Expand Up @@ -661,7 +669,7 @@ def submitScene(query):
}
groups{
scene_index
group{
group{
name
urls
date
Expand Down Expand Up @@ -710,6 +718,24 @@ def submitScene(query):
"md5": row[4],
}
)
# Process markers to include end_seconds
processed_markers = []
for marker in s["scene_markers"]:
processed_marker = {
"title": marker["title"],
"start_time": marker["seconds"] * 1000, # Convert to milliseconds
"tag_name": marker["primary_tag"]["name"]
}

# Include end time if available
if "end_seconds" in marker and marker["end_seconds"]:
processed_marker["end_time"] = marker["end_seconds"] * 1000 # Convert to milliseconds
log.debug(f"Including end time: {processed_marker['end_time']} ms for marker '{marker['title']}'")

processed_markers.append(processed_marker)

# Add processed markers to submission data
s["markers"] = processed_markers
s.pop("id")
log.debug(s)
request_s.post("https://timestamp.trade/submit-stash", json=s)
Expand Down Expand Up @@ -1517,3 +1543,4 @@ def excluded_marker_tag(marker):
if _type == "Image.Create.Post":
img = stash.find_image(image_in=_id)
processImages(img)

4 changes: 4 additions & 0 deletions plugins/timestampTrade/timestampTrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ settings:
mergeMarkers:
displayName: Merge Markers
type: BOOLEAN
useMarkerEndTimes:
displayName: Use marker end times
description: When available, import end times for markers from timestamp.trade
type: BOOLEAN

hooks:
- name: Add Marker to Scene
Expand Down