soundcloud python/php apis, recorder python script so far.
This commit is contained in:
parent
b3e111b0a0
commit
f68a8f67ea
109 changed files with 24297 additions and 10 deletions
53
python_apps/soundcloud-api/scapi/util.py
Normal file
53
python_apps/soundcloud-api/scapi/util.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
## SouncCloudAPI implements a Python wrapper around the SoundCloud RESTful
|
||||
## API
|
||||
##
|
||||
## Copyright (C) 2008 Diez B. Roggisch
|
||||
## Contact mailto:deets@soundcloud.com
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
## modify it under the terms of the GNU Lesser General Public
|
||||
## License as published by the Free Software Foundation; either
|
||||
## version 2.1 of the License, or (at your option) any later version.
|
||||
##
|
||||
## This library is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
## Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public
|
||||
## License along with this library; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
import urllib
|
||||
|
||||
def escape(s):
|
||||
# escape '/' too
|
||||
return urllib.quote(s, safe='')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class MultiDict(dict):
|
||||
|
||||
|
||||
def add(self, key, new_value):
|
||||
if key in self:
|
||||
value = self[key]
|
||||
if not isinstance(value, list):
|
||||
value = [value]
|
||||
self[key] = value
|
||||
value.append(new_value)
|
||||
else:
|
||||
self[key] = new_value
|
||||
|
||||
|
||||
def iteritemslist(self):
|
||||
for key, value in self.iteritems():
|
||||
if not isinstance(value, list):
|
||||
value = [value]
|
||||
yield key, value
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue