aadhithya / pytunes_cli

Command Line script to control iTunes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytunes_cli

A simple Command Line script to control iTunes.

The project uses a python wrapper class to control iTunes using AppleScript code with the awesome py-applescript library.

Also available is a small console program that can be used to control itunes from the terminal.

NOTE:

  • This project is incomplete and is WIP.
  • Therefore, some/many features doesn't work yet.

What Works:

Features that works as of now:

  • play song
  • play playlist
  • pause
  • stop
  • playpause
  • resume

Requirements

  • python 3.6
  • argparse
  • py-applescript pip install py-applescript
  • pyObjC brew install pyobjc
  • pprint

Usage

  • clone project: git clone https://github.com/aadhithya/pytunes_cli.git
  • cd path/to/pytunes_cli/ python pytunes_cli.py [options]
usage: itunes_cli.py [-h] [--play] [-artist ARTIST [ARTIST ...]]
                     [--song SONG [SONG ...]] [--album ALBUM [ALBUM ...]]
                     [--playlist PLAYLIST [PLAYLIST ...]] [--pause] [--stop]
                     [--resume] [--play-pause] [--search]

optional arguments:
  -h, --help            show this help message and exit
  --play, -p            Play main command.
  -artist ARTIST [ARTIST ...], -ar ARTIST [ARTIST ...]
                        Plays the songs by the artist from library. Sub-
                        command.
  --song SONG [SONG ...], -sng SONG [SONG ...]
                        Plays the song. Sub-command.
  --album ALBUM [ALBUM ...], -al ALBUM [ALBUM ...]
                        Plays the album from library. sub-command.
  --playlist PLAYLIST [PLAYLIST ...], -pl PLAYLIST [PLAYLIST ...]
                        Plays the playlist from library. Sub-command.
  --pause, -ps          Pause
  --stop, -st           Stop
  --resume, -r          Resume
  --play-pause, -pp     Alternate between play and pause.
  --search, -s          Search. To be used with the one of the sub-commands.

Example Usage

  • Play a song by song name: python itunes_cli.py -p -sng <Song Name>
  • Play a Playlist: python itunes_cli.py -p -pl <Playlist Name>
  • Pause: python itunes_cli.py -ps
  • Resume: python itunes_cli.py -r
  • Stop: python itunes_cli.py -st
  • Playpause: python itunes_cli.py -pp

Limitations

Apple being Apple have quite the restrictions in place here. This gives rise to the following limitations:

  • The scripts only works for music in your library. This means NO APPLE MUSIC SUPPORT 😫
  • The script to play an album throws an 'Access Denied' Error eventhough the album is in the library. I don't know why yet.

Lisence

MIT © Aadhithya Sankar

About

Command Line script to control iTunes.


Languages

Language:Python 99.6%Language:OpenEdge ABL 0.4%