comparison src/audtool/audtool_handlers_playqueue.c @ 3873:f3341c2d6b9e

audacious remote functions: - playlist_ins_url_string() and playlist_enqueue_to_temp() have been implemented. - now get_version() returns audacious version instead of protocol version. audtool: - now argc check works properly. - some cleanups.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Tue, 30 Oct 2007 22:12:47 +0900
parents e48f2f4c116d
children 30782d57c7e6
comparison
equal deleted inserted replaced
3872:b02853ac8466 3873:f3341c2d6b9e
43 43
44 if (argc < 2) 44 if (argc < 2)
45 { 45 {
46 audtool_whine("invalid parameters for %s.", argv[0]); 46 audtool_whine("invalid parameters for %s.", argv[0]);
47 audtool_whine("syntax: %s <position>", argv[0]); 47 audtool_whine("syntax: %s <position>", argv[0]);
48 return; 48 exit(1);
49 } 49 }
50 50
51 i = atoi(argv[1]); 51 i = atoi(argv[1]);
52 52
53 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) 53 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
54 { 54 {
55 audtool_whine("invalid playlist position %d", i); 55 audtool_whine("invalid playlist position %d", i);
56 return; 56 exit(1);
57 } 57 }
58 58
59 if (!(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1))) 59 if (!(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)))
60 audacious_remote_playqueue_add(dbus_proxy, i - 1); 60 audacious_remote_playqueue_add(dbus_proxy, i - 1);
61 } 61 }
66 66
67 if (argc < 2) 67 if (argc < 2)
68 { 68 {
69 audtool_whine("invalid parameters for %s.", argv[0]); 69 audtool_whine("invalid parameters for %s.", argv[0]);
70 audtool_whine("syntax: %s <position>", argv[0]); 70 audtool_whine("syntax: %s <position>", argv[0]);
71 return; 71 exit(1);
72 } 72 }
73 73
74 i = atoi(argv[1]); 74 i = atoi(argv[1]);
75 75
76 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) 76 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
77 { 77 {
78 audtool_whine("invalid playlist position %d", i); 78 audtool_whine("invalid playlist position %d", i);
79 return; 79 exit(1);
80 } 80 }
81 81
82 if (audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)) 82 if (audacious_remote_playqueue_is_queued(dbus_proxy, i - 1))
83 audacious_remote_playqueue_remove(dbus_proxy, i - 1); 83 audacious_remote_playqueue_remove(dbus_proxy, i - 1);
84 } 84 }
89 89
90 if (argc < 2) 90 if (argc < 2)
91 { 91 {
92 audtool_whine("invalid parameters for playqueue-is-queued.", argv[0]); 92 audtool_whine("invalid parameters for playqueue-is-queued.", argv[0]);
93 audtool_whine("syntax: %s playqueue-is-queued <position>", argv[0]); 93 audtool_whine("syntax: %s playqueue-is-queued <position>", argv[0]);
94 return; 94 exit(1);
95 } 95 }
96 96
97 i = atoi(argv[1]); 97 i = atoi(argv[1]);
98 98
99 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) 99 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
100 { 100 {
101 audtool_whine("invalid playlist position %d", i); 101 audtool_whine("invalid playlist position %d", i);
102 return; 102 exit(1);
103 } 103 }
104 if(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)) { 104 if(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)) {
105 audtool_report("OK"); 105 audtool_report("OK");
106 exit(0); 106 exit(0);
107 } 107 }
115 115
116 if (argc < 2) 116 if (argc < 2)
117 { 117 {
118 audtool_whine("invalid parameters for %s.", argv[0]); 118 audtool_whine("invalid parameters for %s.", argv[0]);
119 audtool_whine("syntax: %s <position>", argv[0]); 119 audtool_whine("syntax: %s <position>", argv[0]);
120 return; 120 exit(1);
121 } 121 }
122 122
123 i = atoi(argv[1]); 123 i = atoi(argv[1]);
124 124
125 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy)) 125 if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
126 { 126 {
127 audtool_whine("invalid playlist position %d", i); 127 audtool_whine("invalid playlist position %d", i);
128 return; 128 exit(1);
129 } 129 }
130 130
131 pos = audacious_remote_get_playqueue_queue_position(dbus_proxy, i - 1) + 1; 131 pos = audacious_remote_get_playqueue_queue_position(dbus_proxy, i - 1) + 1;
132 132
133 if (pos < 1) 133 if (pos < 1)
142 142
143 if (argc < 2) 143 if (argc < 2)
144 { 144 {
145 audtool_whine("invalid parameters for %s.", argv[0]); 145 audtool_whine("invalid parameters for %s.", argv[0]);
146 audtool_whine("syntax: %s <position>", argv[0]); 146 audtool_whine("syntax: %s <position>", argv[0]);
147 return; 147 exit(1);
148 } 148 }
149 149
150 i = atoi(argv[1]); 150 i = atoi(argv[1]);
151 151
152 if (i < 1 || i > audacious_remote_get_playqueue_length(dbus_proxy)) 152 if (i < 1 || i > audacious_remote_get_playqueue_length(dbus_proxy))
153 { 153 {
154 audtool_whine("invalid playlist position %d", i); 154 audtool_whine("invalid playlist position %d", i);
155 return; 155 exit(1);
156 } 156 }
157 157
158 pos = audacious_remote_get_playqueue_list_position(dbus_proxy, i - 1) + 1; 158 pos = audacious_remote_get_playqueue_list_position(dbus_proxy, i - 1) + 1;
159 159
160 if (pos < 1) 160 if (pos < 1)