]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/playlistinfo.m
macosx: Make sure there is a title or a name for the input item.
[vlc] / modules / gui / macosx / playlistinfo.m
index c0dfa25714ee615bbf6e909174873483ae1466c3..16a51c3350d643c436c4d151c84925b9c93af400 100644 (file)
@@ -119,7 +119,7 @@ static VLCInfo *_o_sharedInstance = nil;
     [self updatePanelWithItem:p_item];
 }
 
-- (void)stop
+- (void)stopTimers
 {
     /* make sure that the timer is released in any case */
     if( o_statUpdateTimer && [o_statUpdateTimer isValid] )
@@ -218,6 +218,7 @@ static VLCInfo *_o_sharedInstance = nil;
     if( _p_item != p_item )
     {
         if( p_item ) vlc_gc_decref( p_item );
+        [o_saveMetaData_btn setEnabled: NO];
         if( _p_item ) vlc_gc_incref( _p_item );
         p_item = _p_item;
     }
@@ -244,10 +245,6 @@ static VLCInfo *_o_sharedInstance = nil;
     }
     else
     {
-        /* fill uri info */
-        char * psz_url = input_item_GetURI( p_item );
-        [o_uri_txt setStringValue: [NSString stringWithUTF8String: psz_url ? psz_url : ""  ]];
-
         if( !input_item_IsPreparsed( p_item ) )
         {
             playlist_t * p_playlist = pl_Yield( VLCIntf );
@@ -255,15 +252,24 @@ static VLCInfo *_o_sharedInstance = nil;
             pl_Release( VLCIntf );
         }
 
+        /* fill uri info */
+        char * psz_url = input_item_GetURI( p_item );
+        [o_uri_txt setStringValue: [NSString stringWithUTF8String: psz_url ? psz_url : ""  ]];
         free( psz_url );
 
+        /* fill title info */
+        char * psz_title = input_item_GetTitle( p_item );
+        if( !psz_title )
+            psz_title = input_item_GetName( p_item );
+        [o_title_txt setStringValue: [NSString stringWithUTF8String: psz_title ? : ""  ]];
+        free( psz_title );
+
     #define SET( foo, bar ) \
         char *psz_##foo = input_item_Get##bar ( p_item ); \
         [self setMeta: psz_##foo forLabel: o_##foo##_txt]; \
         FREENULL( psz_##foo );
 
         /* fill the other fields */
-        SET( title, Title );
         SET( author, Artist );
         SET( collection, Album );
         SET( seqNum, TrackNum );
@@ -281,7 +287,7 @@ static VLCInfo *_o_sharedInstance = nil;
         NSImage *o_image;
         psz_meta = input_item_GetArtURL( p_item );
         if( psz_meta && !strncmp( psz_meta, "file://", 7 ) )
-            o_image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString: [NSString stringWithUTF8String: psz_meta]]];
+            o_image = [[NSImage alloc] initWithContentsOfFile: [NSString stringWithUTF8String: psz_meta+7]];
         else
             o_image = [[NSImage imageNamed: @"noart.png"] retain];
         [o_image_well setImage: o_image];