Commit d732fd2f authored by Clément Stenac's avatar Clément Stenac

Beginning of implementation of art fetch when played

parent 420d5f17
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "main_interface.hpp" #include "main_interface.hpp"
#include "input_manager.hpp" #include "input_manager.hpp"
#include "pixmaps/art.xpm"
#include <vlc/vout.h> #include <vlc/vout.h>
#include <QLabel> #include <QLabel>
...@@ -286,10 +285,13 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) : ...@@ -286,10 +285,13 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
left->addWidget( selector ); left->addWidget( selector );
art = new QLabel( "" ); art = new QLabel( "" );
art->setMinimumHeight( 128 );
art->setMinimumWidth( 128 );
art->setMaximumHeight( 128 ); art->setMaximumHeight( 128 );
art->setMaximumWidth( 128 ); art->setMaximumWidth( 128 );
art->setScaledContents( true ); art->setScaledContents( true );
art->setPixmap( QPixmap( art_xpm ) ); //":/vlc128.png" ) );
art->setPixmap( QPixmap( ":/noart.png" ) );
left->addWidget( art ); left->addWidget( art );
playlist_item_t *p_root = playlist_GetPreferredNode( THEPL, playlist_item_t *p_root = playlist_GetPreferredNode( THEPL,
...@@ -319,11 +321,11 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) : ...@@ -319,11 +321,11 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_intf ) :
void PlaylistWidget::setArt( QString url ) void PlaylistWidget::setArt( QString url )
{ {
if( prevArt != url ) if( url.isNull() )
{ art->setPixmap( QPixmap( ":/noart.png" ) );
else if( prevArt != url )
art->setPixmap( QPixmap( url ) ); art->setPixmap( QPixmap( url ) );
prevArt = url; prevArt = url;
}
} }
PlaylistWidget::~PlaylistWidget() PlaylistWidget::~PlaylistWidget()
......
/* XPM */
static char * art_xpm[] = {
"128 128 136 2",
" c #FFFFFF",
". c #000000",
"+ c #A8A8A8",
"@ c #272727",
"# c #050505",
"$ c #2E2E2E",
"% c #B8B8B8",
"& c #7C7C7C",
"* c #020202",
"= c #222222",
"- c #A9A9A9",
"; c #AAAAAA",
"> c #8C8C8C",
", c #686868",
"' c #919191",
") c #AEAEAE",
"! c #6A6A6A",
"~ c #FDFDFD",
"{ c #878787",
"] c #202020",
"^ c #A1A1A1",
"/ c #262626",
"( c #B2B2B2",
"_ c #FEFEFE",
": c #252525",
"< c #232323",
"[ c #9F9F9F",
"} c #B7B7B7",
"| c #2C2C2C",
"1 c #A5A5A5",
"2 c #D6D6D6",
"3 c #969696",
"4 c #5E5E5E",
"5 c #E0E0E0",
"6 c #F6F6F6",
"7 c #121212",
"8 c #C9C9C9",
"9 c #1B1B1B",
"0 c #FBFBFB",
"a c #B4B4B4",
"b c #111111",
"c c #3C3C3C",
"d c #FAFAFA",
"e c #303030",
"f c #444444",
"g c #C8C8C8",
"h c #D4D4D4",
"i c #4C4C4C",
"j c #858585",
"k c #3D3D3D",
"l c #DADADA",
"m c #5F5F5F",
"n c #B0B0B0",
"o c #141414",
"p c #313131",
"q c #CCCCCC",
"r c #DCDCDC",
"s c #626262",
"t c #131313",
"u c #F7F7F7",
"v c #DBDBDB",
"w c #5A5A5A",
"x c #BEBEBE",
"y c #242424",
"z c #C0C0C0",
"A c #FCFCFC",
"B c #F8F8F8",
"C c #ABABAB",
"D c #C1C1C1",
"E c #1E1E1E",
"F c #6C6C6C",
"G c #787878",
"H c #EAEAEA",
"I c #434343",
"J c #EBEBEB",
"K c #D7D7D7",
"L c #D2D2D2",
"M c #868686",
"N c #C6C6C6",
"O c #A0A0A0",
"P c #343434",
"Q c #DFDFDF",
"R c #636363",
"S c #6F6F6F",
"T c #8F8F8F",
"U c #2F2F2F",
"V c #393939",
"W c #E2E2E2",
"X c #D0D0D0",
"Y c #080808",
"Z c #040404",
"` c #AFAFAF",
" . c #D9D9D9",
".. c #323232",
"+. c #0D0D0D",
"@. c #A7A7A7",
"#. c #757575",
"$. c #7D7D7D",
"%. c #010101",
"&. c #F5F5F5",
"*. c #727272",
"=. c #B9B9B9",
"-. c #4E4E4E",
";. c #717171",
">. c #535353",
",. c #1D1D1D",
"'. c #CACACA",
"). c #171717",
"!. c #A6A6A6",
"~. c #898989",
"{. c #6E6E6E",
"]. c #181818",
"^. c #EEEEEE",
"/. c #BFBFBF",
"(. c #808080",
"_. c #424242",
":. c #333333",
"<. c #CECECE",
"[. c #5B5B5B",
"}. c #1C1C1C",
"|. c #989898",
"1. c #9D9D9D",
"2. c #4A4A4A",
"3. c #9C9C9C",
"4. c #191919",
"5. c #070707",
"6. c #9B9B9B",
"7. c #6B6B6B",
"8. c #7E7E7E",
"9. c #2A2A2A",
"0. c #A4A4A4",
"a. c #909090",
"b. c #ACACAC",
"c. c #DDDDDD",
"d. c #888888",
"e. c #030303",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . ",
" . . . . . . . . . . . ",
" ",
" ",
" ",
" . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . ",
" . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . ",
" . . . . . . . ",
" . . . ",
" ",
" ",
" ",
" ",
" ",
" . ",
". . . . + @ # $ % & . . . * = - . ; > . , ' ) ! ~ { ] # @ ^ . . * = - & . . . * / ( . . . _ ' : # < [ } | # / 1 . 2 / 3 . . . . . . ",
". 4 5 6 ; 7 8 9 . . 0 a b . c d e . d f g h i d j k h d l m . 0 a b 8 9 . . d n o . . . > p q d r s t ^ u v w . x y z . . A ",
". B C e 6 | D . . 0 a E . F ( ^ G . H k l I J E K . 0 a E 6 | D . . 0 ( o . . . ] L / M N 6 . O P Q . . . R ",
". . . . . . b 8 S T . . . . U h . v V _ e W . X Y X Z A . . . . . . U h S T . . . * y ` . . . . . . . Z 0 ., ..b 1 . +.@. . . . #.$.",
". 6 - < %.. . . . . &.*.=. . -.;.>. . . ,.l . . &.*.=. %.. . . . . . . . ] L X o . '.).!. . . . ~.s ",
". {.H &.@.]. . . u p ^. . /.. D . . (._.v A v . . u p ^. . . . . . > :.<.0 Q R [.l B @.b . h }.|. . . . 1.2.0 ",
". 3.4.5.P z . . 6.7. . . . A 8.9 Z 9.0. . 6.7. . . . . . _ a.: # = 1. !.@ Z / b. . c.= d. . . . . . . . . . . . e.. . . ",
" ",
" ",
" . . . ",
" . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
" . . . . . . . . . . . . . . . . . . ",
" . . . . . . . ",
" ",
" ",
" "};
...@@ -133,12 +133,13 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent ) ...@@ -133,12 +133,13 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
strings[2] = QString( psz_duration ); strings[2] = QString( psz_duration );
type = p_item->p_input->i_type; type = p_item->p_input->i_type;
current = iscurrent; current = iscurrent;
if( current && p_item->p_input->p_meta && if( current && p_item->p_input->p_meta &&
p_item->p_input->p_meta->psz_arturl && p_item->p_input->p_meta->psz_arturl &&
!strncmp( p_item->p_input->p_meta->psz_arturl, "file://", 7 ) ) !strncmp( p_item->p_input->p_meta->psz_arturl, "file://", 7 ) )
{
model->sendArt( qfu( p_item->p_input->p_meta->psz_arturl ) ); model->sendArt( qfu( p_item->p_input->p_meta->psz_arturl ) );
} else if( current )
model->removeArt();
} }
/************************************************************************* /*************************************************************************
...@@ -729,6 +730,11 @@ void PLModel::sendArt( QString url ) ...@@ -729,6 +730,11 @@ void PLModel::sendArt( QString url )
emit artSet( arturl ); emit artSet( arturl );
} }
void PLModel::removeArt()
{
emit artSet( QString() );
}
/** /**
* Deletion, here we have to do a ugly slow hack as we retrieve the full * Deletion, here we have to do a ugly slow hack as we retrieve the full
* list of indexes to delete at once: when we delete a node and all of * list of indexes to delete at once: when we delete a node and all of
......
...@@ -133,6 +133,7 @@ public: ...@@ -133,6 +133,7 @@ public:
QStringList mimeTypes() const; QStringList mimeTypes() const;
void sendArt( QString url ); void sendArt( QString url );
void removeArt( );
private: private:
void addCallbacks(); void addCallbacks();
void delCallbacks(); void delCallbacks();
......
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
<file>pixmaps/volume-low.png</file> <file>pixmaps/volume-low.png</file>
<file>pixmaps/volume-high.png</file> <file>pixmaps/volume-high.png</file>
<file alias="vlc128.png">../../../share/vlc128x128.png</file> <file alias="vlc128.png">../../../share/vlc128x128.png</file>
<file alias="noart.png">pixmaps/noart.png</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -66,7 +66,6 @@ public: ...@@ -66,7 +66,6 @@ public:
QPushButton **other, char *psz_other ) QPushButton **other, char *psz_other )
{ {
#ifdef QT42 #ifdef QT42
fprintf( stderr, "Gra\n" );
#else #else
QHBoxLayout *buttons_layout = new QHBoxLayout; QHBoxLayout *buttons_layout = new QHBoxLayout;
QSpacerItem *spacerItem = new QSpacerItem( 40, 20, QSpacerItem *spacerItem = new QSpacerItem( 40, 20,
...@@ -75,7 +74,6 @@ public: ...@@ -75,7 +74,6 @@ public:
if( psz_default ) if( psz_default )
{ {
utf8_fprintf( stderr, "Creating default button %s\n", psz_default );
*defaul = new QPushButton(0); *defaul = new QPushButton(0);
(*defaul)->setFocus(); (*defaul)->setFocus();
buttons_layout->addWidget( *defaul ); buttons_layout->addWidget( *defaul );
......
...@@ -437,21 +437,34 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist ) ...@@ -437,21 +437,34 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item ) int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
{ {
vlc_value_t val; vlc_value_t val;
input_item_t *p_input = p_item->p_input;
int i_activity = var_GetInteger( p_playlist, "activity") ; int i_activity = var_GetInteger( p_playlist, "activity") ;
msg_Dbg( p_playlist, "creating new input thread" ); msg_Dbg( p_playlist, "creating new input thread" );
p_item->p_input->i_nb_played++; p_input->i_nb_played++;
p_playlist->status.p_item = p_item; p_playlist->status.p_item = p_item;
p_playlist->status.i_status = PLAYLIST_RUNNING; p_playlist->status.i_status = PLAYLIST_RUNNING;
var_SetInteger( p_playlist, "activity", i_activity + var_SetInteger( p_playlist, "activity", i_activity +
DEFAULT_INPUT_ACTIVITY ); DEFAULT_INPUT_ACTIVITY );
p_playlist->p_input = input_CreateThread( p_playlist, p_item->p_input ); p_playlist->p_input = input_CreateThread( p_playlist, p_input );
val.i_int = p_item->p_input->i_id; if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_WHEN_PLAYED )
/* unlock the playlist to set the var...mmm */ {
if( p_input->p_meta && EMPTY_STR( p_input->p_meta->psz_arturl ) )
{
PL_DEBUG( "requesting art for %s", p_input->psz_name );
playlist_AskForArtEnqueue( p_playlist, p_input );
}
else if( !p_input->p_meta )
{
PL_DEBUG2( "unable to request art for %s, no meta", p_input->psz_name );
}
}
val.i_int = p_input->i_id;
vlc_mutex_unlock( &p_playlist->object_lock); vlc_mutex_unlock( &p_playlist->object_lock);
var_Set( p_playlist, "playlist-current", val); var_Set( p_playlist, "playlist-current", val);
vlc_mutex_lock( &p_playlist->object_lock); vlc_mutex_lock( &p_playlist->object_lock);
......
...@@ -558,9 +558,9 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj ) ...@@ -558,9 +558,9 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
p.p_item = p_current; p.p_item = p_current;
p.b_fetch_art = VLC_TRUE; p.b_fetch_art = VLC_TRUE;
vlc_mutex_lock( &p_playlist->p_fetcher->object_lock ); vlc_mutex_lock( &p_playlist->p_fetcher->object_lock );
TAB_APPEND( p_playlist->p_fetcher->i_waiting, INSERT_ELEM( p_playlist->p_fetcher->p_waiting,
p_playlist->p_fetcher->p_waiting, p_playlist->p_fetcher->i_waiting,
p ); p_playlist->p_fetcher->i_waiting, p);
vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock ); vlc_mutex_unlock( &p_playlist->p_fetcher->object_lock );
vlc_cond_signal( &p_playlist->p_fetcher->object_wait ); vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
} }
...@@ -642,15 +642,19 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj ) ...@@ -642,15 +642,19 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
if( i_ret == 1 ) if( i_ret == 1 )
{ {
PL_DEBUG("downloading art for %s", p_item->psz_name ); PL_DEBUG("downloading art for %s", p_item->psz_name );
if( !input_DownloadAndCacheArt( p_playlist, p_item ) ) if( input_DownloadAndCacheArt( p_playlist, p_item ) )
p_item->p_meta->i_status |= ITEM_ART_NOTFOUND; p_item->p_meta->i_status |= ITEM_ART_NOTFOUND;
else else {
p_item->p_meta->i_status |= ITEM_ART_FETCHED; p_item->p_meta->i_status |= ITEM_ART_FETCHED;
var_SetInteger( p_playlist, "item-change",
p_item->i_id );
}
} }
else if( i_ret == 0 ) /* Was in cache */ else if( i_ret == 0 ) /* Was in cache */
{ {
PL_DEBUG("found art for %s in cache", p_item->psz_name ); PL_DEBUG("found art for %s in cache", p_item->psz_name );
p_item->p_meta->i_status |= ITEM_ART_FETCHED; p_item->p_meta->i_status |= ITEM_ART_FETCHED;
var_SetInteger( p_playlist, "item-change", p_item->i_id );
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment