Skip to content

kshvmdn/itunes-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

itunes-server

Control iTunes over a server. Uses osascript.

Installation / setup

  • Use the following to install and run (assuming you have Go installed and configured):

    $ go get github.com/kshvmdn/itunes-server
    $ itunes-server # Listening at localhost:8080
  • You can also build directly from source, if you'd prefer that.

    $ git clone https://github.com/kshvmdn/itunes-server.git
    $ cd itunes-server
    $ go build itunes-server.go
    $ ./itunes-server # Listening at localhost:8080

Usage

  • itunes-server allows you to control iTunes via standard HTTP requests.

  • Use the -help flag to view accepted command line arguments:

    $ itunes-server -help
    Usage of itunes-server:
      -no-track-list
          Disable the track list endpoint. (default false)
      -port string
          Port to run the server on. (default "8080")
  • Start the server:

    $ itunes-server [ARGS]
  • Endpoints:

    • GET /
      • View current status and song (if playing).
    • GET /open
      • Open iTunes.
    • GET /exit
      • Exit iTunes.
    • GET /play
      • Play the last-played song (iff nothing is currently playing).
    • GET /pause
      • Pause the currently playing song.
    • GET /stop
      • Stop the currently playing song.
    • GET /next
      • Skip to the next song.
    • GET /prev
      • Play the previous song.
    • GET /mute
      • Mute iTunes (doesn't effect system volume).
    • GET /unmute
      • Unmute iTunes (doesn't effect system volume).
    • GET /shuffle
      • Play a random song from your iTunes library.
    • GET /tracks
      • View list of tracks in your iTunes library.
      • Query parameters:
        • limit - The number of tracks to show (defaults to 100)
        • skip - The number of tracks to skip (defaults to 0)
    • GET /play/track/:track_name
      • Play track(s) with name that matches track_name.
    • GET /play/artist/:artist_name
      • Play track(s) with artist that matches artist_name.
    • GET /play/album/:album_name
      • Play track(s) with album that matches album_name.
  • Examples (these endpoints can be accessed through the browser as well):

    • View current status:

      $ curl -L localhost:8080
      {"status":"playing","current":{"title":"Gobstopper","artist":"J Dilla","album":"Donuts"}}
    • Next:

      $ curl -L localhost:8080/next
      {"status":"playing","current":{"title":"One For Ghost","artist":"J Dilla","album":"Donuts"}}
    • Pause:

      $ curl -L localhost:8080/pause
      {"status":"paused","current":{"title":"","artist":"","album":""}}
    • Play

      $ curl -L localhost:8080/play
      {"status":"playing","current":{"title":"One For Ghost","artist":"J Dilla","album":"Donuts"}}
  • If you're looking to expose your local server (so people can access iTunes without having to be on the same network), I suggest using ngrok.

Contribute

This project is completely open source, feel free to open an issue or create a pull request.

About

Control iTunes over a server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages