pst.c

来自「linux下网络收音机的源码」· C语言 代码 · 共 560 行 · 第 1/2 页

C
560
字号
  Py_BEGIN_ALLOW_THREADS  str = st_search_dialog();  Py_END_ALLOW_THREADS  return pst_string_take_string_or_null(str);}/*** st-handlers-api.h *******************************************************/static PyObject *pst_handlers_add (PyObject *dummy, PyObject *args){  PSTHandler *phandler;  if (! PyArg_ParseTuple(args, "O!", &PSTHandler_Type, &phandler))    return NULL;    st_handlers_add(phandler->handler);  return pst_none();}/*** st-m3u-api.h ************************************************************/static PyObject *pst_m3u_mktemp (PyObject *dummy, PyObject *args){  const char *prefix;  GSList *uri_list;  GError *err = NULL;  char *filename;  if (! PyArg_ParseTuple(args, "sO&", &prefix, pst_strings_as_gslist, &uri_list))    return NULL;    Py_BEGIN_ALLOW_THREADS  filename = st_m3u_mktemp(prefix, uri_list, &err);  Py_END_ALLOW_THREADS  /* free the list */  g_slist_foreach(uri_list, (GFunc) g_free, NULL);  g_slist_free(uri_list);  if (! filename)    {      PyErr_SetString(PyExc_RuntimeError, err->message);      g_error_free(err);      return NULL;    }        return pst_string_take_string(filename);}/*** st-pls-api.h ************************************************************/static PyObject *pst_pls_parse (PyObject *dummy, PyObject *args){  const char *playlist;    GSList *url_list;  PyObject *tuple;  if (! PyArg_ParseTuple(args, "s", &playlist))    return NULL;  url_list = st_pls_parse(playlist);  tuple = pst_strings_from_gslist(url_list);    /* free the list */  g_slist_foreach(url_list, (GFunc) g_free, NULL);  g_slist_free(url_list);  return tuple;}/*** st-state-api.h **********************************************************/static PyObject *pst_is_aborted (PyObject *dummy, PyObject *args){  return PyBool_FromLong(st_is_aborted());}/*** st-settings-api.h *******************************************************/static PyObject *pst_settings_get_private_dir (PyObject *dummy, PyObject *args){  return PyString_FromString(st_settings_get_private_dir());}static PyObject *pst_settings_get_music_dir (PyObject *dummy, PyObject *args){  return pst_string_take_string_or_null(st_settings_get_music_dir());}/*** st-sgml-ref-api.h *******************************************************/static PyObject *pst_sgml_ref_expand (PyObject *dummy, PyObject *args){  const char *str;  if (! PyArg_ParseTuple(args, "s", &str))    return NULL;  return pst_string_take_string(st_sgml_ref_expand(str));}/*** st-transfer-api.h *******************************************************/static PyObject *pst_transfer_escape (PyObject *dummy, PyObject *args){  const char *url;  if (! PyArg_ParseTuple(args, "s", &url))    return NULL;  return pst_string_take_string(st_transfer_escape(url));}/*** st-util-api.h ***********************************************************/static PyObject *pst_format_bitrate (PyObject *dummy, PyObject *args){  int bitrate;  if (! PyArg_ParseTuple(args, "i", &bitrate))    return NULL;    return pst_string_take_string(st_format_bitrate(bitrate));}static PyObject *pst_format_samplerate (PyObject *dummy, PyObject *args){  int samplerate;  if (! PyArg_ParseTuple(args, "i", &samplerate))    return NULL;    return pst_string_take_string(st_format_samplerate(samplerate));}static PyObject *pst_format_channels (PyObject *dummy, PyObject *args){  int channels;  if (! PyArg_ParseTuple(args, "i", &channels))    return NULL;    return pst_string_take_string(st_format_channels(channels));}static PyObject *pst_format_audio_properties (PyObject *dummy, PyObject *args){  int bitrate;  int samplerate;  int channels;  if (! PyArg_ParseTuple(args, "iii", &bitrate, &samplerate, &channels))    return NULL;    return pst_string_take_string(st_format_audio_properties(bitrate, samplerate, channels));}static PyObject *pst_hig_section_new (PyObject *dummy, PyObject *args){  const char *title;  GtkWidget *widget;  if (! PyArg_ParseTuple(args, "sO&", &title, pst_convert_widget, &widget))    return NULL;    return pygobject_new(G_OBJECT(st_hig_section_new(title, widget)));}static PyObject *pst_set_tooltip (PyObject *dummy, PyObject *args){  GtkWidget *widget;  const char *tooltip;  if (! PyArg_ParseTuple(args, "O&z", pst_convert_widget, &widget, &tooltip))    return NULL;    st_set_tooltip(widget, tooltip);  return pst_none();}/*** st-version-api.h ********************************************************/static PyObject *pst_check_api_version (PyObject *dummy, PyObject *args){  unsigned int required_major_version;  unsigned int minimum_minor_version;  if (! PyArg_ParseTuple(args, "ii", &required_major_version, &minimum_minor_version))    return NULL;  /* we check against the streamtuner/python API version */  return PyBool_FromLong(PST_API_MAJOR_VERSION == required_major_version			 && PST_API_MINOR_VERSION >= minimum_minor_version);}/*** Python-specific API *****************************************************/static PyObject *pst_find_icon (PyObject *dummy, PyObject *args){  const char *filename;  char *pathname;  if (! PyArg_ParseTuple(args, "s", &filename))    return NULL;  g_assert(private_icons_dir != NULL);  Py_BEGIN_ALLOW_THREADS  pathname = g_build_filename(ICONS_DIR, filename, NULL);  if (! g_file_test(pathname, G_FILE_TEST_EXISTS))    {      g_free(pathname);      pathname = g_build_filename(private_icons_dir, filename, NULL);      if (! g_file_test(pathname, G_FILE_TEST_EXISTS))	{	  g_free(pathname);	  pathname = NULL;	}    }  Py_END_ALLOW_THREADS  if (pathname)    return pst_string_take_string(pathname);  else    {      PyErr_Format(PyExc_RuntimeError, _("unable to find %s"), filename);      return NULL;    }}static PyObject *pst_gettext (PyObject *dummy, PyObject *args){  const char *msgid;  if (! PyArg_ParseTuple(args, "s", &msgid))    return NULL;  return PyString_FromString(gettext(msgid));}static PyObject *pst_ngettext (PyObject *dummy, PyObject *args){  const char *msgid;  const char *msgid_plural;  long n;  if (! PyArg_ParseTuple(args, "ssl", &msgid, &msgid_plural, &n))    return NULL;  return PyString_FromString(ngettext(msgid, msgid_plural, n));}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?