Skip to content

Commit

Permalink
manando de qlq jeito
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Magno committed May 22, 2020
1 parent f5b2a2b commit 5a55b67
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/card-letra.vue
Expand Up @@ -232,7 +232,7 @@ export default {
}
},
mounted: function () {
//console.log(this.all_frases)
console.log(this.all_frases)
}
}
</script>
15 changes: 13 additions & 2 deletions src/components/trackitem.vue
Expand Up @@ -46,8 +46,19 @@ export default {
this.$q.loading.show();
await axios.get('https://cors-anywhere.herokuapp.com/http://api.musixmatch.com/ws/1.1/track.lyrics.get?track_id='+id+'&apikey=4b7f42e95eff356453a45073f87f0954')
.then(res =>{
console.log(res)
console.log(res.data.message.body.lyrics.lyrics_body)
try{
setTimeout(async() => {
let arr = res.data.message.body.lyrics.lyrics_body.split("\n");
let music = {
orig : arr,
vet : arr
}
this.$setItem('music', music);
}, 1000);
}catch(err){
console.log(err)
}
_self.$q.loading.hide();
})
.catch(error => console.log(error))
Expand Down
39 changes: 34 additions & 5 deletions src/pages/lyrics.vue
Expand Up @@ -6,7 +6,7 @@
label="Search Lyrics"
v-if="true"
@blur="focoBusca"
@keydown="filteredItems"
@keydown.stop="handleSearch"
autofocus
>
<template v-slot:append>
Expand Down Expand Up @@ -49,6 +49,7 @@
</template>
<script>
import axios from 'axios';
import _ from 'lodash';
import TrackItem from 'src/components/trackitem'
import cardLetra from "src/components/card-letra";
import {t,falar} from 'src/plugins/translate.js'
Expand All @@ -65,23 +66,51 @@ export default {
active: false,
music: {
name : '',
vet: [],
oring: [],
score_g: false
}
}
},
mounted(){
//this.loadmusic()
this.loadmusic()
},
methods:{
focoBusca(){
//this.ListarTodos();
//this.search = false;
},
handleSearch: _.debounce(function() {
this.preApiCall();
}, 300),
preApiCall() {
if (typeof cancel != "undefined") {
cancel();
console.log("cancelled");
}
this.filteredItems();
},
async filteredItems() {
var cancel;
var CancelToken = axios.CancelToken;
var _self = this;
this.$q.loading.show();
await axios.get('https://cors-anywhere.herokuapp.com/http://api.musixmatch.com/ws/1.1/track.search?q_track='+this.busca+'&page_size=12&page=1&s_track_rating=desc&apikey=4b7f42e95eff356453a45073f87f0954')
await axios(
{
method: "get",
url: "https://cors-anywhere.herokuapp.com/http://api.musixmatch.com/ws/1.1/track.search",
cancelToken: new CancelToken(function executor(c) {
cancel = c;
}),
params: {
q_track: this.busca,
page_size:12,
page:1,
s_track_rating:"desc",
apikey:"4b7f42e95eff356453a45073f87f0954"
}
})
//'https://cors-anywhere.herokuapp.com/http://api.musixmatch.com/ws/1.1/track.search?q_track='+this.busca+'&page_size=12&page=1&s_track_rating=desc&apikey=4b7f42e95eff356453a45073f87f0954')
.then(res =>{
_self.tracks = res.data.message.body.track_list
_self.$q.loading.hide();
Expand Down Expand Up @@ -113,7 +142,7 @@ export default {
arr.forEach((val)=>{
_self.music.vet.push(
{
orig: val,
oring: val,
trad: '',
score: 0
}
Expand Down

0 comments on commit 5a55b67

Please sign in to comment.