Skip to content

Commit

Permalink
Merge pull request #23 from ohthias/api_brainz
Browse files Browse the repository at this point in the history
Nova versão 1.2.0
  • Loading branch information
Kaique-ms27 authored Oct 1, 2024
2 parents 5f7b48a + 6d99c0a commit eba3aa0
Show file tree
Hide file tree
Showing 22 changed files with 1,778 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
import com.example.Astro.Repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.batch.BatchTransactionManager;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

@Controller
public class HomeController {
Expand Down Expand Up @@ -40,6 +45,43 @@ public String homePage(){
return "home";
}

@GetMapping("/artist")
public String artist() { return "artist";}

@GetMapping("/artist/{id}")
public String getArtistDetails(@PathVariable("id") String artistId, Model model) {
String spotifyApiUrl = "https://api.spotify.com/v1/artists/" + artistId;
RestTemplate restTemplate = new RestTemplate();

// Aqui você precisa autenticar e obter o token do Spotify.
String token = "SEU_TOKEN_DE_ACESSO_AQUI";

HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + token);
HttpEntity<String> entity = new HttpEntity<>(headers);

try {
ResponseEntity<String> response = restTemplate.exchange(spotifyApiUrl, HttpMethod.GET, entity, String.class);

if (response.getStatusCode().is2xxSuccessful()) {
// Parsear a resposta JSON para pegar os detalhes do artista
String artistDetailsJson = response.getBody();

// Adicione os detalhes à model para serem exibidos na página
model.addAttribute("artistDetails", artistDetailsJson);

return "artist"; // Nome da view (HTML) para exibir os detalhes do artista
} else {
model.addAttribute("errorMessage", "Não foi possível buscar os detalhes do artista");
return "error"; // Página de erro
}
} catch (Exception e) {
e.printStackTrace();
model.addAttribute("errorMessage", "Erro ao buscar os detalhes do artista");
return "error"; // Página de erro
}
}

@PostMapping("/register")
public String insertUser(@RequestParam String username,
@RequestParam String email,
Expand Down
Binary file modified Astro/src/main/resources/database/modelo lógico astro.mwb
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions Astro/src/main/resources/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id_user": 1,
"theme": "dark",
"playlists": {
"astPlay010220": {
"normal_play": "Playlist",
"tracks": "ast001, ast02"
}
}
}
60 changes: 60 additions & 0 deletions Astro/src/main/resources/static/css/api/drive.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.driver-popover.driverjs-theme {
background-color: var(--primary);
color: var(--white);
}

.driver-popover.driverjs-theme .driver-popover-title {
font-size: 20px;
}

.driver-popover.driverjs-theme .driver-popover-title,
.driver-popover.driverjs-theme .driver-popover-description,
.driver-popover.driverjs-theme .driver-popover-progress-text {
color: var(--white);
}

.driver-popover.driverjs-theme button {
padding-inline: 2rem;
text-align: center;
text-shadow: none;
background: transparent;
color: var(--white);
font-size: 14px;
border-radius: 8px;
}

.driver-popover.driverjs-theme button:hover {
background-color: var(--secondary);
}

.driver-popover.driverjs-theme .driver-popover-navigation-btns {
justify-content: space-between;
}

.driver-popover.driverjs-theme .driver-popover-close-btn {
color: #9b9b9b;
}

.driver-popover.driverjs-theme .driver-popover-close-btn:hover {
color: var(--white);
}

.driver-popover.driverjs-theme
.driver-popover-arrow-side-left.driver-popover-arrow {
border-left-color: var(--primary-shadow);
}

.driver-popover.driverjs-theme
.driver-popover-arrow-side-right.driver-popover-arrow {
border-right-color: var(--primary-shadow);
}

.driver-popover.driverjs-theme
.driver-popover-arrow-side-top.driver-popover-arrow {
border-top-color: var(--primary-shadow);
}

.driver-popover.driverjs-theme
.driver-popover-arrow-side-bottom.driver-popover-arrow {
border-bottom-color: var(--primary-shadow);
}
104 changes: 104 additions & 0 deletions Astro/src/main/resources/static/css/artists.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
body {
background: var(--shadow);
color: var(--font-all);
overflow-x: hidden;
}

main {
position: relative;
width: calc(100%-100px);
left: 90px;
}

.banner-artist {
margin-bottom: 1.5rem;
width: calc(100% - 100px);
position: relative;

.banner-details {
position: absolute;
bottom: 50px;
left: 50px;

h1#artist-name {
font-size: 56px;
text-shadow: 0 0 24px var(--secondary-shadow-light);
}
}
}

img#imageArtist {
width: 100%;
height: 500px;
object-position: 50% 50%;
object-fit: cover;
position: relative;
border-radius: 24px;
place-items: center;
}

.section-main-content {
width: calc(100% - 100px);
display: flex;
justify-content: space-around;
gap: 2rem;
flex: 1;
}

.hot-tracks,
.container-details-artist {
width: calc(50% - 4rem);
}

.container-details-artist {
h3#ouvintes {
font-size: 21px;
margin-bottom: 1rem;
}

.artist-biography {
font-size: 14px;
text-align: justify;
}
}

li.track-song {
margin: 8px 0;
display: flex;
justify-content: space-between;
align-items: center;

.track-song-details {
display: flex;
justify-content: flex-start;
align-items: center;
gap: 1rem;
width: calc(100% - 100px);

img.track-song-image {
width: 50px;
height: 50px;
border-radius: 4px;
object-fit: cover;
}

p.name-song {
position: relative;
width: 100%;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}

.time-code {
font-size: 12px;
font-weight: 300;
}
}

.container-songs {
display: flex;
flex-direction: column;
}
Loading

0 comments on commit eba3aa0

Please sign in to comment.