Changeset e398a81bd261feaada934e7b402b5fed57646593
- Timestamp:
- 24/09/06 22:51:56 (2 years ago)
- git-parent:
- Files:
-
- include/vlc_input.h (modified) (1 diff)
- include/vlc_meta.h (modified) (1 diff)
- include/vlc_symbols.h (modified) (3 diffs)
- modules/meta_engine/Modules.am (modified) (1 diff)
- modules/meta_engine/dummy.c (deleted)
- modules/meta_engine/folder.c (modified) (2 diffs)
- modules/meta_engine/musicbrainz.c (modified) (2 diffs)
- src/input/meta.c (modified) (8 diffs)
- src/input/subtitles.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_input.h
rbd3484b re398a81 539 539 VLC_EXPORT( vlc_bool_t, input_AddSubtitles, ( input_thread_t *, char *, vlc_bool_t ) ); 540 540 541 VLC_EXPORT( int, input_DownloadAndCacheArt, ( vlc_object_t *p_parent, input_item_t *p_item ) ); 542 543 541 544 #endif include/vlc_meta.h
rbd3484b re398a81 226 226 }; 227 227 228 VLC_EXPORT( uint32_t, input_GetMetaEngineFlags, ( vlc_meta_t *p_meta ) ); 229 228 230 #endif include/vlc_symbols.h
rbd3484b re398a81 545 545 void (*input_ItemAddOptionNoDup_inner) (input_item_t *, const char *); 546 546 int (*__input_MetaFetch_inner) (vlc_object_t *, input_item_t *); 547 int (*input_DownloadAndCacheArt_inner) (vlc_object_t *p_parent, input_item_t *p_item); 548 uint32_t (*input_GetMetaEngineFlags_inner) (vlc_meta_t *p_meta); 547 549 }; 548 550 # if defined (__PLUGIN__) … … 1019 1021 # define input_ItemAddOptionNoDup (p_symbols)->input_ItemAddOptionNoDup_inner 1020 1022 # define __input_MetaFetch (p_symbols)->__input_MetaFetch_inner 1023 # define input_DownloadAndCacheArt (p_symbols)->input_DownloadAndCacheArt_inner 1024 # define input_GetMetaEngineFlags (p_symbols)->input_GetMetaEngineFlags_inner 1021 1025 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) 1022 1026 /****************************************************************** … … 1496 1500 ((p_symbols)->input_ItemAddOptionNoDup_inner) = input_ItemAddOptionNoDup; \ 1497 1501 ((p_symbols)->__input_MetaFetch_inner) = __input_MetaFetch; \ 1502 ((p_symbols)->input_DownloadAndCacheArt_inner) = input_DownloadAndCacheArt; \ 1503 ((p_symbols)->input_GetMetaEngineFlags_inner) = input_GetMetaEngineFlags; \ 1498 1504 (p_symbols)->net_ConvertIPv4_deprecated = NULL; \ 1499 1505 (p_symbols)->vlc_input_item_GetInfo_deprecated = NULL; \ modules/meta_engine/Modules.am
rb45afc2 re398a81 1 1 SOURCES_musicbrainz = musicbrainz.c 2 SOURCES_dummy = dummy.c3 2 SOURCES_folder = folder.c 4 3 SOURCES_taglib = taglib.cpp modules/meta_engine/folder.c
r6d6d53e re398a81 68 68 input_item_t *p_item = p_me->p_item; 69 69 vlc_bool_t b_have_art = VLC_FALSE; 70 uint32_t i_meta; 70 71 71 72 if( !p_item->p_meta ) return VLC_EGENERIC; … … 124 125 } 125 126 126 return VLC_SUCCESS; 127 i_meta = input_GetMetaEngineFlags( p_item->p_meta ); 128 p_me->i_mandatory &= ~i_meta; 129 p_me->i_optional &= ~i_meta; 130 if( p_me->i_mandatory ) 131 return VLC_EGENERIC; 132 else 133 return VLC_SUCCESS; 127 134 } modules/meta_engine/musicbrainz.c
r6d6d53e re398a81 68 68 char i_album_count, i; 69 69 char *ppsz_args[4]; 70 uint32_t i_meta; 70 71 71 72 if( !p_item->p_meta ) return VLC_EGENERIC; … … 133 134 mb_Delete( p_mb ); 134 135 135 return VLC_SUCCESS; 136 i_meta = input_GetMetaEngineFlags( p_item->p_meta ); 137 p_me->i_mandatory &= ~i_meta; 138 p_me->i_optional &= ~i_meta; 139 if( p_me->i_mandatory ) 140 return VLC_EGENERIC; 141 else 142 return VLC_SUCCESS; 136 143 } src/input/meta.c
rbd3484b re398a81 33 33 #endif 34 34 35 int input_FindArt( vlc_object_t *p_parent, input_item_t *p_item ); 36 35 37 int __input_MetaFetch( vlc_object_t *p_parent, input_item_t *p_item ) 36 38 { 37 39 struct meta_engine_t *p_me; 38 39 /* FIXME: don't launch any module if we already have all the needed 40 * info. Easiest way to do this would be to add a dummy module. 41 * I'll do that later */ 40 uint32_t i_mandatory = 0, i_optional = 0, i_meta; 41 int i_policy; 42 43 if( !p_item->p_meta ) return VLC_EGENERIC; 44 45 i_policy = var_CreateGetInteger( p_parent, "album-art" ); 46 47 i_mandatory = VLC_META_ENGINE_TITLE 48 | VLC_META_ENGINE_ARTIST; 49 if( i_policy == ALBUM_ART_ALL ) 50 { 51 i_mandatory |= VLC_META_ENGINE_ART_URL; 52 } 53 else 54 { 55 i_optional |= VLC_META_ENGINE_ART_URL; 56 } 57 58 input_FindArt( p_parent, p_item ); 59 60 i_meta = input_GetMetaEngineFlags( p_item->p_meta ); 61 i_mandatory &= ~i_meta; 62 i_optional &= ~i_meta; 63 64 if( !i_mandatory ) return VLC_SUCCESS; 42 65 43 66 p_me = vlc_object_create( p_parent, VLC_OBJECT_META_ENGINE ); 44 67 p_me->i_flags |= OBJECT_FLAGS_NOINTERACT; 45 p_me->i_mandatory = VLC_META_ENGINE_TITLE 46 | VLC_META_ENGINE_ARTIST; 47 p_me->i_optional = 0; 48 /* 49 if( var_CreateGetInteger( p_parent, "album-art" ) != ALBUM_ART_NEVER ) 50 { 51 p_me->i_mandatory |= VLC_META_ENGINE_ART_URL; 52 } 53 else 54 { 55 p_me->i_optional |= VLC_META_ENGINE_ART_URL; 56 } 57 */ 68 p_me->i_mandatory = i_mandatory; 69 p_me->i_optional = i_optional; 70 58 71 p_me->p_item = p_item; 59 72 p_me->p_module = module_Need( p_me, "meta fetcher", 0, VLC_FALSE ); … … 61 74 if( !p_me->p_module ) 62 75 { 63 msg_Err( p_parent, "no suitable meta enginemodule" );76 msg_Err( p_parent, "no suitable meta fetcher module" ); 64 77 vlc_object_detach( p_me ); 65 78 vlc_object_destroy( p_me ); … … 69 82 module_Unneed( p_me, p_me->p_module ); 70 83 84 vlc_object_detach( p_me ); 71 85 vlc_object_destroy( p_me ); 72 86 … … 83 97 char *psz_type; 84 98 char psz_filename[MAX_PATH]; 85 int i _ret;99 int i; 86 100 struct stat a; 101 const char ppsz_type[] = { ".jpg", ".png", ".gif", ".bmp", "" }; 87 102 88 103 if( !p_item->p_meta ) return VLC_EGENERIC; … … 91 106 psz_album = p_item->p_meta->psz_album; 92 107 93 //FIXME !!!!! 94 psz_type = strdup( "jpg" ); 95 96 snprintf( psz_filename, MAX_PATH, 97 "file://%s" DIR_SEP CONFIG_DIR DIR_SEP "art" 98 DIR_SEP "%s" DIR_SEP "%s" DIR_SEP "art%s", 99 p_parent->p_libvlc->psz_homedir, 100 psz_artist, psz_album, psz_type ); 101 102 /* Check if file exists */ 103 i_ret = utf8_stat( psz_filename+7, &a ); 104 if( i_ret == 0 ) 105 { 106 msg_Dbg( p_parent, "album art %s already exists in cache" 107 , psz_filename ); 108 return VLC_SUCCESS; 109 } 110 else 111 { 112 /* Use a art finder module to find the URL */ 113 return VLC_EGENERIC; 114 } 108 for( i = 0; i < 5; i++ ) 109 { 110 snprintf( psz_filename, MAX_PATH, 111 "file://%s" DIR_SEP CONFIG_DIR DIR_SEP "art" 112 DIR_SEP "%s" DIR_SEP "%s" DIR_SEP "art%s", 113 p_parent->p_libvlc->psz_homedir, 114 psz_artist, psz_album, psz_type ); 115 116 /* Check if file exists */ 117 if( utf8_stat( psz_filename+7, &a ) == 0 ) 118 { 119 msg_Dbg( p_parent, "album art %s already exists in cache" 120 , psz_filename ); 121 return VLC_SUCCESS; 122 } 123 } 124 125 /* Use a art finder module to find the URL */ 126 return VLC_EGENERIC; 115 127 } 116 128 … … 122 134 { 123 135 int i_status = VLC_EGENERIC; 124 int i_ret;125 struct stat a;126 136 stream_t *p_stream; 127 137 char psz_filename[MAX_PATH], psz_dir[MAX_PATH]; … … 136 146 || !*p_item->p_meta->psz_arturl ) 137 147 return VLC_EGENERIC; 148 149 psz_type = strrchr( p_item->p_meta->psz_arturl, '.' ); 138 150 139 151 /* Todo: get a helper to do this */ … … 182 194 return i_status; 183 195 } 196 197 uint32_t input_GetMetaEngineFlags( vlc_meta_t *p_meta ) 198 { 199 uint32_t i_meta = 0; 200 201 #define CHECK( a, b ) \ 202 if( p_meta->psz_ ## a && *p_meta->psz_ ## a ) \ 203 i_meta |= VLC_META_ENGINE_ ## b; 204 205 CHECK( title, TITLE ) 206 CHECK( author, AUTHOR ) 207 CHECK( artist, ARTIST ) 208 CHECK( genre, GENRE ) 209 CHECK( copyright, COPYRIGHT ) 210 CHECK( album, COLLECTION ) 211 CHECK( tracknum, SEQ_NUM ) 212 CHECK( description, DESCRIPTION ) 213 CHECK( rating, RATING ) 214 CHECK( date, DATE ) 215 CHECK( url, URL ) 216 CHECK( language, LANGUAGE ) 217 CHECK( arturl, ART_URL ) 218 219 return i_meta; 220 } src/input/subtitles.c
r666dc08 re398a81 46 46 47 47 #include <ctype.h> 48 49 /**50 * What's between a directory and a filename?51 */52 #if defined( WIN32 )53 #define DIRECTORY_SEPARATOR '\\'54 #else55 #define DIRECTORY_SEPARATOR '/'56 #endif57 48 58 49 /** … … 232 223 psz_subdir, 233 224 psz_subdir[strlen(psz_subdir) - 1] == 234 DIR ECTORY_SEPARATOR ? '\0' : DIRECTORY_SEPARATOR);225 DIR_SEP ? '\0' : DIR_SEP ); 235 226 subdirs[i] = psz_temp; 236 227 i++; … … 287 278 288 279 /* extract filename & dirname from psz_fname */ 289 tmp = strrchr( psz_fname, DIR ECTORY_SEPARATOR);280 tmp = strrchr( psz_fname, DIR_SEP ); 290 281 if( tmp ) 291 282 { … … 314 305 dirlen = strlen( f_dir ); 315 306 f_dir = (char *)realloc(f_dir, dirlen +2 ); 316 f_dir[dirlen] = DIR ECTORY_SEPARATOR;307 f_dir[dirlen] = DIR_SEP; 317 308 f_dir[dirlen+1] = '\0'; 318 309 f_fname = FromLocaleDup( psz_fname );
