catime 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,6 @@ jobs:
30
30
  env:
31
31
  GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
32
32
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
- CAT_ISSUE_NUMBER: '1'
34
33
  NANOBANANA_MODEL: gemini-3-pro-image-preview
35
34
  NANOBANANA_TIMEOUT: '180'
36
35
  NANOBANANA_FALLBACK_MODELS: gemini-3-pro-image-preview,gemini-2.5-flash-image
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: catime
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: AI-generated hourly cat images - a new cat every hour!
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -0,0 +1,29 @@
1
+ [
2
+ {
3
+ "number": 1,
4
+ "timestamp": "2026-01-30 05:46 UTC",
5
+ "url": "https://github.com/yazelin/ccat/releases/download/cats/cat_2026-01-30_0546_UTC.png",
6
+ "model": "gemini-2.5-flash-image"
7
+ },
8
+ {
9
+ "number": 2,
10
+ "timestamp": "2026-01-30 05:56 UTC",
11
+ "url": "https://github.com/yazelin/ccat/releases/download/cats/cat_2026-01-30_0556_UTC.png",
12
+ "model": "gemini-3-pro-image-preview",
13
+ "status": "success"
14
+ },
15
+ {
16
+ "number": 3,
17
+ "timestamp": "2026-01-30 06:23 UTC",
18
+ "url": "https://github.com/yazelin/catime/releases/download/cats/cat_2026-01-30_0623_UTC.png",
19
+ "model": "gemini-3-pro-image-preview",
20
+ "status": "success"
21
+ },
22
+ {
23
+ "number": 4,
24
+ "timestamp": "2026-01-30 06:33 UTC",
25
+ "url": "https://github.com/yazelin/catime/releases/download/cats/cat_2026-01-30_0633_UTC.png",
26
+ "model": "gemini-3-pro-image-preview",
27
+ "status": "success"
28
+ }
29
+ ]
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "catime"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "AI-generated hourly cat images - a new cat every hour!"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -9,7 +9,6 @@ from datetime import datetime, timezone
9
9
  from pathlib import Path
10
10
 
11
11
  REPO = os.environ.get("GITHUB_REPOSITORY", "yazelin/catime")
12
- ISSUE_NUMBER = os.environ.get("CAT_ISSUE_NUMBER", "1")
13
12
  RELEASE_TAG = "cats"
14
13
 
15
14
 
@@ -87,8 +86,34 @@ def upload_image_as_release_asset(image_path: str) -> str:
87
86
  return f"https://github.com/{REPO}/releases/download/{RELEASE_TAG}/{filename}"
88
87
 
89
88
 
90
- def post_issue_comment(image_url: str, number: int, timestamp: str, model_used: str):
91
- """Post a comment on the issue with the cat image."""
89
+ def get_or_create_monthly_issue(now: datetime) -> str:
90
+ """Get or create a monthly issue for cat images. Returns issue number as string."""
91
+ month_label = now.strftime("%Y-%m")
92
+ title = f"Cat Gallery - {month_label}"
93
+
94
+ # Search for existing issue with this title
95
+ result = subprocess.run(
96
+ ["gh", "issue", "list", "--repo", REPO, "--search", f'"{title}" in:title', "--json", "number,title", "--limit", "10"],
97
+ capture_output=True, text=True,
98
+ )
99
+ if result.returncode == 0:
100
+ issues = json.loads(result.stdout)
101
+ for issue in issues:
102
+ if issue["title"] == title:
103
+ return str(issue["number"])
104
+
105
+ # Create new monthly issue
106
+ result = subprocess.run(
107
+ ["gh", "issue", "create", "--repo", REPO, "--title", title, "--body", f"Auto-generated cat images for {month_label}."],
108
+ capture_output=True, text=True, check=True,
109
+ )
110
+ # Extract issue number from URL output
111
+ url = result.stdout.strip()
112
+ return url.split("/")[-1]
113
+
114
+
115
+ def post_issue_comment(issue_number: str, image_url: str, number: int, timestamp: str, model_used: str):
116
+ """Post a comment on the monthly issue with the cat image."""
92
117
  body = (
93
118
  f"## Cat #{number}\n"
94
119
  f"**Time:** {timestamp}\n"
@@ -96,7 +121,7 @@ def post_issue_comment(image_url: str, number: int, timestamp: str, model_used:
96
121
  f"![cat-{number}]({image_url})"
97
122
  )
98
123
  subprocess.run(
99
- ["gh", "issue", "comment", ISSUE_NUMBER, "--repo", REPO, "--body", body],
124
+ ["gh", "issue", "comment", issue_number, "--repo", REPO, "--body", body],
100
125
  check=True,
101
126
  )
102
127
 
@@ -180,7 +205,9 @@ def main():
180
205
  update_catlist_and_push(entry)
181
206
 
182
207
  print("Posting issue comment...")
183
- post_issue_comment(image_url, next_number, timestamp, model_used)
208
+ issue_number = get_or_create_monthly_issue(now)
209
+ print(f"Using monthly issue #{issue_number}")
210
+ post_issue_comment(issue_number, image_url, next_number, timestamp, model_used)
184
211
 
185
212
  print(f"Done! Cat #{next_number}")
186
213
 
@@ -1,3 +1,3 @@
1
1
  """catime - AI-generated hourly cat images."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.3.0"
@@ -103,9 +103,15 @@ def main():
103
103
  print(" catime yesterday List yesterday's cats")
104
104
  print(" catime 2026-01-30 List all cats from a date")
105
105
  print(" catime 2026-01-30T05 View the cat from a specific hour")
106
+ print(" catime latest View the latest cat")
106
107
  print(" catime --list List all cats")
107
108
  return
108
109
 
110
+ # latest
111
+ if args.query == "latest":
112
+ print_cat(cats[-1], len(cats))
113
+ return
114
+
109
115
  # Try as number first
110
116
  if args.query.isdigit():
111
117
  idx = int(args.query) - 1
catime-0.2.0/catlist.json DELETED
@@ -1,15 +0,0 @@
1
- [
2
- {
3
- "number": 1,
4
- "timestamp": "2026-01-30 05:46 UTC",
5
- "url": "https://github.com/yazelin/ccat/releases/download/cats/cat_2026-01-30_0546_UTC.png",
6
- "model": "gemini-2.5-flash-image"
7
- },
8
- {
9
- "number": 2,
10
- "timestamp": "2026-01-30 05:56 UTC",
11
- "url": "https://github.com/yazelin/ccat/releases/download/cats/cat_2026-01-30_0556_UTC.png",
12
- "model": "gemini-3-pro-image-preview",
13
- "status": "success"
14
- }
15
- ]
File without changes
File without changes
File without changes