dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 7ade09c51dc69df1e520be2082d55b64534df0d7
parent f6f4ee5396ea0c0b0291b62bc1e2e4d2af431b79
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Fri, 13 Jan 2017 18:13:11 +0100

Added in the possibility of manual override to itunes_style_getter

If you don't like what the program found, you can enter your own genre
Diffstat:
Mitunes_style_getter | 21++++++++++++++++-----
Mitunes_style_getter_helper.rb | 4+++-
2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/itunes_style_getter b/itunes_style_getter @@ -1,6 +1,17 @@ #!/bin/bash -artist=`osascript -e "tell application \"iTunes\" to return artist of selection"` -album=`osascript -e "tell application \"iTunes\" to return album of selection"` -style=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb \"$artist\" \"$album\") -echo $style -osascript -e "tell application \"iTunes\" to set the genre of every track whose album is \"$album\" to \"$style\"" > /dev/null +artist=`osascript -e "tell application \"iTunes\" to return artist of selection"`; +album=`osascript -e "tell application \"iTunes\" to return album of selection"`; +style=$(ruby /Users/alex/.bin/itunes_style_getter_helper.rb \"$artist\" \"$album\"); +echo $style; +echo "Manual override?"; +select yn in "Yes" "No"; do + case $yn in + Yes ) + read -p "What genre? " genre; + style=$genre; + break;; + No ) break;; + esac +done + +osascript -e "tell application \"iTunes\" to set the genre of every track whose album is \"$album\" and artist is \"$artist\" to \"$style\"" > /dev/null diff --git a/itunes_style_getter_helper.rb b/itunes_style_getter_helper.rb @@ -1,7 +1,9 @@ require "discogs-wrapper" +my_user_token = ENV["DISCOGS_API_TOKEN"] + query="#{ARGV[0]} #{ARGV[1]}" -wrapper=Discogs::Wrapper.new("iTunesStyleGetter", user_token: "uTZcIvlAFxZzteceXTKJlZLRgSJhbiJCOBIjZIbx") +wrapper=Discogs::Wrapper.new("iTunesStyleGetter", user_token: my_user_token) search=wrapper.search("#{query}") search.results.each do |result| if result.style?