Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
|
@@ -309,7 +309,7 @@ ui <- fluidPage(
|
|
| 309 |
actionButton("update", "Find Pitcher", icon("magnifying-glass"),
|
| 310 |
style = "color: #FFFFFF; background-color: #0077B6; width: 100%;"),
|
| 311 |
selectizeInput("pitcher", "Pitcher Name:", c(" ")),
|
| 312 |
-
|
| 313 |
textInput("title", "Card Title"),
|
| 314 |
actionButton("update1", "Make Card", icon("plus"),
|
| 315 |
style = "color: #FFFFFF; background-color: #0077B6; width: 100%;"),
|
|
@@ -453,18 +453,12 @@ server <- function(input, output, session) {
|
|
| 453 |
grid.newpage()
|
| 454 |
grid.draw(table_plot)
|
| 455 |
# Download and process image
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
# Try MLB URL first
|
| 463 |
-
paste0("https://midfield.mlbstatic.com/v1/people/", id, "/mlb/300?circle=false")
|
| 464 |
-
}, error = function(e) {
|
| 465 |
-
# If MLB URL fails, return MiLB URL instead
|
| 466 |
-
paste0("https://midfield.mlbstatic.com/v1/people/", id, "/milb/300?circle=false")
|
| 467 |
-
})
|
| 468 |
photo <- tempfile()
|
| 469 |
download.file(y, photo, mode = 'wb')
|
| 470 |
img <- readPNG(photo)
|
|
|
|
| 309 |
actionButton("update", "Find Pitcher", icon("magnifying-glass"),
|
| 310 |
style = "color: #FFFFFF; background-color: #0077B6; width: 100%;"),
|
| 311 |
selectizeInput("pitcher", "Pitcher Name:", c(" ")),
|
| 312 |
+
selectizeInput("league", "MLB or MiLB Photo", c("MLB", "MiLB")),
|
| 313 |
textInput("title", "Card Title"),
|
| 314 |
actionButton("update1", "Make Card", icon("plus"),
|
| 315 |
style = "color: #FFFFFF; background-color: #0077B6; width: 100%;"),
|
|
|
|
| 453 |
grid.newpage()
|
| 454 |
grid.draw(table_plot)
|
| 455 |
# Download and process image
|
| 456 |
+
if(input$league == "MLB"){
|
| 457 |
+
y <- paste("https://midfield.mlbstatic.com/v1/people/","/mlb/300?circle=false",sep = id)
|
| 458 |
+
} else {
|
| 459 |
+
y <- paste("https://midfield.mlbstatic.com/v1/people/","/milb/300?circle=false",sep = id)
|
| 460 |
+
}
|
| 461 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
photo <- tempfile()
|
| 463 |
download.file(y, photo, mode = 'wb')
|
| 464 |
img <- readPNG(photo)
|