File: display_itdb.h

package info (click to toggle)
gtkpod 0.99.14-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,716 kB
  • ctags: 3,266
  • sloc: ansic: 43,120; sh: 4,837; xml: 1,316; lex: 637; perl: 264; makefile: 236; awk: 73; python: 35
file content (168 lines) | stat: -rw-r--r-- 6,676 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
|  Copyright (C) 2002-2007 Jorg Schuler <jcsjcs at users sourceforge net>
|  Part of the gtkpod project.
| 
|  URL: http://www.gtkpod.org/
|  URL: http://gtkpod.sourceforge.net/
|
|  This program is free software; you can redistribute it and/or modify
|  it under the terms of the GNU General Public License as published by
|  the Free Software Foundation; either version 2 of the License, or
|  (at your option) any later version.
| 
|  This program is distributed in the hope that it will be useful,
|  but WITHOUT ANY WARRANTY; without even the implied warranty of
|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
|  GNU General Public License for more details.
| 
|  You should have received a copy of the GNU General Public License
|  along with this program; if not, write to the Free Software
|  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
| 
|  iTunes and iPod are trademarks of Apple
| 
|  This product is not supported/written/published by Apple!
|
|  $Id: display_itdb.h 2148 2008-11-08 08:02:15Z jcsjcs $
*/

#ifndef __DISPLAY_ITDB_H__
#define __DISPLAY_ITDB_H__

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>
#include "itdb.h"
#include "file_convert.h"

struct itdbs_head
{
    GList *itdbs;
};

typedef struct
{
    struct itdbs_head *itdbs_head; /* pointer to the master itdbs_head     */
    GHashTable *sha1hash;          /* sha1 hash information                */
    GHashTable *pc_path_hash;      /* hash with local filenames            */
    GList *pending_deletion;       /* tracks marked for removal from
				      media                                */
    gchar *offline_filename;       /* filename for offline database
				      (only for GP_ITDP_TYPE_IPOD)         */
    gboolean offline;              /* offline mode?                        */
    gboolean data_changed;         /* data changed since import?           */
    gboolean photo_data_changed;	/* photo data changed since import?		*/
    gboolean itdb_imported;        /* has in iTunesDB been imported?       */
    gboolean ipod_ejected;         /* if iPod was ejected                  */
    PhotoDB *photodb;            /* Photo DB reference used if the ipod supports photos */
} ExtraiTunesDBData;

typedef struct
{
    glong size;
} ExtraPlaylistData;

typedef struct
{
  gchar   *year_str;        /* year as string -- always identical to year  */
  gchar   *pc_path_locale;  /* path on PC (local encoding)                 */
  gchar   *pc_path_utf8;    /* PC filename in utf8 encoding                */
  time_t  mtime;            /* modification date of PC file                */
  gboolean pc_path_hashed;  /* for programming error detection (see
			       gp_itdb_local_path_hash_add_track()         */
  gchar   *converted_file;  /* if converted file exists: name in utf8      */
  gint32  orig_filesize;    /* size of original file (if converted)        */
  FileConvertStatus conversion_status; /* current status of conversion     */
  gchar   *thumb_path_locale;/* same for thumbnail                         */
  gchar   *thumb_path_utf8;  /* same for thumbnail                         */
  gchar   *hostname;        /* name of host this file has been imported on */
  gchar   *sha1_hash;       /* sha1 hash of file (or NULL)                 */
  gchar   *charset;         /* charset used for ID3 tags                   */
  gint32  sortindex;        /* used for stable sorting (current order)     */
  gboolean tchanged;        /* temporary use, e.g. in detail.c             */
  gboolean tartwork_changed;			/* temporary use for artwork, eg. in detail.c          */
  guint64 local_itdb_id;    /* when using DND from local to iPod:
			       original itdb                               */
  guint64 local_track_dbid; /* when using DND from local to iPod:
			       original track                              */
  gchar   *lyrics;          /* Lyrics information as read from file or as
			       updated in the program                      */
} ExtraTrackData;

/* types for iTunesDB */
typedef enum
{
    GP_ITDB_TYPE_LOCAL = 1<<0,    /* local browsing, normal music */
    GP_ITDB_TYPE_IPOD  = 1<<1,    /* iPod                         */
    GP_ITDB_TYPE_PODCASTS = 1<<2, /* local browsing, podcasts     */
    GP_ITDB_TYPE_AUTOMATIC = 1<<3,/* repository was automounted   */
} GpItdbType;

/* Delete actions */
typedef enum
{
    /* remove from playlist only -- cannot be used on MPL */
    DELETE_ACTION_PLAYLIST = 0,
    /* remove from iPod (implicates removing from database) */
    DELETE_ACTION_IPOD,
    /* remove from local harddisk (implicates removing from database) */
    DELETE_ACTION_LOCAL,
    /* remove from database only */
    DELETE_ACTION_DATABASE
} DeleteAction;

struct DeleteData
{
    iTunesDB *itdb;
    Playlist *pl;
    GList *tracks;
    DeleteAction deleteaction;
};

void init_data (GtkWidget *window);
iTunesDB *setup_itdb_n (gint i);

struct itdbs_head *gp_get_itdbs_head (GtkWidget *gtkpod_win);

iTunesDB *gp_itdb_new (void);
void gp_itdb_add (iTunesDB *itdb, gint pos);
void gp_itdb_remove (iTunesDB *itdb);
void gp_itdb_free (iTunesDB *itdb);
void gp_replace_itdb (iTunesDB *old_itdb, iTunesDB *new_itdb);
void gp_itdb_add_extra (iTunesDB *itdb);
void gp_itdb_add_extra_full (iTunesDB *itdb);

Track *gp_track_new (void);
#define gp_track_free itdb_track_free
Track *gp_track_add (iTunesDB *itdb, Track *track);
void gp_track_remove (Track *track);
void gp_track_unlink (Track *track);
void gp_track_add_extra (Track *track);
void gp_track_validate_entries (Track *track);
gboolean gp_track_set_thumbnails (Track *track, const gchar *filename);
gboolean gp_track_set_thumbnails_from_data (Track *track,
					    const guchar *image_data,
					    gsize image_data_len);
gboolean gp_track_remove_thumbnails (Track *track);

Playlist *gp_playlist_new (const gchar *title, gboolean spl);
void gp_playlist_add (iTunesDB *itdb, Playlist *pl, gint32 pos);
void gp_playlist_remove (Playlist *pl);
guint gp_playlist_remove_by_name (iTunesDB *itdb, gchar *pl_name);
Playlist *gp_playlist_add_new (iTunesDB *itdb, gchar *name,
			       gboolean spl, gint32 pos);
Playlist *gp_playlist_by_name_or_add (iTunesDB *itdb, gchar *pl_name,
				      gboolean spl);
void gp_playlist_remove_track (Playlist *plitem, Track *track,
			       DeleteAction deleteaction);
void gp_playlist_add_track (Playlist *pl, Track *track, gboolean display);

void gp_playlist_add_extra (Playlist *pl);

gboolean gp_increase_playcount (gchar *sha1, gchar *file, gint num);
iTunesDB *gp_get_selected_itdb (void);
iTunesDB *gp_get_ipod_itdb (void);
iTunesDB *gp_get_podcast_itdb (void);
#endif