Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.0.1
Fetching contributors…

Cannot retrieve contributors at this time

130 lines (89 sloc) 3.632 kb

iTunes::Store::Transporter

Upload and manage your assets in the iTunes Store using the iTunes Store's Transporter (iTMSTransporter).

Warning This is alpha code.

Overview

require "itunes/store/transporter"

itms = iTunes::Store::Transporter.new(:username => "CouchCaster",
                                      :shortname => "bigtimer",
                                      :password => "w3c@llYoU!")

itms.upload("/path/to/yourpackage.itmsp")
metadata = itms.lookup(:apple_id => "yourpackage")

begin
  itms.verify("/path/to/package2.itmsp", :verify_asssets => false)
rescue iTunes::Store::Transporter::ExecutionError => e
  puts "Exited with #{e.exitstatus}"

  e.errors.each do |error|
    puts "#{error.message} - #{error.code}"
    puts "Basically, you have some faulty metadata" if error.missing_data?
  end
end

Description

iTunes::Store::Transporter is a wrapper around Apple's iTMSTransporter program. It currently supports the following operations:

  • Upload packages

  • Validate packages

  • Retrieve status information

  • Lookup package metadata

  • List providers

  • Retrieve iTunes metadata schemas

It also includes itms, an executable that's sorta like using iTMSTransporter directly, except that it can send email notifications and allows one to set global/per-command defaults via $HOME/.itms.

Requirements

Running on Windows

On Windows iTMSTransporter is called via the iTMSTransporter.CMD batch file. This file does not handle the iTMSTransporter's exit status correctly, causing iTunes::Store::Transporter to report everything as a success.

This can be fixed by modifying iTMSTransporter.CMD (note that the following does not mimic the batch file exactly):

...

call iTMSTransporter\iTMSTransporter %*

REM Add this line:
set exited=%errorlevel%

cd %olddir%

REM Add this line too:
exit /b %exited%

Using itms

itms COMMAND [OPTIONS]

  • COMMAND - The command (iTunes::Store::Transporter method) to run

  • OPTIONS - These are equivalent to the given COMMAND's options except they must be given in long option format. For example :apple_id => "X123" would be --apple-id=X123.

Config file

Default options and email notifications can be placed in a YAML file at $HOME/.itms.

# Global command defaults
path: /usr/bin
username: sshaw
password: Pa55W0rd!

# Global email defaults    
email:
  to: everyone@example.com
  from: no-reply@example.com
  host: smtp.example.com

# Verify command
verify:
  shortname: lUzer

# Upload command
upload:
  shortname: enc0d3rz
  transport: Aspera
  rate: 750_000
  # Email notifications for the upload command
  email:
    success:
      cc: assets@example.com
      subject: iTunes Upload <%= @apple_id %>
      message: |        
        <% @username > uploaded it using <%= @transport %>

        Bye!
    failure:
      to: support@example.com
      subject: Upload Failed!
      message: |
        Here's the problem: 

        <%= @error %>	

        Fix it!

More Info

Author

Skye Shaw [sshaw AT lucas.cis.temple.edu]

License

Released under the MIT License: www.opensource.org/licenses/MIT

Jump to Line
Something went wrong with that request. Please try again.