Spieltag-Assistent füllt „Locations Taken and Shown“ immer aus
- Ortsdetail (Stadion), Stadt, Bundesland, Land, Ländercode und Weltregion kommen aus dem Spielort und werden immer angewendet – auch wenn die Basis-Vorlage den Block nicht hat - Spielort hat eine Weltregion (Standard „Europa“), editierbar im Assistenten - Venue tolerant gelesen (gespeicherte Stadien bleiben erhalten) - Agentur-Check: der Block lässt sich als Pflichtfelder auswählen („… (Aufnahmeort)“) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
1 parent
278967a358
commit
3a2c8253ac
4 files changed
+43
-12
No files matched your search
@@ -367,7 +367,9 @@ struct PreflightSettings: View {
|
||||
/// fields offered as "Pflichtfeld"
|
||||
private static let candidates = ["caption", "headline", "creator", "copyright", "credit", "source", "event",
|
||||
"city", "sublocation", "state", "country", "countryCode", "dateCreated",
|
||||
"keywords", "objectName", "captionWriter"]
|
||||
"keywords", "objectName", "captionWriter",
|
||||
// "Locations Taken and Shown" (many agencies require it)
|
||||
"lcSublocation", "lcCity", "lcState", "lcCountry", "lcCountryCode", "lcWorldRegion"]
|
||||
|
||||
private var opts: Binding<PreflightOptions> { $state.settings.preflight }
|
||||
|
||||
@@ -377,7 +379,7 @@ struct PreflightSettings: View {
|
||||
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())], alignment: .leading, spacing: 8) {
|
||||
ForEach(Self.candidates, id: \.self) { id in
|
||||
if let f = IPTCField.byID[id] {
|
||||
Toggle(f.label, isOn: Binding(
|
||||
Toggle(f.section == .locationCreated ? "\(f.label) (Aufnahmeort)" : f.label, isOn: Binding(
|
||||
get: { state.settings.preflight.requiredFields.contains(id) },
|
||||
set: { on in
|
||||
state.settings.preflight.requiredFields.removeAll { $0 == id }
|
||||
|
||||
@@ -315,6 +315,8 @@ struct SpieltagView: View {
|
||||
TextField("Bundesland", text: v.state).textFieldStyle(.roundedBorder)
|
||||
TextField("Land", text: v.country).textFieldStyle(.roundedBorder)
|
||||
TextField("DEU", text: v.countryCode).textFieldStyle(.roundedBorder).frame(width: 56)
|
||||
TextField("Weltregion", text: v.worldRegion).textFieldStyle(.roundedBorder).frame(width: 90)
|
||||
.help("Locations Taken and Shown → World Region")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,27 @@ public struct Venue: Codable, Hashable, Sendable {
|
||||
public var state: String = "" // "Niedersachsen"
|
||||
public var country: String = "Deutschland"
|
||||
public var countryCode: String = "DEU"
|
||||
/// "Locations Taken and Shown" → World Region (agencies require the complete block)
|
||||
public var worldRegion: String = "Europa"
|
||||
|
||||
public init(name: String = "", city: String = "", state: String = "", country: String = "Deutschland", countryCode: String = "DEU") {
|
||||
public init(name: String = "", city: String = "", state: String = "", country: String = "Deutschland",
|
||||
countryCode: String = "DEU", worldRegion: String = "Europa") {
|
||||
self.name = name; self.city = city; self.state = state; self.country = country; self.countryCode = countryCode
|
||||
self.worldRegion = worldRegion
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey { case name, city, state, country, countryCode, worldRegion }
|
||||
|
||||
/// Tolerant: venues saved before a field existed keep their stadium.
|
||||
public init(from decoder: Decoder) throws {
|
||||
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||
let d = Venue()
|
||||
name = (try? c.decode(String.self, forKey: .name)) ?? d.name
|
||||
city = (try? c.decode(String.self, forKey: .city)) ?? d.city
|
||||
state = (try? c.decode(String.self, forKey: .state)) ?? d.state
|
||||
country = (try? c.decode(String.self, forKey: .country)) ?? d.country
|
||||
countryCode = (try? c.decode(String.self, forKey: .countryCode)) ?? d.countryCode
|
||||
worldRegion = (try? c.decode(String.self, forKey: .worldRegion)) ?? d.worldRegion
|
||||
}
|
||||
|
||||
public var isEmpty: Bool { name.isEmpty && city.isEmpty }
|
||||
@@ -283,7 +301,9 @@ public enum SpieltagGenerator {
|
||||
}
|
||||
|
||||
public static let generatedFields = ["headline", "event", "caption", "city", "sublocation", "state", "country",
|
||||
"countryCode", "keywords", "dateCreated"]
|
||||
"countryCode", "keywords", "dateCreated",
|
||||
// "Locations Taken and Shown" – agencies reject images without it
|
||||
"lcSublocation", "lcCity", "lcState", "lcCountry", "lcCountryCode", "lcWorldRegion"]
|
||||
|
||||
/// The IPTC template of the match: base template (creator, copyright, …) + everything generated.
|
||||
public static func makeTemplate(match: MatchPlan, home: TeamProfile, away: TeamProfile, competition: Competition?,
|
||||
@@ -303,14 +323,14 @@ public enum SpieltagGenerator {
|
||||
v.text["countryCode"] = match.venue.countryCode.isEmpty ? nil : match.venue.countryCode
|
||||
v.lists["keywords"] = keywords(match: match, home: home, away: away, competition: competition, patterns: patterns, ctx: ctx)
|
||||
v.text["dateCreated"] = "{capturetime}"
|
||||
// "Location created" only if the base template uses it – then it must not keep the old stadium
|
||||
if t.values.text["lcCity"] != nil || t.values.text["lcSublocation"] != nil {
|
||||
v.text["lcCity"] = match.venue.city
|
||||
v.text["lcSublocation"] = match.venue.name
|
||||
v.text["lcState"] = match.venue.state
|
||||
v.text["lcCountry"] = match.venue.country
|
||||
v.text["lcCountryCode"] = match.venue.countryCode
|
||||
}
|
||||
// "Locations Taken and Shown" (Location Created) – always filled, the agency needs the complete block
|
||||
func set(_ id: String, _ value: String) { v.text[id] = value.isEmpty ? nil : value }
|
||||
set("lcSublocation", match.venue.name)
|
||||
set("lcCity", match.venue.city)
|
||||
set("lcState", match.venue.state)
|
||||
set("lcCountry", match.venue.country)
|
||||
set("lcCountryCode", match.venue.countryCode)
|
||||
set("lcWorldRegion", match.venue.worldRegion.isEmpty ? (t.values.text["lcWorldRegion"] ?? "") : match.venue.worldRegion)
|
||||
t.values = v
|
||||
t.dateFromCapture = true
|
||||
if var applied = t.appliedFields {
|
||||
|
||||
Reference in new issue
Block a user