void audgui_infowin_show (int playlist, int entry) { char * filename = aud_playlist_entry_get_filename (playlist, entry); g_return_if_fail (filename != NULL); PluginHandle * decoder = aud_playlist_entry_get_decoder (playlist, entry, FALSE); if (decoder == NULL) goto FREE; if (aud_custom_infowin (filename, decoder)) goto FREE; Tuple * tuple = aud_playlist_entry_get_tuple (playlist, entry, FALSE); if (tuple == NULL) { char * message = g_strdup_printf (_("No info available for %s.\n"), filename); aud_interface_show_error (message); g_free (message); goto FREE; } infowin_show (playlist, entry, filename, tuple, decoder, aud_file_can_write_tuple (filename, decoder)); tuple_unref (tuple); FREE: str_unref (filename); }
static void confirm_delete (void) { int playlist = aud_playlist_get_active (); int entry_count = aud_playlist_entry_count (playlist); for (int i = 0; i < entry_count; i ++) { if (! aud_playlist_entry_get_selected (playlist, i)) continue; char * uri = aud_playlist_entry_get_filename (playlist, i); char * filename = uri_to_filename (uri); if (filename) { if (aud_get_bool ("delete_files", "use_trash")) move_to_trash (filename); else really_delete (filename); str_unref (filename); } else { SPRINTF (error, _("Error deleting %s: not a local file."), uri); aud_interface_show_error (error); } str_unref (uri); } aud_playlist_delete_selected (playlist); }
static void equalizerwin_read_winamp_eqf(VFSFile * file) { Index * presets = aud_import_winamp_presets (file); if (! presets) { SPRINTF (error, _("Error importing Winamp EQF file '%s'"), vfs_get_filename (file)); aud_interface_show_error (error); return; } if (! index_count (presets)) goto DONE; /* just get the first preset --asphyx */ EqualizerPreset * preset = index_get (presets, 0); equalizerwin_set_preamp(preset->preamp); for (int i = 0; i < AUD_EQUALIZER_NBANDS; i ++) equalizerwin_set_band(i, preset->bands[i]); equalizerwin_eq_changed(); DONE: index_free_full (presets, (IndexFreeFunc) aud_equalizer_preset_free); }
static void really_delete (const char * filename) { if (unlink (filename) < 0) { SPRINTF (error, _("Error deleting %s: %s."), filename, strerror (errno)); aud_interface_show_error (error); } }
static VFSFile * open_vfs_file(const gchar *filename, const gchar *mode) { VFSFile *file; if (!(file = vfs_fopen(filename, mode))) { SPRINTF (error, _("Error loading file '%s'"), filename); aud_interface_show_error (error); } return file; }
static void move_to_trash (const char * filename) { GFile * gfile = g_file_new_for_path (filename); GError * gerror = NULL; if (! g_file_trash (gfile, NULL, & gerror)) { SPRINTF (error, _("Error moving %s to trash: %s."), filename, gerror->message); aud_interface_show_error (error); g_error_free (gerror); } g_object_unref ((GObject *) gfile); }
//Scrobbling will only be enabled after the first connection test passed gpointer scrobbling_thread (gpointer input_data) { while (scrobbler_running) { if (migrate_config_requested) { if (treat_migrate_config() == FALSE) { aud_interface_show_error(_("Audacious is now using an improved version of the Last.fm Scrobbler.\nPlease check the Preferences for the Scrobbler plugin.")); } aud_set_string("scrobbler", "migrated", "true"); migrate_config_requested = FALSE; } else if (permission_check_requested) { treat_permission_check_request(); permission_check_requested = FALSE; } else if (invalidate_session_requested) { session_key = NULL; aud_set_string("scrobbler", "session_key", ""); invalidate_session_requested = FALSE; } else if (now_playing_requested) { if (scrobbling_enabled) { send_now_playing(); } now_playing_requested = FALSE; } else { if (scrobbling_enabled) { scrobble_cached_queue(); } //scrobbling may be disabled at this point if communication errors occur pthread_mutex_lock(&communication_mutex); if (scrobbling_enabled) { pthread_cond_wait(&communication_signal, &communication_mutex); pthread_mutex_unlock(&communication_mutex); } else { //We don't want to wait until receiving a signal to retry //if submitting the cache failed due to network problems pthread_mutex_unlock(&communication_mutex); if (scrobbler_test_connection() == FALSE || !scrobbling_enabled) { struct timeval curtime; struct timespec timeout; pthread_mutex_lock(&communication_mutex); gettimeofday(&curtime, NULL); timeout.tv_sec = curtime.tv_sec + 7; timeout.tv_nsec = curtime.tv_usec * 1000; pthread_cond_timedwait(&communication_signal, &communication_mutex, &timeout); pthread_mutex_unlock(&communication_mutex); } } } }//while(scrobbler_running) //reset all vars to their initial values free(received_data); received_data = NULL; received_data_size = 0; curl_easy_cleanup(curlHandle); curlHandle = NULL; scrobbling_enabled = TRUE; return NULL; }