+static char * GetDirByItemUIDs( char *psz_uid )
+{
+ char *psz_cachedir = config_GetUserDir(VLC_CACHE_DIR);
+ char *psz_dir;
+ if( asprintf( &psz_dir, "%s" DIR_SEP
+ "by-iiuid" DIR_SEP
+ "%s",
+ psz_cachedir, psz_uid ) == -1 )
+ {
+ psz_dir = NULL;
+ }
+ free( psz_cachedir );
+ return psz_dir;
+}
+
+static char * GetFileByItemUID( char *psz_dir, const char *psz_type )
+{
+ char *psz_file;
+ if( asprintf( &psz_file, "%s" DIR_SEP "%s", psz_dir, psz_type ) == -1 )
+ {
+ psz_file = NULL;
+ }
+ return psz_file;
+}
+
+int playlist_FindArtInCacheUsingItemUID( input_item_t *p_item )
+{
+ char *uid = input_item_GetInfo( p_item, "uid", "md5" );
+ if ( ! *uid )
+ {
+ free( uid );
+ return VLC_EGENERIC;
+ }
+
+ /* we have an input item uid set */
+ bool b_done = false;
+ char *psz_byuiddir = GetDirByItemUIDs( uid );
+ char *psz_byuidfile = GetFileByItemUID( psz_byuiddir, "arturl" );
+ free( psz_byuiddir );
+ if( psz_byuidfile )
+ {
+ FILE *fd = vlc_fopen( psz_byuidfile, "rb" );
+ if ( fd )
+ {
+ char sz_cachefile[2049];
+ /* read the cache hash url */
+ if ( fgets( sz_cachefile, 2048, fd ) != NULL )
+ {
+ input_item_SetArtURL( p_item, sz_cachefile );
+ b_done = true;
+ }
+ fclose( fd );
+ }
+ free( psz_byuidfile );
+ }
+ free( uid );
+ if ( b_done ) return VLC_SUCCESS;
+
+ return VLC_EGENERIC;
+}