~ubuntu-branches/ubuntu/utopic/rhythmbox/utopic-proposed

« back to all changes in this revision

Viewing changes to sources/itunesdb.h

Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*  arch-tag: Header for itunesdb parser, based on code from gtkpod */
2
 
/* Time-stamp: <2003-11-29 12:08:57 jcs>
3
 
|
4
 
|  Copyright (C) 2002-2003 Jorg Schuler <jcsjcs at users.sourceforge.net>
5
 
|  Part of the gtkpod project.
6
 
|
7
 
|  URL: http://gtkpod.sourceforge.net/
8
 
9
 
|  Most of the code in this file has been ported from the perl
10
 
|  script "mktunes.pl" (part of the gnupod-tools collection) written
11
 
|  by Adrian Ulrich <pab at blinkenlights.ch>.
12
 
|
13
 
|  gnupod-tools: http://www.blinkenlights.ch/cgi-bin/fm.pl?get=ipod
14
 
15
 
|  The code contained in this file is free software; you can redistribute
16
 
|  it and/or modify it under the terms of the GNU Lesser General Public
17
 
|  License as published by the Free Software Foundation; either version
18
 
|  2.1 of the License, or (at your option) any later version.
19
 
|  
20
 
|  This file is distributed in the hope that it will be useful,
21
 
|  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 
|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23
 
|  Lesser General Public License for more details.
24
 
|  
25
 
|  You should have received a copy of the GNU Lesser General Public
26
 
|  License along with this code; if not, write to the Free Software
27
 
|  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
 
29
 
|  iTunes and iPod are trademarks of Apple
30
 
31
 
|  This product is not supported/written/published by Apple!
32
 
|
33
 
|  $Id: itunesdb.h,v 1.1 2004/02/07 20:04:31 walters Exp $
34
 
*/
35
 
 
36
 
#ifndef __ITUNESDB_H__
37
 
#define __ITUNESDB_H__
38
 
 
39
 
#include <time.h>
40
 
 
41
 
/* Warning: iPodSong is the same as Track, but iPodPlaylist is different from
42
 
 * Playlist
43
 
 */
44
 
 
45
 
typedef struct
46
 
{
47
 
  gchar   *album;            /* album (utf8)          */
48
 
  gchar   *artist;           /* artist (utf8)         */
49
 
  gchar   *title;            /* title (utf8)          */
50
 
  gchar   *genre;            /* genre (utf8)          */
51
 
  gchar   *comment;          /* comment (utf8)        */
52
 
  gchar   *composer;         /* Composer (utf8)       */
53
 
  gchar   *fdesc;            /* ? (utf8)              */
54
 
  gchar   *ipod_path;        /* name of file on iPod: uses ":" instead of "/"*/
55
 
  gunichar2 *album_utf16;    /* album (utf16)         */
56
 
  gunichar2 *artist_utf16;   /* artist (utf16)        */
57
 
  gunichar2 *title_utf16;    /* title (utf16)         */
58
 
  gunichar2 *genre_utf16;    /* genre (utf16)         */
59
 
  gunichar2 *comment_utf16;  /* comment (utf16)       */
60
 
  gunichar2 *composer_utf16; /* Composer (utf16)      */
61
 
  gunichar2 *fdesc_utf16;    /* ? (utf16)             */
62
 
  gunichar2 *ipod_path_utf16;/* name of file on iPod: uses ":" instead of "/"*/
63
 
  gchar   *pc_path_utf8;     /* PC filename in utf8 encoding   */
64
 
  gchar   *pc_path_locale;   /* PC filename in locale encoding */
65
 
  guint32 ipod_id;           /* unique ID of track    */
66
 
  gint32  size;              /* size of file in bytes */
67
 
  gint32  oldsize;           /* used when updating tracks: size on iPod */
68
 
  gint32  tracklen;          /* Length of track in ms */
69
 
  gint32  cd_nr;             /* CD number             */
70
 
  gint32  cds;               /* number of CDs         */
71
 
  gint32  track_nr;          /* track number          */
72
 
  gint32  tracks;            /* number of tracks      */
73
 
  gint32  bitrate;           /* bitrate               */
74
 
  gint32  year;              /* year                  */
75
 
  gchar   *year_str;         /* year as string -- always identical to year */
76
 
  gint32  volume;            /* volume adjustment between -100 and +100    */
77
 
  guint32 time_played;       /* time of last play  (Mac type)              */
78
 
  guint32 time_modified;     /* time of last modification  (Mac type)      */
79
 
  guint32 rating;            /* star rating (stars * RATING_STEP (20))     */
80
 
  guint32 playcount;         /* number of times track was played           */
81
 
  guint32 recent_playcount;  /* times track was played since last sync     */
82
 
  gchar   *hostname;         /* name of host this file has been imported on*/
83
 
  gboolean transferred;      /* has file been transferred to iPod?         */
84
 
  gchar   *md5_hash;         /* md5 hash of file (or NULL)                 */
85
 
  gchar   *charset;          /* charset used for ID3 tags                  */
86
 
} iPodSong;
87
 
 
88
 
typedef struct
89
 
{
90
 
    gchar *name;            /* name of playlist in UTF8 */
91
 
    gunichar2 *name_utf16;  /* name of playlist in UTF16 */
92
 
    guint32 type;           /* 1: master play list (PL_TYPE_MPL) */
93
 
    GList *song_ids;       /* tracks in playlist (IDs of the tracks) */
94
 
} iPodPlaylist;
95
 
 
96
 
 
97
 
 
98
 
enum {
99
 
  MHOD_ID_TITLE = 1,
100
 
  MHOD_ID_PATH = 2,
101
 
  MHOD_ID_ALBUM = 3,
102
 
  MHOD_ID_ARTIST = 4,
103
 
  MHOD_ID_GENRE = 5,
104
 
  MHOD_ID_FDESC = 6,
105
 
  MHOD_ID_COMMENT = 8,
106
 
  MHOD_ID_COMPOSER = 12,
107
 
  MHOD_ID_PLAYLIST = 100
108
 
};
109
 
 
110
 
#define ITUNESDB_COPYBLK 65536      /* blocksize for cp () */
111
 
 
112
 
enum _iPodItemType {
113
 
        IPOD_ITEM_SONG,
114
 
        IPOD_ITEM_PLAYLIST
115
 
};
116
 
 
117
 
typedef enum _iPodItemType iPodItemType;
118
 
 
119
 
 
120
 
struct _iPodItem {
121
 
        iPodItemType type;
122
 
        gpointer data;
123
 
};
124
 
typedef struct _iPodItem iPodItem;
125
 
 
126
 
 
127
 
typedef struct _iPodParser iPodParser;
128
 
 
129
 
iPodItem *ipod_get_next_item (iPodParser *parser);
130
 
iPodParser *ipod_parser_new (const gchar *mount_point);
131
 
void ipod_parser_destroy (iPodParser *parser);
132
 
void ipod_item_destroy (iPodItem *item);
133
 
 
134
 
gchar *itunesdb_get_track_name_on_ipod (const gchar *path, iPodSong *s);
135
 
 
136
 
#ifdef ITUNESDB_WRITE
137
 
gboolean itunesdb_write (const gchar *path);
138
 
gboolean itunesdb_write_to_file (const gchar *filename);
139
 
gboolean itunesdb_copy_track_to_ipod (const gchar *path, Track *track,
140
 
                                      const gchar *pcfile);
141
 
gboolean itunesdb_cp (const gchar *from_file, const gchar *to_file);
142
 
#endif
143
 
 
144
 
guint32 itunesdb_time_get_mac_time (void);
145
 
time_t itunesdb_time_mac_to_host (guint32 mactime);
146
 
guint32 itunesdb_time_host_to_mac (time_t time);
147
 
#endif