libmp3splt
src/cddb_cue_common.c
Go to the documentation of this file.
00001 /**********************************************************
00002  * libmp3splt -- library based on mp3splt,
00003  *               for mp3/ogg splitting without decoding
00004  *
00005  * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
00006  * Copyright (c) 2005-2010 Alexandru Munteanu - io_fx@yahoo.fr
00007  *
00008  *********************************************************/
00009 
00010 /**********************************************************
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00024  * 02111-1307, USA.
00025  *********************************************************/
00026 
00032 #include <string.h>
00033 
00034 #include "splt.h"
00035 
00041 void splt_cc_put_filenames_from_tags(splt_state *state, int tracks, int *error)
00042 {
00043   int err = splt_tu_copy_first_common_tags_on_all_tracks(state, tracks);
00044   if (err < 0) { *error = err; return; }
00045 
00046   if (splt_o_get_int_option(state, SPLT_OPT_OUTPUT_FILENAMES) == SPLT_OUTPUT_DEFAULT)
00047   {
00048     splt_of_set_oformat(state, SPLT_DEFAULT_CDDB_CUE_OUTPUT, error, SPLT_TRUE);
00049     if (*error < 0) { return; }
00050   }
00051 
00052   err = splt_of_reparse_oformat(state);
00053   if (err < 0) { *error = err; return; }
00054 
00055   splt_of_set_oformat_digits_tracks(state, tracks);
00056 
00057   if (err < 0) { *error = err; return; }
00058 
00059   splt_t_set_current_split(state, 0);
00060   int current_split = 0;
00061 
00062   do {
00063     err = splt_u_finish_tags_and_put_output_format_filename(state, current_split);
00064     if (err != SPLT_OK) { *error = err; return; }
00065 
00066     splt_t_current_split_next(state);
00067     current_split = splt_t_get_current_split(state);
00068   } while (current_split < tracks);
00069 }
00070 
00071