-
Notifications
You must be signed in to change notification settings - Fork 1
/
DBGUtils.py
41 lines (35 loc) · 915 Bytes
/
DBGUtils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
def dp(o):
try:
cname = o._get_objc_classname()
cname = cname.decode('utf-8')
except AttributeError:
cname = 'Non-Objective-C object'
finally:
for i in dir(o):
print("'%s'" % i)
print('[%s]\n' % cname)
def printMediaItem(item, verbose=False):
print(item.title())
if verbose:
print('- artist: %s' % item.artist())
print('- albumTitle: %s' % item.albumTitle())
print('- persistentID: %d' % item.persistentID())
def printItemCollections(ls, verbose=False):
for item in ls:
try:
item.title()
except AttributeError: #collections?
try:
item = item.items()[0] #item position in collections()[i]
except AttributeError:
print('Neither items nor collections.')
raise
except:
raise
printMediaItem(item, verbose)
print()
if __name__=='__main__':
from objc_util import *
print()