]> git.sesse.net Git - vlc/commitdiff
macosx: add the possibility to export the playlist as HTML (already possible using...
authorRémi Duraffort <ivoire@videolan.org>
Fri, 17 Apr 2009 21:16:23 +0000 (23:16 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Fri, 17 Apr 2009 21:21:59 +0000 (23:21 +0200)
modules/gui/macosx/playlist.m

index 6712df14ac7dc1ac2a87870129703337e2c94524..22aa0efd520d7392aa66f4934d75e2d9e6e114ff 100644 (file)
     [o_save_accessory_text setStringValue: _NS("File Format:")];
     [[o_save_accessory_popup itemAtIndex:0] setTitle: _NS("Extended M3U")];
     [[o_save_accessory_popup itemAtIndex:1] setTitle: _NS("XML Shareable Playlist Format (XSPF)")];
+    [[o_save_accessory_popup itemAtIndex:2] setTitle: _NS("HTML playlist")];
 }
 
 - (void)playlistUpdated
         if( psz_uri )
         {
             o_mrl = [NSMutableString stringWithUTF8String: psz_uri];
-        
+
             /* perform some checks whether it is a file and if it is local at all... */
             NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
             if( prefix_range.location != NSNotFound )
                 [o_mrl deleteCharactersInRange: prefix_range];
-            
+
             if( [o_mrl characterAtIndex:0] == '/' )
             {
                 [o_mi_revealInFinder setEnabled: YES];
     {
         NSString *o_filename = [o_save_panel filename];
 
-        if( [o_save_accessory_popup indexOfSelectedItem] == 1 )
+        if( [o_save_accessory_popup indexOfSelectedItem] == 0 )
+        {
+            NSString * o_real_filename;
+            NSRange range;
+            range.location = [o_filename length] - [@".m3u" length];
+            range.length = [@".m3u" length];
+
+            if( [o_filename compare:@".m3u" options: NSCaseInsensitiveSearch
+                                             range: range] != NSOrderedSame )
+            {
+                o_real_filename = [NSString stringWithFormat: @"%@.m3u", o_filename];
+            }
+            else
+            {
+                o_real_filename = o_filename;
+            }
+            playlist_Export( p_playlist,
+                [o_real_filename fileSystemRepresentation],
+                p_playlist->p_local_category, "export-m3u" );
+        }
+        else if( [o_save_accessory_popup indexOfSelectedItem] == 1 )
         {
             NSString * o_real_filename;
             NSRange range;
         {
             NSString * o_real_filename;
             NSRange range;
-            range.location = [o_filename length] - [@".m3u" length];
-            range.length = [@".m3u" length];
+            range.location = [o_filename length] - [@".html" length];
+            range.length = [@".html" length];
 
-            if( [o_filename compare:@".m3u" options: NSCaseInsensitiveSearch
+            if( [o_filename compare:@".html" options: NSCaseInsensitiveSearch
                                              range: range] != NSOrderedSame )
             {
-                o_real_filename = [NSString stringWithFormat: @"%@.m3u", o_filename];
+                o_real_filename = [NSString stringWithFormat: @"%@.html", o_filename];
             }
             else
             {
             }
             playlist_Export( p_playlist,
                 [o_real_filename fileSystemRepresentation],
-                p_playlist->p_local_category, "export-m3u" );
+                p_playlist->p_local_category, "export-html" );
         }
     }
     pl_Release( VLCIntf );