Commit bb63164e authored by Felix Paul Kühne's avatar Felix Paul Kühne

* remove/disable the update-checker on OSX until 0.8.4 is out

parent 92e83955
......@@ -609,8 +609,6 @@ VLC-release.app: vlc
extended.m \
bookmarks.h \
bookmarks.m \
update.h \
update.m \
vout.m; do \
cp "$(srcdir)/modules/gui/macosx/$$i" \
$(top_builddir)/tmp/modules/gui/macosx; \
......@@ -725,8 +723,6 @@ VLC.app: vlc
extended.m \
bookmarks.h \
bookmarks.m \
update.h \
update.m \
vout.m; do \
cp "$(srcdir)/modules/gui/macosx/$$i" \
$(top_builddir)/tmp/modules/gui/macosx; \
......
......@@ -93,7 +93,6 @@
},
{
ACTIONS = {
checkForUpdate = id;
clearRecentItems = id;
closeError = id;
intfOpenDisc = id;
......@@ -151,7 +150,6 @@
"o_mi_bwd" = id;
"o_mi_channels" = id;
"o_mi_chapter" = id;
"o_mi_checkForUpdate" = id;
"o_mi_clear" = id;
"o_mi_close_window" = id;
"o_mi_controller" = id;
......
......@@ -21,9 +21,9 @@
<array/>
<key>IBOpenObjects</key>
<array>
<integer>2029</integer>
<integer>21</integer>
<integer>29</integer>
<integer>21</integer>
<integer>2029</integer>
</array>
<key>IBSystem Version</key>
<string>8C46</string>
......
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {cancel = id; download = id; okay = id; };
CLASS = VLCUpdate;
LANGUAGE = ObjC;
OUTLETS = {
"o_bar_checking" = id;
"o_bar_progress" = id;
"o_btn_DownloadNow" = id;
"o_btn_cancel" = id;
"o_btn_okay" = id;
"o_fld_currentVersion" = id;
"o_fld_dest" = id;
"o_fld_elpTime" = id;
"o_fld_releaseNote" = id;
"o_fld_remTime" = id;
"o_fld_size" = id;
"o_fld_source" = id;
"o_fld_userVersion" = id;
"o_lbl_checkForUpdate" = id;
"o_lbl_currentVersion" = id;
"o_lbl_mirror" = id;
"o_lbl_size" = id;
"o_lbl_userVersion" = id;
"o_pop_mirror" = id;
"o_progress_window" = id;
"o_update_window" = id;
};
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>69 67 356 240 0 0 1440 878 </string>
<key>IBFramework Version</key>
<string>437.0</string>
<key>IBOpenObjects</key>
<array>
<integer>7</integer>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8C46</string>
</dict>
</plist>
......@@ -827,7 +827,6 @@
DCFCCDB9085CE18F001E36AF,
DC7F46ED08A183FC0027DB24,
DCE7BD0508A56C8B007B10AE,
DCF49B4308B50FAF007E304F,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
......@@ -914,8 +913,6 @@
DC7F46F108A187F60027DB24,
DCE7BD0708A5724D007B10AE,
DCE7BD0608A5724D007B10AE,
DCF49B4408B51992007E304F,
DCF49B4508B51992007E304F,
);
isa = PBXGroup;
name = Classes;
......@@ -2372,55 +2369,12 @@
DCFCCDB7085CE18F001E36AF,
DC7F46EB08A183FC0027DB24,
DCE7BD0308A56C8B007B10AE,
DCF49B4108B50FAF007E304F,
);
isa = PBXGroup;
name = nibs;
refType = 4;
sourceTree = "<group>";
};
DCF49B4108B50FAF007E304F = {
children = (
DCF49B4208B50FAF007E304F,
);
isa = PBXVariantGroup;
name = Update.nib;
path = "";
refType = 4;
sourceTree = "<group>";
};
DCF49B4208B50FAF007E304F = {
isa = PBXFileReference;
lastKnownFileType = wrapper.nib;
name = English;
path = Resources/English.lproj/Update.nib;
refType = 4;
sourceTree = "<group>";
};
DCF49B4308B50FAF007E304F = {
fileRef = DCF49B4108B50FAF007E304F;
isa = PBXBuildFile;
settings = {
};
};
DCF49B4408B51992007E304F = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
name = update.h;
path = ../../modules/gui/macosx/update.h;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DCF49B4508B51992007E304F = {
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.objc;
name = update.m;
path = ../../modules/gui/macosx/update.m;
refType = 2;
sourceTree = SOURCE_ROOT;
};
DCFCCDB7085CE18F001E36AF = {
children = (
DCFCCDB8085CE18F001E36AF,
......
......@@ -34,7 +34,5 @@ SOURCES_macosx = \
extended.m \
bookmarks.h \
bookmarks.m \
update.h \
update.m \
$(NULL)
......@@ -93,14 +93,14 @@ struct intf_sys_t
id o_wizard; /* VLCWizard */
id o_extended; /* VLCExtended */
id o_bookmarks; /* VLCBookmarks */
id o_update; /* VLCUpdate */
/*id o_update; VLCUpdate */
BOOL nib_main_loaded; /* reference to the main-nib */
BOOL nib_open_loaded; /* reference to the open-nib */
BOOL nib_about_loaded; /* reference to the about-nib */
BOOL nib_wizard_loaded; /* reference to the wizard-nib */
BOOL nib_extended_loaded; /* reference to the extended-nib */
BOOL nib_bookmarks_loaded; /* reference to the bookmarks-nib */
BOOL nib_update_loaded; /* reference to the update-nib */
/*BOOL nib_update_loaded; reference to the update-nib */
IBOutlet id o_window; /* main window */
IBOutlet id o_playlist_view;/* playlist view */
......@@ -149,7 +149,7 @@ struct intf_sys_t
IBOutlet id o_mi_about;
IBOutlet id o_mi_prefs;
IBOutlet id o_mi_checkForUpdate;
/*IBOutlet id o_mi_checkForUpdate;*/
IBOutlet id o_mi_add_intf;
IBOutlet id o_mu_add_intf;
IBOutlet id o_mi_services;
......@@ -310,7 +310,7 @@ struct intf_sys_t
- (IBAction)viewAbout:(id)sender;
- (IBAction)viewPreferences:(id)sender;
- (IBAction)checkForUpdate:(id)sender;
/*- (IBAction)checkForUpdate:(id)sender;*/
- (IBAction)closeError:(id)sender;
- (IBAction)openReadMe:(id)sender;
- (IBAction)openDocumentation:(id)sender;
......
......@@ -41,7 +41,7 @@
#include "wizard.h"
#include "extended.h"
#include "bookmarks.h"
#include "update.h"
/*#include "update.h"*/
/*****************************************************************************
* Local prototypes.
......@@ -303,7 +303,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_wizard = [[VLCWizard alloc] init];
o_extended = [[VLCExtended alloc] init];
o_bookmarks = [[VLCBookmarks alloc] init];
o_update = [[VLCUpdate alloc] init];
/*o_update = [[VLCUpdate alloc] init];*/
i_lastShownVolume = -1;
return _o_sharedMainInstance;
......@@ -467,7 +467,7 @@ static VLCMain *_o_sharedMainInstance = nil;
/* main menu */
[o_mi_about setTitle: [_NS("About VLC media player") \
stringByAppendingString: @"..."]];
[o_mi_checkForUpdate setTitle: _NS("Check for Update...")];
/* [o_mi_checkForUpdate setTitle: _NS("Check for Update...")];*/
[o_mi_prefs setTitle: _NS("Preferences...")];
[o_mi_add_intf setTitle: _NS("Add Interface")];
[o_mu_add_intf setTitle: _NS("Add Interface")];
......@@ -1541,7 +1541,7 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_prefs showPrefs];
}
- (IBAction)checkForUpdate:(id)sender
/*- (IBAction)checkForUpdate:(id)sender
{
if (!nib_update_loaded)
{
......@@ -1550,7 +1550,7 @@ static VLCMain *_o_sharedMainInstance = nil;
} else {
[o_update showUpdateWindow];
}
}
}*/
- (IBAction)closeError:(id)sender
{
......
......@@ -81,7 +81,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
p_list = [NSMutableArray arrayWithCapacity: 1];
next_media = IOIteratorNext( media_iterator );
if( next_media != NULL )
if( next_media != nil )
{
char psz_buf[0x32];
size_t dev_path_length;
......@@ -114,7 +114,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
IOObjectRelease( next_media );
} while( ( next_media = IOIteratorNext( media_iterator ) ) != NULL );
} while( ( next_media = IOIteratorNext( media_iterator ) ) != nil );
}
IOObjectRelease( media_iterator );
......
......@@ -60,6 +60,7 @@
IBOutlet id o_prefs_window;
IBOutlet id o_title;
IBOutlet id o_help;
IBOutlet id o_tree;
IBOutlet id o_prefs_view;
IBOutlet id o_save_btn;
......
......@@ -106,6 +106,11 @@ static VLCPrefs *_o_sharedMainInstance = nil;
[o_title setStringValue: o_title_name];
}
- (void)setHelp: (NSString *) o_help_name
{
[o_help setStringValue: o_help_name];
}
- (void)showPrefs
{
/* load our nib (if not already loaded) */
......@@ -508,6 +513,7 @@ static VLCTreeItem *o_root_item = nil;
NSView *o_view;
[[VLCPrefs sharedInstance] setTitle: [self getTitle]];
[[VLCPrefs sharedInstance] setHelp: [self getHelp]];
/* NSLog( [self getHelp] ); */
s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4;
o_view = [[VLCFlippedView alloc] initWithFrame: s_vrc];
......
/*****************************************************************************
* update.h: MacOS X Check-For-Update window
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
*
* Authors: Felix Khne <fkuehne@users.sf.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface VLCUpdate : NSObject
{
IBOutlet id o_bar_progress;
IBOutlet id o_btn_cancel;
IBOutlet id o_btn_DownloadNow;
IBOutlet id o_btn_okay;
IBOutlet id o_fld_currentVersion;
IBOutlet id o_fld_dest;
IBOutlet id o_fld_elpTime;
IBOutlet id o_fld_releaseNote;
IBOutlet id o_fld_remTime;
IBOutlet id o_fld_size;
IBOutlet id o_fld_source;
IBOutlet id o_fld_userVersion;
IBOutlet id o_lbl_currentVersion;
IBOutlet id o_lbl_mirror;
IBOutlet id o_lbl_size;
IBOutlet id o_lbl_userVersion;
IBOutlet id o_pop_mirror;
IBOutlet id o_progress_window;
IBOutlet id o_update_window;
IBOutlet id o_bar_checking;
IBOutlet id o_lbl_checkForUpdate;
NSMutableArray * o_mirrors;
NSMutableDictionary * o_files;
}
- (IBAction)cancel:(id)sender;
- (IBAction)download:(id)sender;
- (IBAction)okay:(id)sender;
- (void)showUpdateWindow;
- (void)initStrings;
- (void)getData;
+ (VLCUpdate *)sharedInstance;
@end
/*****************************************************************************
* update.m: MacOS X Check-For-Update window
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
*
* Authors: Felix Khne <fkuehne@users.sf.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Note:
* the code used to bind with VLC's core and the download of files is heavily
* based upon ../wxwidgets/updatevlc.cpp, written by Antoine Cellerier.
* (he is a member of the VideoLAN team)
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#import "update.h"
#import "intf.h"
#import <vlc/vlc.h>
#import <vlc/intf.h>
#import "vlc_block.h"
#import "vlc_stream.h"
#import "vlc_xml.h"
#define UPDATE_VLC_OS "macosx"
#ifdef i386
#define UPDATE_VLC_ARCH "i386"
#else
#define UPDATE_VLC_ARCH "ppc"
#endif
#define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status"
#define UPDATE_VLC_MIRRORS_URL "http://update.videolan.org/mirrors"
#define UPDATE_VLC_DOWNLOAD_BUFFER_SIZE 2048
/*****************************************************************************
* VLCExtended implementation
*****************************************************************************/
@implementation VLCUpdate
static VLCUpdate *_o_sharedInstance = nil;
+ (VLCUpdate *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
- (id)init
{
if (_o_sharedInstance) {
[self dealloc];
} else {
_o_sharedInstance = [super init];
}
return _o_sharedInstance;
}
- (void)awakeFromNib
{
/* clean the interface */
[o_fld_userVersion setStringValue: [[[NSBundle mainBundle] infoDictionary] \
objectForKey:@"CFBundleVersion"]];
[o_fld_releaseNote setString: @""];
[o_fld_size setStringValue: @""];
[o_fld_currentVersion setStringValue: @""];
[self initStrings];
}
- (void)initStrings
{
/* translate strings to the user's language */
[o_update_window setTitle: _NS("Check for update")];
[o_btn_cancel setTitle: _NS("Cancel")];
[o_btn_DownloadNow setTitle: _NS("Download now")];
[o_btn_okay setTitle: _NS("OK")];
[o_lbl_currentVersion setStringValue: [_NS("Current version") \
stringByAppendingString: @":"]];
[o_lbl_size setStringValue: [_NS("Size") \
stringByAppendingString: @":"]];
[o_lbl_userVersion setStringValue: [_NS("Your version") \
stringByAppendingString: @":"]];
[o_lbl_mirror setStringValue: [_NS("Mirror") \
stringByAppendingString: @":"]];
[o_lbl_checkForUpdate setStringValue: _NS("Checking for update...")];
}
- (void)showUpdateWindow
{
/* show the window and check for a potential update */
[o_update_window center];
[o_update_window displayIfNeeded];
[o_update_window makeKeyAndOrderFront:nil];
/* alloc some dictionaries first */
o_mirrors = [[NSMutableArray alloc] init];
o_files = [[NSMutableDictionary alloc] init];
[o_bar_checking startAnimation:nil];
[self getData];
[o_bar_checking stopAnimation:nil];
}
- (IBAction)cancel:(id)sender
{
/* cancel the download and close the sheet */
}
- (IBAction)download:(id)sender
{
/* open the sheet and start the download */
}
- (IBAction)okay:(id)sender
{
/* just close the window */
[o_update_window close];
}
- (void)getData
{
/* This function gets all the info from the xml files hosted on
http://update.videolan.org/ and stores it in appropriate lists.
It was taken from the WX-interface and ported from C++ to Obj-C. */
stream_t *p_stream = NULL;
char *psz_eltname = NULL;
char *psz_name = NULL;
char *psz_value = NULL;
char *psz_eltvalue = NULL;
xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL;
bool b_os = false;
bool b_arch = false;
intf_thread_t * p_intf = VLCIntf;
if( UPDATE_VLC_ARCH == "i386" )
{
/* since we don't provide any binaries for MacTel atm, doing the
* update-check is not necessary (this would fail in fact). That's why
* we just provide a sheet telling the user about that and skip
* the rest. */
/* FIXME: remove me, if a i386-binary is available */
NSBeginInformationalAlertSheet(_NS("Unsupported architecture"), \
_NS("OK"), @"", @"", o_update_window, nil, nil, nil, nil, \
_NS("Binary builds are only available for Mac OS X on " \
"the PowerPC-platform. Official builds for Intel-Macs " \
"are not available at this time. \n\n If you want to " \
"help us here, feel free to contact us."));
return;
}
NSMutableDictionary * temp_version;
temp_version = [[NSMutableDictionary alloc] init];
NSMutableDictionary * temp_file;
temp_file = [[NSMutableDictionary alloc] init];
NSMutableDictionary * temp_mirror;
temp_mirror = [[NSMutableDictionary alloc] init];
//struct update_mirror_t tmp_mirror;
p_xml = xml_Create( p_intf );
if( !p_xml )
{
msg_Err( p_intf, "Failed to open XML parser" );
// FIXME: display error message in dialog
return;
}
p_stream = stream_UrlNew( p_intf, UPDATE_VLC_STATUS_URL );
if( !p_stream )
{
msg_Err( p_intf, "Failed to open %s for reading",
UPDATE_VLC_STATUS_URL );
// FIXME: display error message in dialog
return;
}
p_xml_reader = xml_ReaderCreate( p_xml, p_stream );
if( !p_xml_reader )
{
msg_Err( p_intf, "Failed to open %s for parsing",
UPDATE_VLC_STATUS_URL );
// FIXME: display error message in dialog
return;
}
/* build tree */
while( xml_ReaderRead( p_xml_reader ) == 1 )
{
switch( xml_ReaderNodeType( p_xml_reader ) )
{
// Error
case -1:
// TODO: print message
return;
case XML_READER_STARTELEM:
psz_eltname = xml_ReaderName( p_xml_reader );
if( !psz_eltname )
{
// TODO: print message
return;
}
msg_Dbg( p_intf, "element name: %s", psz_eltname );
while( xml_ReaderNextAttr( p_xml_reader ) == VLC_SUCCESS )
{
psz_name = xml_ReaderName( p_xml_reader );
psz_value = xml_ReaderValue( p_xml_reader );
if( !psz_name || !psz_value )
{
// TODO: print message
free( psz_eltname );
return;
}
msg_Dbg( p_intf, " attribute %s = %s",
psz_name, psz_value );
if( !strcmp( psz_name, "name" )
&& ( !strcmp( psz_value, "macosx" )
|| !strcmp( psz_value, "*" ) )
&& !strcmp( psz_eltname, "os" ) )
{
b_os = true;
}
if( b_os && !strcmp( psz_name, "name" )
&& ( !strcmp( psz_value, UPDATE_VLC_ARCH )
|| !strcmp( psz_value, "*" ) )
&& !strcmp( psz_eltname, "arch" ) )
{
b_arch = true;
}
if( b_os && b_arch )
{
if( strcmp( psz_eltname, "version" ) == 0 )
{
[temp_version setObject: [NSString \
stringWithUTF8String: psz_value] forKey: \
[NSString stringWithUTF8String: psz_name]];
}
if( !strcmp( psz_eltname, "file" ) )
{
[temp_file setObject: [NSString \
stringWithUTF8String: psz_value] forKey: \
[NSString stringWithUTF8String: psz_name]];
}
}
free( psz_name );
free( psz_value );
}
if( ( b_os && b_arch && strcmp( psz_eltname, "arch" ) ) )
{
/*if( !strcmp( psz_eltname, "version" ) )
{
it = m_versions.begin();
while( it != m_versions.end() )
{
if( it->type == tmp_version.type
&& it->major == tmp_version.major
&& it->minor == tmp_version.minor
&& it->revision == tmp_version.revision
&& it->extra == tmp_version.extra )
{
break;
}
it++;
}
if( it == m_versions.end() )
{
m_versions.push_back( tmp_version );
it = m_versions.begin();
while( it != m_versions.end() )
{
if( it->type == tmp_version.type
&& it->major == tmp_version.major
&& it->minor == tmp_version.minor
&& it->revision == tmp_version.revision
&& it->extra == tmp_version.extra )
{
break;
}
it++;
}
}
tmp_version.type = wxT( "" );
tmp_version.major = wxT( "" );
tmp_version.minor = wxT( "" );
tmp_version.revision = wxT( "" );
tmp_version.extra = wxT( "" );
}
if( !strcmp( psz_eltname, "file" ) )
{
it->m_files.push_back( tmp_file );
tmp_file.type = wxT( "" );
tmp_file.md5 = wxT( "" );
tmp_file.size = wxT( "" );
tmp_file.url = wxT( "" );
tmp_file.description = wxT( "" );
}*/
if(! [temp_version objectForKey: @"extra"] == @"0")
{
[o_fld_currentVersion setStringValue: [NSString \
stringWithFormat: @"%@.%@.%@-%@ (%@)", \
[temp_version objectForKey: @"major"], \
[temp_version objectForKey: @"minor"], \
[temp_version objectForKey: @"revision"], \
[temp_version objectForKey: @"extra"], \
[temp_version objectForKey: @"type"]]];
}
else
{
[o_fld_currentVersion setStringValue: [NSString \
stringWithFormat: @"%@.%@.%@ (%@)", \
[temp_version objectForKey: @"major"], \
[temp_version objectForKey: @"minor"], \
[temp_version objectForKey: @"revision"], \
[temp_version objectForKey: @"type"]]];
}
}
free( psz_eltname );
break;
case XML_READER_ENDELEM:
psz_eltname = xml_ReaderName( p_xml_reader );
if( !psz_eltname )
{
// TODO: print message
return;
}
msg_Dbg( p_intf, "element end: %s", psz_eltname );
if( !strcmp( psz_eltname, "os" ) )
b_os = false;
if( !strcmp( psz_eltname, "arch" ) )
b_arch = false;
if( !strcmp( psz_eltname, "file") )
{
if( [temp_file objectForKey: @"type"] == @"info" )
{
/* this is the announce file, store it correctly */
[o_files setObject: temp_file forKey: @"announce"];
}
else if( [temp_file objectForKey: @"type"] == @"binary" )
{
/* that's our binary */
[o_files setObject: temp_file forKey: @"binary"];
}
else if( [temp_file objectForKey: @"type"] == @"source" )
{
/* that's the source. not needed atm, but store it
* anyway to make possible enhancement of this dialogue
* a bit easier */
[o_files setObject: temp_file forKey: @"source"];
}
/* clean the temp-dict */
[temp_file removeAllObjects];
}
free( psz_eltname );
break;
case XML_READER_TEXT:
/* you can check the content of a file here (e.g. \
* "Installer-less binaries", "Disk-Image", etc.). That's not
* needed on OSX atm, but print debug-info anyway. */
psz_eltvalue = xml_ReaderValue( p_xml_reader );
msg_Dbg( p_intf, " text: %s", psz_eltvalue );
free( psz_eltvalue );
break;
}
}
if( p_xml_reader && p_xml ) xml_ReaderDelete( p_xml, p_xml_reader );
if( p_stream ) stream_Delete( p_stream );
p_stream = stream_UrlNew( p_intf, UPDATE_VLC_MIRRORS_URL );
if( !p_stream )
{
msg_Err( p_intf, "Failed to open %s for reading",
UPDATE_VLC_MIRRORS_URL );
// FIXME: display error message in dialog
return;
}
p_xml_reader = xml_ReaderCreate( p_xml, p_stream );
if( !p_xml_reader )
{
msg_Err( p_intf, "Failed to open %s for parsing",
UPDATE_VLC_MIRRORS_URL );
// FIXME: display error message in dialog
return;
}
/* build list */
while( xml_ReaderRead( p_xml_reader ) == 1 )
{
switch( xml_ReaderNodeType( p_xml_reader ) )
{
// Error
case -1:
// TODO: print message
return;
case XML_READER_STARTELEM:
psz_eltname = xml_ReaderName( p_xml_reader );
if( !psz_eltname )
{
// TODO: print message
return;
}
msg_Dbg( p_intf, "element name: %s", psz_eltname );
while( xml_ReaderNextAttr( p_xml_reader ) == VLC_SUCCESS )
{
psz_name = xml_ReaderName( p_xml_reader );
psz_value = xml_ReaderValue( p_xml_reader );
if( !psz_name || !psz_value )
{
// TODO: print message
free( psz_eltname );
return;
}
msg_Dbg( p_intf, " attribute %s = %s",
psz_name, psz_value );
if( !strcmp( psz_eltname, "mirror" ) )
{
[temp_mirror setObject: [NSString stringWithUTF8String: psz_name] forKey: [NSString stringWithUTF8String: psz_value]];
/*if( !strcmp( psz_name, "name" ) )
tmp_mirror.name = wxU( psz_value );
if( !strcmp( psz_name, "location" ) )
tmp_mirror.location = wxU( psz_value );*/
}
if( !strcmp( psz_eltname, "url" ) )
{
[temp_mirror setObject: [NSString stringWithUTF8String: psz_name] forKey: [NSString stringWithUTF8String: psz_value]];
/*
if( !strcmp( psz_name, "type" ) )
tmp_mirror.type = wxU( psz_value );
if( !strcmp( psz_name, "base" ) )
tmp_mirror.base_url = wxU( psz_value );*/
}
free( psz_name );
free( psz_value );
}
/*if( !strcmp( psz_eltname, "url" ) )
{
m_mirrors.push_back( tmp_mirror );
tmp_mirror.type = wxT( "" );
tmp_mirror.base_url = wxT( "" );
}*/
free( psz_eltname );
break;
case XML_READER_ENDELEM:
psz_eltname = xml_ReaderName( p_xml_reader );
if( !psz_eltname )
{
// TODO: print message
return;
}
msg_Dbg( p_intf, "element end: %s", psz_eltname );
/*if( !strcmp( psz_eltname, "mirror" ) )
{
tmp_mirror.name = wxT( "" );
tmp_mirror.location = wxT( "" );
}*/
/* store our mirror correctly */
[o_mirrors addObject: temp_mirror];
[temp_mirror removeAllObjects];
free( psz_eltname );
break;
case XML_READER_TEXT:
psz_eltvalue = xml_ReaderValue( p_xml_reader );
msg_Dbg( p_intf, " text: %s", psz_eltvalue );
free( psz_eltvalue );
break;
}
}
if( p_xml_reader && p_xml ) xml_ReaderDelete( p_xml, p_xml_reader );
if( p_stream ) stream_Delete( p_stream );
if( p_xml ) xml_Delete( p_xml );
}
@end
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