Skip to content

Commit

Permalink
Fix Traxsource cover, add release date to manual tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Marekkon5 committed Sep 4, 2024
1 parent 852512d commit 41f7229
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
29 changes: 23 additions & 6 deletions client/src/components/ManualTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div class='q-pr-sm'>
<q-checkbox
:model-value="selected.includes(match)"
@update:model-value="(v) => toggleMatch(match)"
@update:model-value="(v: any) => toggleMatch(match)"
></q-checkbox>
</div>
<!-- Open URL -->
Expand Down Expand Up @@ -58,12 +58,29 @@
<span class='q-px-sm' :class='accuracyColor(match.accuracy)'><span class='text-subtitle3'>{{ (match.accuracy * 100.0).toFixed(2) }}%</span></span>
<span v-if='match.reason != "fuzzy"'>{{ match.reason.toUpperCase() }}</span>
</q-item-label>
<q-item-label class='title-span text-grey-6 text-weight-medium'>{{ match.track.artists.join(", ") }}  <span class='text-grey-4 text-weight-medium'> {{ match.track.title }}</span><span class='text-grey-4' v-if='match.track.version'> ({{ match.track.version }})</span></q-item-label>
<q-item-label class='text-grey-6' v-if='match.track.album'><q-badge outline color='grey-9'><span class='text-uppercase text-grey-6'>Album</span></q-badge>  <span class='text-caption text-weight-medium text-grey-5'>{{ match.track.album }}</span></q-item-label>
<q-item-label class='title-span text-grey-6 text-weight-medium'>{{ match.track.artists.join(", ") }}
<span class='text-grey-4 text-weight-medium'> {{ match.track.title }}</span>
<span class='text-grey-4' v-if='match.track.version'> ({{ match.track.version }})</span>
</q-item-label>
<q-item-label class='text-grey-6' v-if='match.track.album'><q-badge outline color='grey-9'><span class='text-uppercase text-grey-6'>Album</span></q-badge> <span class='text-caption text-weight-medium text-grey-5'>{{ match.track.album }}</span></q-item-label>
<q-item-label class='text-grey-6'>
<span v-if='match.track.genres.length > 0'><q-badge outline color='grey-9'><span class='text-uppercase text-grey-6'>Genre</span></q-badge>  <span class='text-caption text-weight-bold text-grey-4'>{{ match.track.genres.join(", ") }}</span></span>
<span v-if='match.track.bpm'>  <q-badge outline color='grey-9'><span class='text-uppercase text-grey-6'>BPM</span></q-badge>  <span class='text-caption monospace text-weight-medium text-grey-4'>{{ match.track.bpm }}</span></span>
<span v-if='match.track.key'>  <q-badge outline color='grey-9'><span class='text-uppercase text-grey-6'>Key</span></q-badge>  <span class='text-caption monospace text-weight-medium' :style='keyColor(match.track.key)'>{{ match.track.key }}</span></span>
<span v-if='match.track.genres.length > 0'>
<q-badge outline color='grey-9' class='q-mr-xs'><span class='text-uppercase text-grey-6'>Genre</span></q-badge>
<span class='text-caption text-weight-bold text-grey-4'>{{ match.track.genres.join(", ") }}</span>
</span>
<span v-if='match.track.bpm'>
<q-badge outline color='grey-9' class='q-mx-xs'><span class='text-uppercase text-grey-6'>BPM</span></q-badge>
<span class='text-caption monospace text-weight-medium text-grey-4'>{{ match.track.bpm }}</span>
</span>
<span v-if='match.track.key'>
<q-badge outline color='grey-9' class='q-mx-xs'><span class='text-uppercase text-grey-6'>Key</span></q-badge>
<span class='text-caption monospace text-weight-medium' :style='keyColor(match.track.key)'>{{ match.track.key }}</span>
</span>
<br>
<span v-if='match.track.release_date'>
<q-badge outline color='grey-9' class='q-mr-xs'><span class='text-uppercase text-grey-6'>Release Date</span></q-badge>
<span class='text-caption monospace text-weight-medium text-grey-4'>{{ match.track.release_date }}</span>
</span>
</q-item-label>
</q-item-section>
</q-item>
Expand Down
5 changes: 5 additions & 0 deletions crates/onetagger-platforms/src/traxsource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ impl Traxsource {
let release_date_clean = release_date_raw.replace("Pre-order for ", "");
let release_date = release_date_clean.trim().to_owned();

// Art
selector = Selector::parse("div.thumb img").unwrap();
let art_url = track_element.select(&selector).next().unwrap().attr("src").map(String::from);

// Create track
tracks.push(Track {
platform: "traxsource".to_string(),
Expand All @@ -107,6 +111,7 @@ impl Traxsource {
track_id: Some(track_id),
release_id: String::new(),
duration: duration.into(),
thumbnail: art_url,
..Default::default()
})
}
Expand Down
5 changes: 4 additions & 1 deletion crates/onetagger-ui/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,10 @@ async fn handle_message(text: &str, websocket: &mut WebSocket, context: &mut Soc
info!("Manual tag starting for path: {path:?}");
TaggerConfigs::AutoTagger(config.clone()).debug_print();

let rx = onetagger_autotag::manual_tagger(path, &config)?;
let rx = tokio::task::spawn_blocking(move || {
onetagger_autotag::manual_tagger(path, &config)
}).await.unwrap()?;

for (platform, r) in rx {
match r {
Ok(matches) => {
Expand Down

0 comments on commit 41f7229

Please sign in to comment.