Changeset 8dbb3f39280e6c97cfee687b266e64d63d96e420
- Timestamp:
- 06/24/07 02:22:18 (1 year ago)
- git-parent:
- Files:
-
- include/vlc_common.h (modified) (1 diff)
- include/vlc_meta.h (modified) (1 diff)
- modules/gui/qt4/components/infopanels.cpp (modified) (2 diffs)
- modules/gui/qt4/components/infopanels.hpp (modified) (2 diffs)
- modules/gui/qt4/dialogs/mediainfo.cpp (modified) (1 diff)
- modules/meta_engine/taglib.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_common.h
r10b303d r8dbb3f3 430 430 /* divers */ 431 431 typedef struct vlc_meta_t vlc_meta_t; 432 typedef struct meta_export_t meta_export_t; 432 433 433 434 /* Stats */ include/vlc_meta.h
r10b303d r8dbb3f3 228 228 }; 229 229 230 struct meta_export_t 231 { 232 input_item_t *p_item; 233 const char *psz_file; 234 }; 235 230 236 #define VLC_META_ENGINE_TITLE 0x00000001 231 237 #define VLC_META_ENGINE_ARTIST 0x00000004 modules/gui/qt4/components/infopanels.cpp
ref68043 r8dbb3f3 115 115 ADD_META_B( VLC_META_DESCRIPTION, description_text ); // Comment Two lines? 116 116 117 QPushButton *write = new QPushButton( qtr( "&Write" ) ); 118 l->addWidget( write, line, 0 ); 119 120 BUTTONACT( write, saveMeta() ); 121 117 122 /* ADD_META( TRACKID) DO NOT SHOW it */ 118 123 /* ADD_URI - DO not show it, done outside */ … … 126 131 MetaPanel::~MetaPanel() 127 132 { 133 } 134 135 void MetaPanel::saveMeta() 136 { 137 playlist_t *p_playlist; 138 139 meta_export_t p_export; 140 p_export.p_item = p_input; 141 142 /* we can write meta data only in a file */ 143 if( ( p_input->i_type == ITEM_TYPE_AFILE ) || \ 144 ( p_input->i_type == ITEM_TYPE_VFILE ) ) 145 /* some audio files are detected as video files */ 146 { 147 char *psz_uri = p_input->psz_uri; 148 if( !strncmp( psz_uri, "file://", 7 ) ) 149 psz_uri += 7; /* strlen("file://") = 7 */ 150 151 p_export.psz_file = strndup( psz_uri, PATH_MAX ); 152 } 153 else 154 return; 155 156 /* now we read the modified meta data */ 157 free( p_input->p_meta->psz_artist ); 158 p_input->p_meta->psz_artist = strdup( artist_text->text().toUtf8() ); 159 free( p_input->p_meta->psz_album ); 160 p_input->p_meta->psz_album = strdup( collection_text->text().toUtf8() ); 161 free( p_input->p_meta->psz_genre ); 162 p_input->p_meta->psz_genre = strdup( genre_text->text().toUtf8() ); 163 free( p_input->p_meta->psz_date ); 164 p_input->p_meta->psz_date = (char*) malloc(5); 165 snprintf( p_input->p_meta->psz_date, 5, "%d", date_text->value() ); 166 free( p_input->p_meta->psz_tracknum ); 167 p_input->p_meta->psz_tracknum = (char*) malloc(5); 168 snprintf( p_input->p_meta->psz_tracknum, 5, "%d", seqnum_text->value() ); 169 free( p_input->p_meta->psz_title ); 170 p_input->p_meta->psz_title = strdup( title_text->text().toUtf8() ); 171 172 p_playlist = pl_Yield( p_intf ); 173 174 PL_LOCK; 175 p_playlist->p_private = &p_export; 176 177 module_t *p_mod = module_Need( p_playlist, "meta writer", NULL, 0 ); 178 if( p_mod ) 179 module_Unneed( p_playlist, p_mod ); 180 PL_UNLOCK; 181 pl_Release( p_playlist ); 128 182 } 129 183 modules/gui/qt4/components/infopanels.hpp
rdabe66a r8dbb3f3 54 54 MetaPanel( QWidget *, intf_thread_t * ); 55 55 virtual ~MetaPanel(); 56 input_item_t *p_input; 56 57 private: 57 58 intf_thread_t *p_intf; … … 75 76 void update( input_item_t * ); 76 77 void clear(); 78 void saveMeta(); 77 79 signals: 78 80 void uriSet( QString ); modules/gui/qt4/dialogs/mediainfo.cpp
rdabe66a r8dbb3f3 143 143 bool update_meta ) 144 144 { 145 MP->p_input = p_item; 145 146 if( update_info ) 146 147 IP->update( p_item ); modules/meta_engine/taglib.cpp
r10b303d r8dbb3f3 167 167 } 168 168 169 #define SET(a,b) if(b) tag->set##a( b ); 170 169 171 static int WriteMeta( vlc_object_t *p_this ) 170 172 { 171 input_item_t *p_item = (input_item_t *)p_this; 172 173 char *psz_uri = p_item->psz_uri; 174 /* we can write meta data only in a file */ 175 if( !strncmp( psz_uri, "file://", 7 ) ) 176 psz_uri += 7; 177 /* if the file is specified with its path, not prefixed with file:// */ 178 else if( strncmp( psz_uri, "/", 1 ) ) 179 return VLC_EGENERIC; 180 181 TagLib::FileRef f( psz_uri ); 173 playlist_t *p_playlist = (playlist_t *)p_this; 174 meta_export_t *p_export = (meta_export_t *)p_playlist->p_private; 175 input_item_t *p_item = p_export->p_item; 176 177 TagLib::FileRef f( p_export->psz_file ); 182 178 if( !f.isNull() && f.tag() ) 183 179 { 184 180 TagLib::Tag *tag = f.tag(); 185 tag->setArtist(p_item->p_meta->psz_artist );181 SET( Artist, p_item->p_meta->psz_artist ); 186 182 if( p_item->p_meta->psz_title ) 187 183 tag->setTitle( p_item->p_meta->psz_title ); 188 184 else 189 185 tag->setTitle( p_item->psz_name ); 190 tag->setAlbum(p_item->p_meta->psz_album );191 tag->setGenre(p_item->p_meta->psz_genre );186 SET( Album, p_item->p_meta->psz_album ); 187 SET( Genre, p_item->p_meta->psz_genre ); 192 188 if( p_item->p_meta->psz_date ) 193 189 tag->setYear( atoi( p_item->p_meta->psz_date ) ); … … 197 193 return VLC_SUCCESS; 198 194 } 195 msg_Err( p_this, "File %s can't be opened for tag writing\n", 196 p_export->psz_file ); 199 197 return VLC_EGENERIC; 200 198 }
