Jump to content

iTunes (+ feed back info into alfred)


Recommended Posts

Hey beautiful people,

 

It's been a while since I haven't posted anything. Mainly because what I was developing wouldn't have interested anyone ;) Oh and also, you know, sometimes I actually work.

 

But here is a little piece of code that might help some of you: something to feed back into Alfred the current playing track (name and artist) and it's rating. As well as some basic controls.

 

Screen%20Shot%202013-02-09%20at%202.31.5

 

I'm pretty sure it'd be very easy to tweak for most of you because I'm using some applescript within the bash script (thank you osascript hook =D). So please, feel free to steal that and make it awesome. Go crazy ! 

 

 

(also available on AlfPT)
 
cheers
 
Link to comment

It'd be pretty cool if you could get it to work when shuffle is on as well.

 

I made some research and right now iTunes 11 is not responding to shuffle or repeat. It’s a bug.

 

But it seems to be very difficult to get the sequence of songs when played from the “Music” library. 

 

For now (and unfortunately), the “up next” and “previous” will work only when a playlist is playing.

Link to comment

Any help for improvements will be appreciated.

 

In resume:

 

- The workflow works well with a custom playlist.

 

- Song playing from Library is another story:

 

  • iTunes does not provide a way to get the order of playing songs (even with shuffle off)
  • iTunes does not provide a way to get a list of the songs from current album

- Right now the workflow can get a list of songs from current album (but not from an Album with “Various” as album artist)

- Sometimes or for some tracks the code inside Alfred does not work though it works in AppleScript Editor

 

I know there are a lot of missing things regarding a song playing from Library but a song from Library can be skipped making the workflow a simple next/prev.

 

Download the updated version here:

 

 

Link to comment
  • 4 weeks later...

Within the "script filter" named "rate" in this workflow, you will find the code that gives you the title and the artist of the track currently playing. I don't know exactly what you want to do with the lyrics (open in browser, save in .txt, add to track metadata, paste to clipboard...) so depending on that there are several approaches you might want to take. 

 

Say you want to add that to the track's metadata.

 

First, I'd pass the title and artist as arguments (in the xml output) to a second script (thus replacing the current NSAppleScript) that would get (and parse) the lyrics form a predefined website. I'd recommend you use php for that part as it's very good at dealing with websites but anything would do.

 

Second, I'd pass the lyrics you've obtained to a final script. I recommend you use Apple Script as it'll make it really easy for you to set the tracks metadata to the lyrics you've just passed.

 

Any question? 

 

have fun

Link to comment

Within the "script filter" named "rate" in this workflow, you will find the code that gives you the title and the artist of the track currently playing. I don't know exactly what you want to do with the lyrics (open in browser, save in .txt, add to track metadata, paste to clipboard...) so depending on that there are several approaches you might want to take. 

 

Say you want to add that to the track's metadata.

 

First, I'd pass the title and artist as arguments (in the xml output) to a second script (thus replacing the current NSAppleScript) that would get (and parse) the lyrics form a predefined website. I'd recommend you use php for that part as it's very good at dealing with websites but anything would do.

 

Second, I'd pass the lyrics you've obtained to a final script. I recommend you use Apple Script as it'll make it really easy for you to set the tracks metadata to the lyrics you've just passed.

 

Any question? 

 

have fun

 

Thanks. I'm a total beginner at any sort of coding, but I'll take this and give it a try.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...