1 /* Time-stamp: <2008-11-08 18:11:02 jcs> 2 | 3 | Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net> 4 | Part of the gtkpod project. 5 | 6 | URL: http://www.gtkpod.org/ 7 | URL: http://gtkpod.sourceforge.net/ 8 | 9 | This program is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation; either version 2 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 | 23 | iTunes and iPod are trademarks of Apple 24 | 25 | This product is not supported/written/published by Apple! 26 | 27 | $Id$ 28 */ 29 30 #ifndef __FILE_H__ 31 #define __FILE_H__ 32 33 #ifdef HAVE_CONFIG_H 34 # include <config.h> 35 #endif 36 37 #include <gtk/gtk.h> 38 #include <stdio.h> 39 #include "itdb.h" 40 41 42 /* values below -1 may be used in individual functions */ 43 typedef enum 44 { 45 FILE_TYPE_UNKNOWN = 0, 46 FILE_TYPE_MP3, 47 FILE_TYPE_M4A, 48 FILE_TYPE_M4P, 49 FILE_TYPE_M4B, 50 FILE_TYPE_WAV, 51 FILE_TYPE_M4V, 52 FILE_TYPE_MP4, 53 FILE_TYPE_MOV, 54 FILE_TYPE_MPG, 55 FILE_TYPE_M3U, 56 FILE_TYPE_OGG, 57 FILE_TYPE_FLAC, 58 FILE_TYPE_PLS, 59 FILE_TYPE_IMAGE, 60 FILE_TYPE_DIRECTORY 61 } FileType; 62 63 64 /* Don't change the order of this enum -- when exporting playlists the 65 file requester depends on having these in order because the toggle 66 buttons are arranged that way */ 67 typedef enum 68 { 69 SOURCE_PREFER_LOCAL = 0, 70 SOURCE_LOCAL, 71 SOURCE_IPOD, 72 SOURCE_PREFER_IPOD 73 } FileSource; 74 75 76 typedef void (*AddTrackFunc)(Playlist *plitem, Track *track, gpointer data); 77 78 FileType determine_file_type (const gchar *path); 79 gboolean add_track_by_filename (iTunesDB *itdb, gchar *name, 80 Playlist *plitem, gboolean descend, 81 AddTrackFunc addtrackfunc, gpointer data); 82 gboolean add_directory_by_name (iTunesDB *itdb, gchar *name, 83 Playlist *plitem, gboolean descend, 84 AddTrackFunc addtrackfunc, gpointer data); 85 Playlist *add_playlist_by_filename (iTunesDB *itdb, gchar *plfile, 86 Playlist *plitem, gint plitem_pos, 87 AddTrackFunc addtrackfunc, 88 gpointer data); 89 gboolean write_tags_to_file(Track *s); 90 void update_track_from_file (iTunesDB *itdb, Track *track); 91 void update_tracks (GList *selected_tracks); 92 void mserv_from_file_tracks (GList *selected_tracks); 93 void display_non_updated (Track *track, gchar *txt); 94 void display_updated (Track *track, gchar *txt); 95 void display_mserv_problems (Track *track, gchar *txt); 96 iTunesDB *gp_import_itdb (iTunesDB *old_itdb, const gint type, 97 const gchar *mp, const gchar *name_off, 98 const gchar *name_loc); 99 void gp_load_ipods (void); 100 iTunesDB *gp_load_ipod (iTunesDB *itdb); 101 gboolean gp_eject_ipod(iTunesDB *itdb); 102 gboolean gp_save_itdb (iTunesDB *itdb); 103 void handle_export (void); 104 void data_changed (iTunesDB *itdb); 105 void data_unchanged (iTunesDB *itdb); 106 gboolean files_are_saved (void); 107 gchar *get_file_name_from_source (Track *track, FileSource source); 108 gchar* get_preferred_track_name_format(Track *s); 109 void mark_track_for_deletion (iTunesDB *itdb, Track *track); 110 void gp_info_deleted_tracks (iTunesDB *itdb, 111 gdouble *size, guint32 *num); 112 void update_charset_info (Track *track); 113 void parse_offline_playcount (void); 114 115 gboolean read_soundcheck (Track *track); 116 117 /* file_export.c */ 118 void export_files_init (GList *tracks, GList **filenames, 119 gboolean display, gchar *message); 120 void export_playlist_file_init (GList *tracks); 121 GList *export_tracklist_when_necessary (iTunesDB *itdb_s, 122 iTunesDB *itdb_d, 123 gchar *data); 124 GList *export_trackglist_when_necessary (iTunesDB *itdb_s, 125 iTunesDB *itdb_d, 126 GList *tracks); 127 gboolean read_lyrics_from_file (Track *track, gchar **lyrics); 128 gboolean write_lyrics_to_file (Track *track); 129 /* needed to adapt the prefs structure */ 130 extern const gchar *EXPORT_FILES_SPECIAL_CHARSET; 131 extern const gchar *EXPORT_FILES_CHECK_EXISTING; 132 extern const gchar *EXPORT_FILES_PATH; 133 extern const gchar *EXPORT_FILES_TPL; 134 #endif 135