bandcamp-discover 0.7.1 → 0.7.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f788095223220ca96084269592bcfacc5ffcd11bdc4ccc27c43312f9a4f019e
4
- data.tar.gz: d8428295e7b665d2ae448f34f4a84b74bd1290357499d6266e6859fe9b60b7fd
3
+ metadata.gz: '094dffa15caad4bbabef29bd4b3d87789425e4736c2d06461d6917efc8fe600d'
4
+ data.tar.gz: de1a1d20425f1ecb984878b10541208849abbf7300cd46f80834e5197730ef1c
5
5
  SHA512:
6
- metadata.gz: 97041bbe3141a01e73712b5fa8f1a175ce437ad8ec6f9c38a09447c21e828af10390a248a508d63048447c982b2ac27fcef24bd1f82f285421537aaeb0acbd5a
7
- data.tar.gz: cd751e7ed3dd432b66e3988c89277cf6b91363193dd3a174f5803a2d34e620ad0ec0a2ad347b4c8636c19d263fedde9beb114d9a7594f7182922bc91bca35fb2
6
+ metadata.gz: a6a057d4869da1039b00b9c2ffd5b4019123c4ee055cf392fd3fefc4b8fa7f427d2346081554e960a5416c95b52d507d9244912112dada5d0ddedec06820ac33
7
+ data.tar.gz: ae37374ebc23a193aedaed32cd741f01af048502cb9853596d6e9bf1438ec2040fcacdaee67f226951accf6bd9d674191faf8667f5bf86cc3b9216d84a408bbc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bandcamp-discover (0.7.1)
4
+ bandcamp-discover (0.7.2)
5
5
  async
6
6
  base64
7
7
  concurrent-ruby
@@ -3,6 +3,10 @@ require_relative "configuration"
3
3
 
4
4
  module BandcampDiscover
5
5
  class Analyzer
6
+ # The model replied, but not with the object asked for. Carries the reply so
7
+ # a failed job says what was said instead of where JSON.parse gave up.
8
+ class NoAnswer < StandardError; end
9
+
6
10
  # A per-call model still wins over the configured one so existing callers
7
11
  # keep their behaviour.
8
12
  def initialize(description, model = nil, credits: [])
@@ -17,10 +21,14 @@ module BandcampDiscover
17
21
  @description.to_s.match?(/label|platform|records/i)
18
22
  end
19
23
 
24
+ # The prompt says to default to false; a reply that never reached an answer
25
+ # is that default, not a reason to lose the whole scrape.
20
26
  def accepts_demos?
21
27
  return false unless llm?
22
28
 
23
29
  ask(BandcampDiscover.configuration.demos_prompt)
30
+ rescue NoAnswer
31
+ false
24
32
  end
25
33
 
26
34
  private
@@ -50,6 +58,8 @@ module BandcampDiscover
50
58
  # object inside a ```json fence, and some prepend a sentence.
51
59
  def answer(content)
52
60
  JSON.parse(content[/\{.*\}/m] || content)
61
+ rescue JSON::ParserError
62
+ raise NoAnswer, "model replied without a JSON object: #{content.to_s.strip[0, 200].inspect}"
53
63
  end
54
64
 
55
65
  # The bio alone cannot tell one person releasing under aliases from a
@@ -1,3 +1,3 @@
1
1
  module BandcampDiscover
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -112,6 +112,19 @@ class AnalyzerTest < Minitest::Test
112
112
  assert Analyzer.new("bio").label?
113
113
  end
114
114
 
115
+ def test_label_raises_a_named_error_carrying_a_reply_without_an_object
116
+ OpenRouter::Client.raw = "I don't see enough information to decide."
117
+
118
+ error = assert_raises(BandcampDiscover::Analyzer::NoAnswer) { Analyzer.new("bio").label? }
119
+ assert_includes error.message, "I don't see enough information"
120
+ end
121
+
122
+ def test_demos_defaults_to_false_on_a_reply_without_an_object
123
+ OpenRouter::Client.raw = "I don't see any mention of demos here."
124
+
125
+ refute Analyzer.new("bio").accepts_demos?
126
+ end
127
+
115
128
  def test_parses_the_answer
116
129
  OpenRouter::Client.answer = false
117
130
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bandcamp-discover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian RUbisch
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-09-03 00:00:00.000000000 Z
10
+ date: 2026-09-04 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake