~ubuntu-branches/ubuntu/karmic/quodlibet/karmic

« back to all changes in this revision

Viewing changes to debian/patches/41-portable-audio-player-hal-update.patch

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2009-01-30 23:55:34 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20090130235534-l4e72ulw0vqfo17w
Tags: 2.0-1ubuntu1
* Merge from Debian experimental (LP: #276856), remaining Ubuntu changes:
  + debian/patches/40-use-music-profile.patch:
    - Use the "Music and Movies" pipeline per default.
* Refresh the above patch for new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -Nur -x '*.orig' -x '*~' quodlibet-1.0.ds1/devices/_base.py quodlibet-1.0.ds1.new/devices/_base.py
2
 
--- quodlibet-1.0.ds1/devices/_base.py  2008-06-03 20:53:42.000000000 +0200
3
 
+++ quodlibet-1.0.ds1.new/devices/_base.py      2008-11-03 20:42:50.000000000 +0100
4
 
@@ -17,9 +17,9 @@
5
 
     # The default icon for this device.
6
 
     icon = 'device-generic'
7
 
 
8
 
-    # The value of the HAL-property 'portable_audio_player.type' for
9
 
-    # this device.
10
 
-    type = ""
11
 
+    # The used HAL access method protocol for this device, as defined in
12
 
+    # 'portable_audio_player.access_method.protocols'
13
 
+    protocol = ''
14
 
 
15
 
     # The UDI of this device
16
 
     udi = None
17
 
diff -Nur -x '*.orig' -x '*~' quodlibet-1.0.ds1/devices/__init__.py quodlibet-1.0.ds1.new/devices/__init__.py
18
 
--- quodlibet-1.0.ds1/devices/__init__.py       2008-06-03 20:53:42.000000000 +0200
19
 
+++ quodlibet-1.0.ds1.new/devices/__init__.py   2008-11-03 20:42:50.000000000 +0100
20
 
@@ -55,20 +55,43 @@
21
 
     except ValueError:
22
 
         return None
23
 
 
24
 
-# Return a constructor for a device given by a HAL type
25
 
-def get_by_type(type):
26
 
-    try: return devices[[d.type for d in devices].index(type)]
27
 
-    except ValueError:
28
 
-        return None
29
 
+# Return a constructor for a device given by the supported
30
 
+# access method protocols
31
 
+def get_by_protocols(protocols):
32
 
+    # Try the storage protocol last
33
 
+    if 'storage' in protocols:
34
 
+        protocols.remove('storage')
35
 
+        protocols.append('storage')
36
 
+
37
 
+    for protocol in protocols:
38
 
+        try: return devices[[d.protocol for d in devices].index(protocol)]
39
 
+        except ValueError:
40
 
+            pass
41
 
+
42
 
+    return None
43
 
 
44
 
 # Return a new device instance for the given UDI
45
 
 def get_by_udi(udi):
46
 
     interface = get_interface(udi)
47
 
-    try: capabilities = interface.GetProperty('info.capabilities')
48
 
-    except dbus.DBusException: return None
49
 
+    try:
50
 
+        capabilities = interface.GetProperty('info.capabilities')
51
 
+    except dbus.DBusException:
52
 
+        return None
53
 
 
54
 
     if 'portable_audio_player' in capabilities:
55
 
-        klass = get_by_type(interface.GetProperty('portable_audio_player.type'))
56
 
+        try:
57
 
+            protocols = interface.GetProperty(
58
 
+                'portable_audio_player.access_method.protocols')
59
 
+        except dbus.DBusException:
60
 
+            try:
61
 
+                # Support older HAL versions which don't use the 'protocols' property
62
 
+                # and only store one access method as a string
63
 
+                protocols = [interface.GetProperty(
64
 
+                    'portable_audio_player.access_method')]
65
 
+            except dbus.DBusException:
66
 
+                return None
67
 
+
68
 
+        klass = get_by_protocols(protocols)
69
 
         if klass:
70
 
             device = klass(udi)
71
 
             return device
72
 
diff -Nur -x '*.orig' -x '*~' quodlibet-1.0.ds1/devices/ipod.py quodlibet-1.0.ds1.new/devices/ipod.py
73
 
--- quodlibet-1.0.ds1/devices/ipod.py   2008-06-03 20:53:42.000000000 +0200
74
 
+++ quodlibet-1.0.ds1.new/devices/ipod.py       2008-11-03 20:42:50.000000000 +0100
75
 
@@ -65,7 +65,7 @@
76
 
 
77
 
 class IPodDevice(Device):
78
 
     icon = stock.IPOD
79
 
-    type = "ipod"
80
 
+    protocol = 'ipod'
81
 
 
82
 
     ordered = True
83
 
 
84
 
diff -Nur -x '*.orig' -x '*~' quodlibet-1.0.ds1/devices/storage.py quodlibet-1.0.ds1.new/devices/storage.py
85
 
--- quodlibet-1.0.ds1/devices/storage.py        2008-06-03 20:53:42.000000000 +0200
86
 
+++ quodlibet-1.0.ds1.new/devices/storage.py    2008-11-03 20:42:50.000000000 +0100
87
 
@@ -24,7 +24,7 @@
88
 
 CACHE = os.path.join(const.USERDIR, 'cache')
89
 
 
90
 
 class StorageDevice(Device):
91
 
-    type = 'generic'
92
 
+    protocol = 'storage'
93
 
 
94
 
     defaults = {
95
 
         'pattern': '<artist>/<album>/<title>',