Example #1
0
static void 
print_cddb_info(CdIo_t *p_cdio, track_t i_tracks, track_t i_first_track) 
{
  int i, i_cddb_matches = 0;
  
  cddb_conn_t *p_conn = NULL;
  cddb_disc_t *p_cddb_disc = NULL;

  if ( init_cddb(p_cdio, &p_conn, &p_cddb_disc, cddb_errmsg, i_first_track, 
		 i_tracks, &i_cddb_matches) ) {

    if (-1 == i_cddb_matches) 
      printf("%s: %s\n", program_name, cddb_error_str(cddb_errno(p_conn)));
    else {
      printf("%s: Found %d matches in CDDB\n", program_name, i_cddb_matches);
      for (i=1; i<=i_cddb_matches; i++) {
	cddb_disc_print(p_cddb_disc);
	cddb_query_next(p_conn, p_cddb_disc);
	if (i != i_cddb_matches) cddb_read(p_conn, p_cddb_disc);
      }
    }
  
    cddb_disc_destroy(p_cddb_disc);
    cddb_destroy(p_conn);
    libcddb_shutdown();
  }
}
Example #2
0
static void
parse_cddb (cdda_t *cd)
{
    cddb_disc_t *disc;
    cddb_conn_t *conn;
    int res;

    if (!cd)
        return;

    libcddb_init ();
    conn = cddb_new ();
    disc = cddb_disc_new ();

    cddb_disc_set_category_str (disc, "misc");
    cddb_disc_set_discid (disc, cd->id);

    res = cddb_read (conn, disc);
    if (!res)
        goto err_cddb_read;

    cd_get_metadata (cd, disc);
    cd_get_tracks (cd, disc);

 err_cddb_read:
    cddb_disc_destroy (disc);
    libcddb_shutdown ();
}
Example #3
0
/* main thread only */
static void cdaudio_cleanup (void)
{
    g_mutex_lock (mutex);

    if (monitor_source)
    {
        g_source_remove (monitor_source);
        monitor_source = 0;
    }

    if (pcdrom_drive != NULL)
    {
        cdda_close (pcdrom_drive);
        pcdrom_drive = NULL;
    }
    if (trackinfo != NULL)
    {
        g_free (trackinfo);
        trackinfo = NULL;
    }

    libcddb_shutdown ();

    // todo: destroy the gui

    mlp_set_bool ("CDDA", "use_cdtext", cdng_cfg.use_cdtext);
    mlp_set_bool ("CDDA", "use_cddb", cdng_cfg.use_cddb);
    mlp_set_string ("CDDA", "device", cdng_cfg.device);
    mlp_set_string ("CDDA", "cddbserver", cdng_cfg.cddb_server);
    mlp_set_string ("CDDA", "cddbpath", cdng_cfg.cddb_path);
    mlp_set_int ("CDDA", "cddbport", cdng_cfg.cddb_port);
    mlp_set_bool ("CDDA", "cddbhttp", cdng_cfg.cddb_http);
    mlp_set_int ("CDDA", "disc_speed", cdng_cfg.disc_speed);

    g_free (cdng_cfg.device);
    g_free (cdng_cfg.cddb_server);
    g_free (cdng_cfg.cddb_path);
    g_free (cdng_cfg.proxy_host);
    g_free (cdng_cfg.proxy_username);
    g_free (cdng_cfg.proxy_password);

    g_mutex_unlock (mutex);
    g_mutex_free (mutex);
}
Example #4
0
static void 
finish(const char *psz_msg, int rc)
{
  if (b_interactive) {
    attron(A_STANDOUT);
    mvprintw(LINE_ACTION, 0, (char *) "%s, exiting...\n", psz_msg);
    attroff(A_STANDOUT);
    clrtoeol();
    refresh();
  }
  tty_restore();
#ifdef HAVE_CDDB
  if (p_conn) cddb_destroy(p_conn);
  cddb_disc_destroy(p_cddb_disc);
  libcddb_shutdown();
#endif /*HAVE_CDDB*/
  cdio_destroy (p_cdio);
  free (psz_device);
  exit (rc);
}
Example #5
0
Inputs::~Inputs()
{
	QFile::remove( AudioCDPlaylist );
	delete cdioDestroyTimer;
	libcddb_shutdown();
}
Example #6
0
 ~CddbInterfaceCleanup() {
     libcddb_shutdown();
 }
Example #7
0
AudioCD::~AudioCD()
{
	delete cdioDestroyTimer;
	libcddb_shutdown();
}
Example #8
0
/* FIXME: Cleanup track refs */
void common_cleanup(struct con_win *cwin)
{
	CDEBUG(DBG_INFO, "Cleaning up");

	if ((cwin->cstate->state == ST_STOPPED) && (cwin->cstate->curr_mobj_clear))
		delete_musicobject(cwin->cstate->curr_mobj);

	if ((cwin->cstate->state == ST_PLAYING) || (cwin->cstate->state == ST_PAUSED))
		stop_playback(cwin);

	save_preferences(cwin);

	g_object_unref(cwin->library_store);
	g_object_unref(cwin->pixbuf->image_play);
	g_object_unref(cwin->pixbuf->image_pause);

	if (cwin->pixbuf->pixbuf_app)
		g_object_unref(cwin->pixbuf->pixbuf_app);
	if (cwin->pixbuf->pixbuf_dir)
		g_object_unref(cwin->pixbuf->pixbuf_dir);
	if (cwin->pixbuf->pixbuf_artist)
		g_object_unref(cwin->pixbuf->pixbuf_artist);
	if (cwin->pixbuf->pixbuf_album)
		g_object_unref(cwin->pixbuf->pixbuf_album);
	if (cwin->pixbuf->pixbuf_track)
		g_object_unref(cwin->pixbuf->pixbuf_track);
	if (cwin->pixbuf->pixbuf_genre)
		g_object_unref(cwin->pixbuf->pixbuf_genre);

	g_slice_free(struct pixbuf, cwin->pixbuf);

	if (cwin->album_art)
		gtk_widget_destroy(cwin->album_art);

	if (cwin->cstate->cdda_drive)
		cdio_cddap_close(cwin->cstate->cdda_drive);
	if (cwin->cstate->cddb_disc)
		cddb_disc_destroy(cwin->cstate->cddb_disc);
	if (cwin->cstate->cddb_conn) {
		cddb_destroy(cwin->cstate->cddb_conn);
		libcddb_shutdown();
	}

	g_free(cwin->cpref->lw.lastfm_user);
	g_free(cwin->cpref->lw.lastfm_pass);
#ifdef HAVE_LIBGLYR
	g_free(cwin->cpref->cache_folder);
#endif
	g_free(cwin->cpref->configrc_file);
	g_free(cwin->cpref->installed_version);
	g_free(cwin->cpref->audio_sink);
	g_free(cwin->cpref->audio_alsa_device);
	g_free(cwin->cpref->audio_oss_device);
	g_free(cwin->cpref->album_art_pattern);
	g_free(cwin->cpref->audio_cd_device);
	g_free(cwin->cpref->start_mode);
	g_free(cwin->cpref->sidebar_pane);
	g_key_file_free(cwin->cpref->configrc_keyfile);
	free_str_list(cwin->cpref->library_dir);
	free_str_list(cwin->cpref->lib_add);
	free_str_list(cwin->cpref->lib_delete);
	free_str_list(cwin->cpref->library_tree_nodes);
	free_str_list(cwin->cpref->playlist_columns);
	g_slist_free(cwin->cpref->playlist_column_widths);
	g_slice_free(struct con_pref, cwin->cpref);

	g_rand_free(cwin->cstate->rand);
	g_free(cwin->cstate->last_folder);
	g_mutex_free(cwin->cstate->c_mutex);

	/* Hack, hack */
	if (g_mutex_trylock(cwin->cstate->l_mutex) == TRUE) {
		g_mutex_unlock(cwin->cstate->l_mutex);
		g_mutex_free(cwin->cstate->l_mutex);
	}
	g_cond_free(cwin->cstate->c_cond);
	g_slice_free(struct con_state, cwin->cstate);

#ifdef HAVE_LIBGLYR
	uninit_glyr_related (cwin);
#endif
	g_free(cwin->cdbase->db_file);
	sqlite3_close(cwin->cdbase->db);
	g_slice_free(struct con_dbase, cwin->cdbase);

	if (cwin->cstate->audio_init && cwin->cmixer)
		cwin->cmixer->deinit_mixer(cwin);
	if (cwin->clibao->ao_dev) {
		CDEBUG(DBG_INFO, "Freeing ao dev");
		ao_close(cwin->clibao->ao_dev);
	}
	ao_shutdown();
	g_slice_free(struct con_mixer, cwin->cmixer);
	g_slice_free(struct con_libao, cwin->clibao);

	g_free(cwin->clastfm->session_id);
	g_free(cwin->clastfm->submission_url);
	if (cwin->clastfm->curl_handle)
		curl_easy_cleanup(cwin->clastfm->curl_handle);
	curl_global_cleanup();
	g_slice_free(struct con_lastfm, cwin->clastfm);

	dbus_connection_remove_filter(cwin->con_dbus,
				      dbus_filter_handler,
				      cwin);
	dbus_bus_remove_match(cwin->con_dbus,
			      "type='signal',path='/org/pragha/DBus'",
			      NULL);
	dbus_connection_unref(cwin->con_dbus);

	#if HAVE_GLIB_2_26
	mpris_cleanup(cwin);
	#endif

	if (notify_is_initted())
		notify_uninit();

	#ifdef HAVE_LIBKEYBINDER
	keybinder_unbind("XF86AudioPlay", (KeybinderHandler) keybind_play_handler);
	keybinder_unbind("XF86AudioStop", (KeybinderHandler) keybind_stop_handler);
	keybinder_unbind("XF86AudioPrev", (KeybinderHandler) keybind_prev_handler);
	keybinder_unbind("XF86AudioNext", (KeybinderHandler) keybind_next_handler);
	keybinder_unbind("XF86AudioMedia", (KeybinderHandler) keybind_media_handler);
	#endif

	g_option_context_free(cwin->cmd_context);

	g_slice_free(struct con_win, cwin);
}