Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

# Licensed under the MIT license 

# http://opensource.org/licenses/mit-license.php 

 

# Copyright 2006-2008, Frank Scholz <coherence@beebits.net> 

 

from coherence import log 

 

 

class AVTransportClient(log.LogAble): 

    logCategory = 'avtransportclient' 

 

    def __init__(self, service): 

        log.LogAble.__init__(self) 

        self.service = service 

        self.namespace = service.get_type() 

        self.url = service.get_control_url() 

        self.service.subscribe() 

        self.service.client = self 

 

    # def __del__(self): 

    #    #print "AVTransportClient deleted" 

    #    pass 

 

    def remove(self): 

        self.service.remove() 

        self.service = None 

        self.namespace = None 

        self.url = None 

        del self 

 

    def subscribe_for_variable(self, var_name, callback, signal=False): 

        self.service.subscribe_for_variable(var_name, instance=0, 

                                            callback=callback, signal=signal) 

 

    def set_av_transport_uri(self, instance_id=0, current_uri='', 

                             current_uri_metadata=''): 

        action = self.service.get_action('SetAVTransportURI') 

        return action.call(InstanceID=instance_id, 

                           CurrentURI=current_uri, 

                           CurrentURIMetaData=current_uri_metadata) 

 

    def set_next_av_transport_uri(self, instance_id=0, next_uri='', 

                                  next_uri_metadata=''): 

        action = self.service.get_action('SetNextAVTransportURI') 

        if action:  # optional 

            return action.call(InstanceID=instance_id, 

                               NextURI=next_uri, 

                               NextURIMetaData=next_uri_metadata) 

        return None 

 

    def get_media_info(self, instance_id=0): 

        action = self.service.get_action('GetMediaInfo') 

        return action.call(InstanceID=instance_id) 

 

    def get_media_info_ext(self, instance_id=0): 

        action = self.service.get_action('GetMediaInfo_Ext') 

        return action.call(InstanceID=instance_id) 

 

    def get_transport_info(self, instance_id=0): 

        action = self.service.get_action('GetTransportInfo') 

        return action.call(InstanceID=instance_id) 

 

    def get_position_info(self, instance_id=0): 

        action = self.service.get_action('GetPositionInfo') 

        return action.call(InstanceID=instance_id) 

 

    def get_device_capabilities(self, instance_id=0): 

        action = self.service.get_action('GetDeviceCapabilities') 

        return action.call(InstanceID=instance_id) 

 

    def get_transport_settings(self, instance_id=0): 

        action = self.service.get_action('GetTransportSettings') 

        return action.call(InstanceID=instance_id) 

 

    def pause(self, instance_id=0): 

        action = self.service.get_action('Pause') 

        if action:  # optional 

            return action.call(InstanceID=instance_id) 

        return None 

 

    def play(self, instance_id=0, speed=1): 

        action = self.service.get_action('Play') 

        return action.call(InstanceID=instance_id, Speed=speed) 

 

    def stop(self, instance_id=0): 

        action = self.service.get_action('Stop') 

        return action.call(InstanceID=instance_id) 

 

    def record(self, instance_id=0): 

        action = self.service.get_action('Record') 

        if action:  # optional 

            return action.call(InstanceID=instance_id) 

        return None 

 

    def seek(self, instance_id=0, unit='', target=0): 

        action = self.service.get_action('Seek') 

        return action.call(InstanceID=instance_id, 

                           Unit=unit, 

                           Target=target) 

 

    def next(self, instance_id=0): 

        action = self.service.get_action('Next') 

        return action.call(InstanceID=instance_id) 

 

    def previous(self, instance_id=0): 

        action = self.service.get_action('Previous') 

        return action.call(InstanceID=instance_id) 

 

    def get_current_transport_actions(self, instance_id=0): 

        action = self.service.get_action('GetCurrentTransportActions') 

        return action.call(InstanceID=instance_id)