When reading a file:// URL from an xspf entry, store the decoded file path; else store the unmodified URL
Always keep album art URLs always encoded and decode the path when needed
Interfaces & plugins only use file paths
Playlist core extract attachment:// URLs (from file meta data), http:// or other (from meta data fetchers like lua) and cache them to a file
Thanks to courmisch for clarification
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit
a654d4a14edf1a3925cfa731c965652832f01ef2)
12 files changed:
#include "http.h"
#include <vlc_plugin.h>
#include "http.h"
#include <vlc_plugin.h>
psz_art = input_item_GetArtURL( p_item );
}
psz_art = input_item_GetArtURL( p_item );
}
- if( psz_art && !strncmp( psz_art, "file://", strlen( "file://" ) ) )
+ if( psz_art && !strncmp( psz_art, "file://", strlen( "file://" ) ) &&
+ decode_URI( psz_art + 7 ) )
{
FILE *f;
char *psz_ext;
{
FILE *f;
char *psz_ext;
/* special case: location */
if( !strcmp( p_handler->name, "location" ) )
{
/* special case: location */
if( !strcmp( p_handler->name, "location" ) )
{
- char *psz_uri = NULL;
- psz_uri = decode_URI_duplicate( psz_value );
+ char *psz_location = psz_value;
+ if( !strncmp( psz_value, "file://", 7 ) )
+ psz_location = decode_URI( psz_value + 7 );
{
FREE_ATT();
return false;
}
{
FREE_ATT();
return false;
}
- if( p_demux->p_sys->psz_base && !strstr( psz_uri, "://" ) )
+ if( p_demux->p_sys->psz_base && !strstr( psz_value, "://" ) )
{
char* psz_tmp;
if( asprintf( &psz_tmp, "%s%s", p_demux->p_sys->psz_base,
{
char* psz_tmp;
if( asprintf( &psz_tmp, "%s%s", p_demux->p_sys->psz_base,
FREE_ATT();
return NULL;
}
FREE_ATT();
return NULL;
}
- free( psz_uri );
- psz_uri = psz_tmp;
+ input_item_SetURI( p_new_input, psz_tmp );
+ free( psz_tmp );
- input_item_SetURI( p_new_input, psz_uri );
- free( psz_uri );
+ else
+ input_item_SetURI( p_new_input, psz_location );
input_item_CopyOptions( p_input_item, p_new_input );
input_item_CopyOptions( p_input_item, p_new_input );
FREE_ATT();
p_handler = NULL;
}
FREE_ATT();
p_handler = NULL;
}
}
else if( !strcmp( psz_name, "image" ) )
{
}
else if( !strcmp( psz_name, "image" ) )
{
- char *psz_uri = decode_URI_duplicate( psz_value );
- input_item_SetArtURL( p_input, psz_uri );
- free( psz_uri );
+ input_item_SetArtURL( p_input, psz_value );
#include "intf.h"
#include "playlistinfo.h"
#include "playlist.h"
#include "intf.h"
#include "playlistinfo.h"
#include "playlist.h"
/*****************************************************************************
* VLCPlaylistInfo Implementation
/*****************************************************************************
* VLCPlaylistInfo Implementation
char *psz_meta;
NSImage *o_image;
psz_meta = input_item_GetArtURL( p_item );
char *psz_meta;
NSImage *o_image;
psz_meta = input_item_GetArtURL( p_item );
- if( psz_meta && !strncmp( psz_meta, "file://", 7 ) )
+ if( psz_meta && !strncmp( psz_meta, "file://", 7 ) && decode_URI( psz_meta + 7 ) )
o_image = [[NSImage alloc] initWithContentsOfFile: [NSString stringWithUTF8String: psz_meta+7]];
else
o_image = [[NSImage imageNamed: @"noart.png"] retain];
o_image = [[NSImage alloc] initWithContentsOfFile: [NSString stringWithUTF8String: psz_meta+7]];
else
o_image = [[NSImage imageNamed: @"noart.png"] retain];
#include "input_manager.hpp"
#include <vlc_keys.h>
#include "input_manager.hpp"
#include <vlc_keys.h>
if( hasInput() )
{
char *psz_art = input_item_GetArtURL( input_GetItem( p_input ) );
if( hasInput() )
{
char *psz_art = input_item_GetArtURL( input_GetItem( p_input ) );
+ if( psz_art && !strncmp( psz_art, "file://", 7 ) &&
+ decode_URI( psz_art + 7 ) )
+ url = qfu( psz_art + 7);
free( psz_art );
url = url.replace( "file://", "" );
free( psz_art );
url = url.replace( "file://", "" );
case 0:
/* Windows Folder.jpg */
snprintf( psz_filename, MAX_PATH,
case 0:
/* Windows Folder.jpg */
snprintf( psz_filename, MAX_PATH,
- "file://%sFolder.jpg", psz_path );
+ "%sFolder.jpg", psz_path );
break;
case 1:
/* Windows AlbumArtSmall.jpg == small version of Folder.jpg */
snprintf( psz_filename, MAX_PATH,
break;
case 1:
/* Windows AlbumArtSmall.jpg == small version of Folder.jpg */
snprintf( psz_filename, MAX_PATH,
- "file://%sAlbumArtSmall.jpg", psz_path );
+ "%sAlbumArtSmall.jpg", psz_path );
break;
case 2:
/* KDE (?) .folder.png */
snprintf( psz_filename, MAX_PATH,
break;
case 2:
/* KDE (?) .folder.png */
snprintf( psz_filename, MAX_PATH,
- "file://%s.folder.png", psz_path );
+ "%s.folder.png", psz_path );
- if( utf8_stat( psz_filename+7, &a ) != -1 )
+ if( utf8_stat( psz_filename, &a ) != -1 )
- input_item_SetArtURL( p_item, psz_filename );
- b_have_art = true;
+ char *psz_uri = make_URI( psz_filename );
+ if( psz_uri )
+ {
+ input_item_SetArtURL( p_item, psz_uri );
+ free( psz_uri );
+ b_have_art = true;
+ }
#include <vlc_playlist.h>
#include <vlc_meta.h>
#include <vlc_interface.h>
#include <vlc_playlist.h>
#include <vlc_meta.h>
#include <vlc_interface.h>
/*****************************************************************************
/*****************************************************************************
char *psz_arturl = input_item_GetArtURL( p_item );
CFDataRef art = NULL;
if( psz_arturl && !strncmp( psz_arturl, "file://", 7 ) &&
char *psz_arturl = input_item_GetArtURL( p_item );
CFDataRef art = NULL;
if( psz_arturl && !strncmp( psz_arturl, "file://", 7 ) &&
- strlen( psz_arturl ) > 7 )
+ decode_URI( psz_arturl + 7 ) )
art = (CFDataRef) readFile( psz_arturl + 7 );
free( psz_title );
art = (CFDataRef) readFile( psz_arturl + 7 );
free( psz_title );
#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_playlist.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_playlist.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnotify/notify.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnotify/notify.h>
vlc_object_release( p_input );
if( psz_arturl && !strncmp( psz_arturl, "file://", 7 ) &&
vlc_object_release( p_input );
if( psz_arturl && !strncmp( psz_arturl, "file://", 7 ) &&
- strlen( psz_arturl ) > 7 )
+ decode_URI( psz_arturl + 7 ) )
{ /* scale the art to show it in notify popup */
GError *p_error = NULL;
pix = gdk_pixbuf_new_from_file_at_scale( &psz_arturl[7],
72, 72, TRUE, &p_error );
{ /* scale the art to show it in notify popup */
GError *p_error = NULL;
pix = gdk_pixbuf_new_from_file_at_scale( &psz_arturl[7],
72, 72, TRUE, &p_error );
}
else /* else we show state-of-the art logo */
{
}
else /* else we show state-of-the art logo */
{
/* we need to replace '&' with '&' because '&' is a keyword of
* notification-daemon parser */
const int i_len = strlen( psz_tmp );
/* we need to replace '&' with '&' because '&' is a keyword of
* notification-daemon parser */
const int i_len = strlen( psz_tmp );
if( psz == NULL ) psz = strdup( "" );
if( !EMPTY_STR( psz ) )
{
if( psz == NULL ) psz = strdup( "" );
if( !EMPTY_STR( psz ) )
{
- psz_uri = make_URI( psz );
- fprintf( p_file, "\t\t\t<image>%s</image>\n", psz_uri );
- free( psz_uri );
+ fprintf( p_file, "\t\t\t<image>%s</image>\n", psz );
page = fd:read( 65653 )
fd = nil
_, _, arturl = string.find( page, "imgurl=([^&]+)" )
page = fd:read( 65653 )
fd = nil
_, _, arturl = string.find( page, "imgurl=([^&]+)" )
- if arturl then
- return vlc.strings.decode_uri(arturl)
- else
- return nil
- end
if not line then break end
if string.match( line, "param name=\"flashvars\" value=\".*video=" )
then
if not line then break end
if string.match( line, "param name=\"flashvars\" value=\".*video=" )
then
- arturl = vlc.strings.decode_uri( find( line, "param name=\"flashvars\" value=\".*preview=([^&]*)" ) )
+ arturl = find( line, "param name=\"flashvars\" value=\".*preview=([^&]*)" )
videos = vlc.strings.decode_uri( find( line, "param name=\"flashvars\" value=\".*video=([^&]*)" ) )
--[[ we get a list of different streams available, at various codecs
and resolutions:
videos = vlc.strings.decode_uri( find( line, "param name=\"flashvars\" value=\".*video=([^&]*)" ) )
--[[ we get a list of different streams available, at various codecs
and resolutions:
function get_arturl( path, video_id )
if string.match( vlc.path, "iurl=" ) then
function get_arturl( path, video_id )
if string.match( vlc.path, "iurl=" ) then
- return vlc.strings.decode_uri( get_url_param( vlc.path, "iurl" ) )
+ return vlc.strings( get_url_param( vlc.path, "iurl" ) )
end
if not arturl then
return "http://img.youtube.com/vi/"..video_id.."/default.jpg"
end
if not arturl then
return "http://img.youtube.com/vi/"..video_id.."/default.jpg"
char *psz_ext = filename_sanitize( psz_type ? psz_type : "" );
char *psz_filename;
char *psz_ext = filename_sanitize( psz_type ? psz_type : "" );
char *psz_filename;
- if( asprintf( &psz_filename, "file://%s" DIR_SEP "art%s", psz_path, psz_ext ) < 0 )
+ if( asprintf( &psz_filename, "%s" DIR_SEP "art%s", psz_path, psz_ext ) < 0 )
psz_filename = NULL;
free( psz_ext );
psz_filename = NULL;
free( psz_ext );
if( !strncmp( psz_filename, "art", 3 ) )
{
char *psz_file;
if( !strncmp( psz_filename, "art", 3 ) )
{
char *psz_file;
- if( asprintf( &psz_file, "file://%s" DIR_SEP "%s",
+ if( asprintf( &psz_file, "%s" DIR_SEP "%s",
psz_path, psz_filename ) < 0 )
psz_file = NULL;
if( psz_file )
psz_path, psz_filename ) < 0 )
psz_file = NULL;
if( psz_file )
- input_item_SetArtURL( p_item, psz_file );
- free( psz_file );
+ {
+ char *psz_uri = make_URI( psz_file );
+ if( psz_uri )
+ {
+ input_item_SetArtURL( p_item, psz_uri );
+ free( psz_uri );
+ }
+ free( psz_file );
+ }
if( !psz_filename )
return VLC_EGENERIC;
if( !psz_filename )
return VLC_EGENERIC;
+ char *psz_uri = make_URI( psz_filename );
+ if( !psz_uri )
+ {
+ free( psz_filename );
+ return VLC_EGENERIC;
+ }
+
/* Check if we already dumped it */
struct stat s;
/* Check if we already dumped it */
struct stat s;
- if( !utf8_stat( psz_filename+7, &s ) )
+ if( !utf8_stat( psz_filename, &s ) )
- input_item_SetArtURL( p_item, psz_filename );
+ input_item_SetArtURL( p_item, psz_uri );
return VLC_SUCCESS;
}
/* Dump it otherwise */
return VLC_SUCCESS;
}
/* Dump it otherwise */
- FILE *f = utf8_fopen( psz_filename+7, "wb" );
+ FILE *f = utf8_fopen( psz_filename, "wb" );
if( f )
{
if( fwrite( p_buffer, i_buffer, 1, f ) != 1 )
if( f )
{
if( fwrite( p_buffer, i_buffer, 1, f ) != 1 )
else
{
msg_Dbg( p_playlist, "album art saved to %s", psz_filename );
else
{
msg_Dbg( p_playlist, "album art saved to %s", psz_filename );
- input_item_SetArtURL( p_item, psz_filename );
+ input_item_SetArtURL( p_item, psz_uri );
}
fclose( f );
}
free( psz_filename );
}
fclose( f );
}
free( psz_filename );