Ejemplo n.º 1
0
static void
on_control_panel_activate (GtkMenuItem   *item,
                           ShellStatusMenu *status)
{
  spawn_external (status, "gnome-control-center");
}
Ejemplo n.º 2
0
static void
on_account_activate (GtkMenuItem   *item,
                     ShellStatusMenu *status)
{
  spawn_external (status, "gnome-about-me");
}
Ejemplo n.º 3
0
static error_code
start_ripping (RIP_MANAGER_INFO* rmi)
{
    STREAM_PREFS* prefs = rmi->prefs;
    error_code ret;

    const char *pproxy = prefs->proxyurl[0] ? prefs->proxyurl : NULL;
    debug_printf ("start_ripping: checkpoint 1\n");

    /* If proxy URL not spec'd on command line (or plugin field), 
       check the environment variable */
    if (!pproxy) {
	char const *env_http_proxy = getenv ("http_proxy");
	if (env_http_proxy) {
	    pproxy = env_http_proxy;
	    debug_printf ("Getting proxy from $http_proxy: %s\n", pproxy);
	}
    }

    debug_printf ("start_ripping: checkpoint 2\n");

    /* Connect to the stream */
    ret = http_sc_connect (rmi, &rmi->stream_sock, prefs->url, 
			   pproxy, &rmi->http_info, 
			   prefs->useragent, prefs->referer, prefs->if_name);
    if (ret != SR_SUCCESS) {
	debug_printf ("http_sc_connect() returned error\n");
	goto RETURN_ERR;
    }

    /* If the icy_name exists, but is empty, set to a bogus name so 
       that we can create the directory correctly, etc. */
    if (strlen(rmi->http_info.icy_name) == 0) {
	strcpy (rmi->http_info.icy_name, "Streamripper_rips");
    }

    /* Set the ripinfo struct from the data we now know about the 
     * stream, this info are things like server name, type, 
     * bitrate etc.. */
    rmi->meta_interval = rmi->http_info.meta_interval;
    rmi->http_bitrate = rmi->http_info.icy_bitrate;
    rmi->detected_bitrate = -1;
    rmi->bitrate = -1;
    strcpy (rmi->streamname, rmi->http_info.icy_name);
    strcpy (rmi->server_name, rmi->http_info.server);

    /* Initialize file writing code. */
    ret = filelib_init
	    (rmi, 
	     GET_INDIVIDUAL_TRACKS(rmi->prefs->flags),
	     GET_COUNT_FILES(rmi->prefs->flags),
	     rmi->prefs->count_start,
	     GET_KEEP_INCOMPLETE(rmi->prefs->flags),
	     GET_SINGLE_FILE_OUTPUT(rmi->prefs->flags),
	     rmi->http_info.content_type, 
	     rmi->prefs->output_directory,
	     rmi->prefs->output_pattern,
	     rmi->prefs->showfile_pattern,
	     GET_SEPARATE_DIRS(rmi->prefs->flags),
	     GET_DATE_STAMP(rmi->prefs->flags),
	     rmi->http_info.icy_name);
    if (ret != SR_SUCCESS) {
	debug_printf ("filelib_init() returned error\n");
	goto RETURN_ERR;
    }

    /* Start up external program to get metadata. */
    rmi->ep = 0;
    if (GET_EXTERNAL_CMD(rmi->prefs->flags)) {
	debug_printf ("Spawn external: %s\n", rmi->prefs->ext_cmd);
	rmi->ep = spawn_external (rmi->prefs->ext_cmd);
	if (rmi->ep) {
	    debug_printf ("Spawn external succeeded\n");
	} else {
	    debug_printf ("Spawn external failed\n");
	}
    }

    /* Allocate buffers for ripstream */
    strcpy(rmi->no_meta_name, rmi->http_info.icy_name);
    rmi->getbuffer = 0;
    ripstream_clear (rmi);
    ret = ripstream_init(rmi);
    if (ret != SR_SUCCESS) {
	ripstream_clear (rmi);
	goto RETURN_ERR;
    }

    /* Launch relay server threads */
    if (GET_MAKE_RELAY (rmi->prefs->flags)) {
	u_short new_port = 0;
	ret = relaylib_start (rmi, 
			      GET_SEARCH_PORTS(rmi->prefs->flags), 
			      rmi->prefs->relay_port,
			      rmi->prefs->max_port, 
			      &new_port,
			      rmi->prefs->if_name, 
			      rmi->prefs->max_connections,
			      rmi->prefs->relay_ip,
			      rmi->http_info.meta_interval != NO_META_INTERVAL);
	if (ret != SR_SUCCESS) {
	    goto RETURN_ERR;
	}

	rmi->prefs->relay_port = new_port;

	/* Create pls file with address of relay stream */
	if (0 != rmi->prefs->pls_file[0]) {
	    create_pls_file (rmi);
	}
    }

    /* Done. */
    post_status (rmi, RM_STATUS_BUFFERING);
    return SR_SUCCESS;

 RETURN_ERR:
    socklib_close(&rmi->stream_sock);
    return ret;	
}