~ubuntu-branches/ubuntu/saucy/clementine/saucy

« back to all changes in this revision

Viewing changes to src/devices/imobiledeviceconnection.cpp

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
*/
17
17
 
18
18
#include "imobiledeviceconnection.h"
 
19
#include "core/logging.h"
19
20
 
20
21
#include <plist/plist.h>
21
22
 
22
23
#include <QCoreApplication>
 
24
#include <QUrl>
23
25
#include <QtDebug>
24
26
 
25
27
iMobileDeviceConnection::iMobileDeviceConnection(const QString& uuid)
26
28
    : device_(NULL), afc_(NULL), afc_port_(0) {
27
29
  idevice_error_t err = idevice_new(&device_, uuid.toUtf8().constData());
28
30
  if (err != IDEVICE_E_SUCCESS) {
29
 
    qWarning() << "idevice error:" << err;
 
31
    qLog(Warning) << "idevice error:" << err;
30
32
    return;
31
33
  }
32
34
 
37
39
  lockdownd_error_t lockdown_err =
38
40
      lockdownd_client_new_with_handshake(device_, &lockdown, label);
39
41
  if (lockdown_err != LOCKDOWN_E_SUCCESS) {
40
 
    qWarning() << "lockdown error:" << lockdown_err;
 
42
    qLog(Warning) << "lockdown error:" << lockdown_err;
41
43
    return;
42
44
  }
43
45
 
44
46
  lockdown_err = lockdownd_start_service(lockdown, "com.apple.afc", &afc_port_);
45
47
  if (lockdown_err != LOCKDOWN_E_SUCCESS) {
46
 
    qWarning() << "lockdown error:" << lockdown_err;
 
48
    qLog(Warning) << "lockdown error:" << lockdown_err;
47
49
    lockdownd_client_free(lockdown);
48
50
    return;
49
51
  }
50
52
 
51
53
  afc_error_t afc_err = afc_client_new(device_, afc_port_, &afc_);
52
54
  if (afc_err != 0) {
53
 
    qWarning() << "afc error:" << afc_err;
 
55
    qLog(Warning) << "afc error:" << afc_err;
54
56
    lockdownd_client_free(lockdown);
55
57
    return;
56
58
  }
82
84
  lockdownd_error_t lockdown_err =
83
85
      lockdownd_client_new_with_handshake(device_, &lockdown, label);
84
86
  if (lockdown_err != LOCKDOWN_E_SUCCESS) {
85
 
    qWarning() << "lockdown error:" << lockdown_err;
 
87
    qLog(Warning) << "lockdown error:" << lockdown_err;
86
88
    return QVariant();
87
89
  }
88
90
 
94
96
  lockdownd_client_free(lockdown);
95
97
 
96
98
  if (!node) {
97
 
    qWarning() << "get_value failed" << property << domain;
 
99
    qLog(Warning) << "get_value failed" << property << domain;
98
100
    return QVariant();
99
101
  }
100
102
 
113
115
    }
114
116
 
115
117
    default:
116
 
      qWarning() << "Unhandled PList type";
 
118
      qLog(Warning) << "Unhandled PList type";
117
119
      return QVariant();
118
120
  }
119
121
}
199
201
  }
200
202
 
201
203
  if (total_musicdirs <= 0) {
202
 
    qWarning() << "No 'F..'' directories found on iPod";
 
204
    qLog(Warning) << "No 'F..'' directories found on iPod";
203
205
    return QString();
204
206
  }
205
207
 
209
211
  dir.sprintf("/iTunes_Control/Music/F%02d", dir_num);
210
212
 
211
213
  if (!Exists(dir)) {
212
 
    qWarning() << "Music directory doesn't exist:" << dir;
 
214
    qLog(Warning) << "Music directory doesn't exist:" << dir;
213
215
    return QString();
214
216
  }
215
217
 
216
218
  // Use the same file extension as the original file, default to mp3.
217
 
  QString extension = metadata.filename().section('.', -1, -1).toLower();
 
219
  QString extension = metadata.url().path().section('.', -1, -1).toLower();
218
220
  if (extension.isEmpty())
219
221
    extension = "mp3";
220
222