mirror of
https://github.com/pisto/oggify
synced 2024-11-21 21:57:29 +00:00
Also give album name and spotify id to the helper script
This commit is contained in:
parent
ffd5b407e9
commit
348f885920
@ -21,7 +21,7 @@ use librespot_core::authentication::Credentials;
|
||||
use librespot_core::config::SessionConfig;
|
||||
use librespot_core::session::Session;
|
||||
use librespot_core::spotify_id::SpotifyId;
|
||||
use librespot_metadata::{Artist, FileFormat, Metadata, Track};
|
||||
use librespot_metadata::{Artist, FileFormat, Metadata, Track, Album};
|
||||
use regex::Regex;
|
||||
use scoped_threadpool::Pool;
|
||||
use tokio_core::reactor::Core;
|
||||
@ -96,9 +96,10 @@ fn main() {
|
||||
std::fs::write(&fname, &decrypted_buffer[0xa7..]).expect("Cannot write decrypted track");
|
||||
info!("Filename: {}", fname);
|
||||
} else {
|
||||
let album = core.run(Album::get(&session, track.album)).expect("Cannot get album metadata");
|
||||
let mut cmd = Command::new(args[3].to_owned());
|
||||
cmd.stdin(Stdio::piped());
|
||||
cmd.arg(track.name).args(artists_strs.iter());
|
||||
cmd.arg(id.to_base62()).arg(track.name).arg(album.name).args(artists_strs.iter());
|
||||
let mut child = cmd.spawn().expect("Could not run helper program");
|
||||
let pipe = child.stdin.as_mut().expect("Could not open helper stdin");
|
||||
pipe.write_all(&decrypted_buffer[0xa7..]).expect("Failed to write to stdin");
|
||||
|
13
tag_ogg
13
tag_ogg
@ -2,12 +2,17 @@
|
||||
|
||||
set -e
|
||||
|
||||
fname=$(echo "${2} - ${1}.ogg" | tr '/' - | tr '\0' ' ')
|
||||
fname=$(echo "${4} - ${2}.ogg" | tr '/' - | tr '\0' ' ')
|
||||
cat > "$fname"
|
||||
{
|
||||
echo "TITLE=${1}" | tr '\n' ' '
|
||||
shift
|
||||
echo "SPOTIFY_ID=${1}"
|
||||
title=$(tr '\n' ' ' <<< "${2}")
|
||||
album=$(tr '\n' ' ' <<< "${3}")
|
||||
echo "TITLE=${title}"
|
||||
echo "ALBUM=${album}"
|
||||
shift 3
|
||||
for artist in "$@"; do
|
||||
echo "ARTIST=${artist}" | tr '\n' ' '
|
||||
artist=$(tr '\n' ' ' <<< "${artist}")
|
||||
echo "ARTIST=${artist}"
|
||||
done
|
||||
} | vorbiscomment -a "$fname"
|
||||
|
Loading…
Reference in New Issue
Block a user