Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iTunes CLI #15

Closed
wayneashleyberry opened this issue Jul 14, 2015 · 31 comments
Closed

iTunes CLI #15

wayneashleyberry opened this issue Jul 14, 2015 · 31 comments

Comments

@wayneashleyberry
Copy link

Hey @sindresorhus

After using the [fkill-cli] for a while, it got me thinking... I use Alfred a lot to control iTunes and it could probably be done from the command line.

This would be incredible!

http://support.alfredapp.com/features:itunes

@sindresorhus
Copy link
Owner

Yeah, that's a cool idea. Someone should do it, I don't have the time though. It could use Inquirer.js or blessed to get an interactive interface.

Can you elaborate a bit more on how you'd like it to work?

@wayneashleyberry
Copy link
Author

This will largely come down to personal preference, but 99% of my Aflred iTunes usage is to play an artist or album... once I'm there it's easy enough to use the previous and next keys on my keyboard to move around.

So in my mind the core features would be fuzzy matching of artist and album names with some kind of prioritisation.

eg.

❯ itunes radiohead
❯ itunes king of limbs

That would be my 1.0.0, adding interactive prompts isn't such a big deal for my use cases, but this is how I would imagine them looking:

❯ itunes radio
? Select an artist or album: (Use arrow keys)
❯ Radiohead (artist)
  King of Limbs (album)
  Radio - Lana Del Ray (song)
  Radioactivity - Kraftwerk (song) 
(Move up and down to reveal more choices)

@mischah
Copy link

mischah commented Oct 27, 2015

Hej,

I l:heart_eyes:ve the idea and fiddled around with Apples JavaScript for Automation for a few hours.

The docs are not that good and the »API« for iTunes is kinda limited:
API

But I managed to write a proof of concept for

So in my mind the core features would be fuzzy matching of artist and album names with some kind of prioritisation.

within Apples Script Editor:
Script-Editor

Download Script

I would love to write the CLI for that. But I'm not sure how to start because I’ve never wrote a CLI before 😬
I guess a take a deeper look at one of Sindres simpler CLI modules like npm-name-cli 😘

@forivall
Copy link

If only osx supported dbus and iTunes supported mpris ;)

@mischah
Copy link

mischah commented Oct 29, 2015

Hej, I just published version 0.1.x of itunes-remote 👯

The code is still a bit ugly and there is a lack of tests … but at least it’s possible to listen to music without leaving the terminal 🎶

@sindresorhus
Copy link
Owner

@mischah Nice! Looks like a great start :)

You should also split the API and CLI into separate packages.

Would be really cool if it were interactive. You could use vorpal (framework for interactive CLI apps) to easily achieve that.

// @dthree

@dthree
Copy link

dthree commented Oct 30, 2015

😄

Looks really cool so far!

Vorpal could definitely help you do some fancy things with it, really easily. Some ideas are tabbed auto-completion of songs / artists, commands to see what's playing or active updates on your CLI of what's playing. You could even make a "menu bar" that shows the current song and is constantly updating.

Feel free to ask me any questions if you want to use it.

@mischah
Copy link

mischah commented Oct 30, 2015

Would be really cool if it were interactive. You could use vorpal (framework for interactive CLI apps) to easily achieve that.

Yep. Going to dive into that.

Feel free to ask me any questions if you want to use it.

Thanks.

Has vorpal any main advantages compared to Inquirer.js?
I’ve used Latter one already while building a yeoman generator.

@wayneashleyberry
Copy link
Author

Woohoo :) Looking great so far @mischah

@dthree
Copy link

dthree commented Oct 30, 2015

Has vorpal any main advantages compared to Inquirer.js?

Vorpal is built off of Inquirer.js, and exposes its prompts. It works with it, to make interactive apps a lot easier, and allows for more fine-grained control of prompting. It perhaps compares as Marionette would compare to Backbone.js.

As an example, here's some API commands for manipulating prompts and the UI it provides:

https://github.com/dthree/vorpal/wiki/api-|-vorpal.ui

Does that help clarify?

@mischah
Copy link

mischah commented Oct 30, 2015

Does that help clarify?

Yes. Thank you very much.

It looks a bit complicated at first sight. Guess I have to play around with it 😗

@dthree
Copy link

dthree commented Oct 30, 2015

From the feedback so far from others, it's pretty simple once you get the hang of it.

I think the best way to go about it is work back from what you want to accomplish, i.e. name something you want your awesome little app to do, and then ask or look for how to do that.

Feel free to overwhelm me with questions - I'm get emails on the vorpal.js tag on StackOverflow, and there's a Gitter chatroom as well.

@mischah
Copy link

mischah commented Oct 30, 2015

Feel free to overwhelm me with questions - I'm get emails on the vorpal.js tag on StackOverflow, and there's a Gitter chatroom as well.

Thanks man 😊

@dthree
Copy link

dthree commented Oct 30, 2015

👍

@mischah
Copy link

mischah commented Nov 6, 2015

I just published v2.0.0 as interactive CLI with help of vorpal 👯

Here is a sneak peak:
demo

@stefanjudis
Copy link

Huh! Nice! 👍

@mischah
Copy link

mischah commented Nov 6, 2015

@stefanjudis Thanks 😊
Wouldn’t be possible without the amazing work from @dthree 😙

@dthree
Copy link

dthree commented Nov 6, 2015

Thanks man. It's looking really good 🌟

@Qix-
Copy link
Collaborator

Qix- commented Nov 6, 2015

Get some fuzzy search in there for search lol. Lists are annoying especially when you have 20000 artists/songs.

@mischah
Copy link

mischah commented Nov 6, 2015

@Qix-

Get some fuzzy search in there for search lol.

I don’t know what you’re laughing about:

$ itunes-remote 
iTunes: help search

  Usage: search [options] <searchterm>


  Fuzzy search album, artists and songs.

  Options:

    --help           output usage information
    -A, --albums     Limit search to albums.
    -s, --songs      Limit search to songs.
    -a, --artists    Limit search to artist.
    -d, --dont-play  Prevent playing the search result.

@mischah
Copy link

mischah commented Nov 6, 2015

I use the list when I need »inspiration« for listening pleasures btw.

@dthree
Copy link

dthree commented Nov 6, 2015

Just a Q - I think there's some free APIs to grab lyrics, already in Node. Would be rad if it could show lyrics. What do you think?

@mischah
Copy link

mischah commented Nov 6, 2015

Would be rad if it could show lyrics. What do you think?
mhm. It’s not a use case for me. I’m not interested in lyrics to be honest.

I think the following are my top priorities:

  • Tests 🙈
  • Tab completion for search
  • Infos about the current track
  • Flattening the artists list by getting rid of partial duplicates
    • For example: "Supersci", "Supersci Feat. Chords", "Supersci Feat. Remedeeh" etc.

I’ m going to open a few issues over there.

@dthree
Copy link

dthree commented Nov 6, 2015

Sounds good!

Just throwing out ideas, not priority and you can disregard them if you don't like. I was thinking it'd be really cool if, when the CLI goes idle for more than 15 seconds or so, it can start redrawing the screen like a player, something like this (but prettier and with colors, obviously):

 Lyrics

 ...
 ... (lyrics take up remaining screen height)

--------------------------------------------------------------
 Can't Feel My Face
 The Weeknd

 < 0:50 [#######                                     ] 3:38 >

itunes: 

The bottom section would stick to the bottom of the screen.

When in this mode, the left key could be like the back button of a player, the right key the next button, and up and down would scroll the lyrics.

As soon as you start typing any other command, the normal CLI would resume.


Anyway, just food for thought :)

@mischah
Copy link

mischah commented Nov 6, 2015

wohoo. you got me with this one 👌

@dthree
Copy link

dthree commented Nov 6, 2015

Haha - if you end up doing it, again don't hesitate to ask me for help. The CLI auto-updating and keypress handles are actually really easy with the UI API in Vorpal, no small thanks to @sindresorhus for log-update, which it relies on.

@sindresorhus
Copy link
Owner

I really like @dthree's idea! Let's take CLI apps to the next level of awesomeness :)

@mischah
Copy link

mischah commented Nov 7, 2015

I just created a few enhancements issues in the Repo 💃

@dthree
Copy link

dthree commented Nov 7, 2015

👍

@sindresorhus
Copy link
Owner

Alright. I consider this resolved. Nice work @mischah! Looking forward to see more interactivity :)

@mischah
Copy link

mischah commented Nov 20, 2015

Thanks. I first have to fix something in node-osacript which I rely on to make things possible for the itunes cli 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants