瀏覽代碼

remove shared library specific view controller
add VLCNetworkServerBrowserSharedLibrary for browsing of shared library

Tobias Conradi 9 年之前
父節點
當前提交
f96c089b52

+ 0 - 21
Sources/LocalNetworkConnectivity/LibrarySharing/VLCSharedLibraryListViewController.h

@@ -1,21 +0,0 @@
-/*****************************************************************************
- * VLCSharedLibraryListViewController.h
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- *
- * Authors: Felix Paul Kühne <fkuehne # videolan.org>
- *          Pierre SAGASPE <pierre.sagaspe # me.com>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import <UIKit/UIKit.h>
-
-@interface VLCSharedLibraryListViewController : UIViewController
-
-@property (nonatomic, strong) UITableView *tableView;
-
-- (id)initWithHttpServer:(NSString *)serverName serverAddress:(NSString *)serverAddress portNumber:(NSUInteger)portNumber;
-
-@end

+ 0 - 406
Sources/LocalNetworkConnectivity/LibrarySharing/VLCSharedLibraryListViewController.m

@@ -1,406 +0,0 @@
-/*****************************************************************************
- * VLCSharedLibraryListViewController.m
- * VLC for iOS
- *****************************************************************************
- * Copyright (c) 2015 VideoLAN. All rights reserved.
- *
- * Authors: Felix Paul Kühne <fkuehne # videolan.org>
- *          Pierre SAGASPE <pierre.sagaspe # me.com>
- *
- * Refer to the COPYING file of the official project for license.
- *****************************************************************************/
-
-#import "VLCSharedLibraryListViewController.h"
-#import "VLCSharedLibraryParser.h"
-#import "VLCNetworkListCell.h"
-#import "VLCPlaybackController.h"
-#import "VLCLibraryViewController.h"
-#import "VLCDownloadViewController.h"
-#import "NSString+SupportedMedia.h"
-#import "VLCStatusLabel.h"
-#import "UIDevice+VLC.h"
-
-@interface VLCSharedLibraryListViewController () <UITableViewDataSource, UITableViewDelegate, VLCNetworkListCellDelegate, UISearchBarDelegate, UISearchDisplayDelegate, VLCSharedLibraryParserDelegate>
-{
-    NSArray *_serverDataArray;
-    NSCache *_imageCache;
-
-    NSString *_httpServerName;
-    NSString *_httpServerAddress;
-    NSUInteger _httpServerPort;
-    VLCSharedLibraryParser *_httpParser;
-
-    NSMutableArray *_searchData;
-    UISearchBar *_searchBar;
-    UISearchDisplayController *_searchDisplayController;
-    UIRefreshControl *_refreshControl;
-    UIBarButtonItem *_menuButton;
-    UITapGestureRecognizer *_tapTwiceGestureRecognizer;
-}
-@end
-
-@implementation VLCSharedLibraryListViewController
-
-- (void)dealloc
-{
-    [_tapTwiceGestureRecognizer removeTarget:self action:NULL];
-}
-
-- (void)loadView
-{
-    _tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain];
-    _tableView.backgroundColor = [UIColor VLCDarkBackgroundColor];
-    CGRect frame = _tableView.bounds;
-    frame.origin.y = -frame.size.height;
-    UIView *topView = [[UIView alloc] initWithFrame:frame];
-    topView.backgroundColor = [UIColor VLCDarkBackgroundColor];
-    [_tableView addSubview:topView];
-    _tableView.delegate = self;
-    _tableView.dataSource = self;
-    _tableView.rowHeight = [VLCNetworkListCell heightOfCell];
-    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-    _tableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
-    self.view = _tableView;
-}
-
-- (id)initWithHttpServer:(NSString *)serverName serverAddress:(NSString *)serverAddress portNumber:(NSUInteger)portNumber
-{
-    self = [super init];
-    if (self) {
-        _httpServerName = serverName;
-        _httpServerAddress = serverAddress;
-        _httpServerPort = portNumber;
-
-        _imageCache = [[NSCache alloc] init];
-        [_imageCache setCountLimit:50];
-
-        _httpParser = [[VLCSharedLibraryParser alloc] init];
-        _httpParser.delegate = self;
-    }
-    return self;
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-
-    [_httpParser fetchDataFromServer:_httpServerAddress port:_httpServerPort];
-}
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-
-    self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
-    self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
-
-    self.title = _httpServerAddress;
-
-    _searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
-    UINavigationBar *navBar = self.navigationController.navigationBar;
-    _searchBar.barTintColor = navBar.barTintColor;
-    _searchBar.tintColor = navBar.tintColor;
-    _searchBar.translucent = navBar.translucent;
-    _searchBar.opaque = navBar.opaque;
-    _searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:_searchBar contentsController:self];
-    _searchDisplayController.delegate = self;
-    _searchDisplayController.searchResultsDataSource = self;
-    _searchDisplayController.searchResultsDelegate = self;
-        _searchDisplayController.searchBar.searchBarStyle = UIBarStyleBlack;
-    _searchDisplayController.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-    _searchDisplayController.searchResultsTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
-    _searchBar.delegate = self;
-    _searchBar.hidden = YES;
-
-    _tapTwiceGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self  action:@selector(tapTwiceGestureAction:)];
-    [_tapTwiceGestureRecognizer setNumberOfTapsRequired:2];
-    [self.navigationController.navigationBar addGestureRecognizer:_tapTwiceGestureRecognizer];
-
-    // Active le Pull down to refresh
-    _refreshControl = [[UIRefreshControl alloc] init];
-    _refreshControl.backgroundColor = [UIColor VLCDarkBackgroundColor];
-    _refreshControl.tintColor = [UIColor whiteColor];
-    // Call the refresh function
-    [_refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
-    [self.tableView addSubview:_refreshControl];
-
-    _searchData = [[NSMutableArray alloc] init];
-    [_searchData removeAllObjects];
-}
-
-- (BOOL)shouldAutorotate
-{
-    UIInterfaceOrientation toInterfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
-        return NO;
-    return YES;
-}
-
-#pragma mark - Table view data source
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
-{
-    return 1;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
-    @synchronized(self) {
-        if (tableView == self.searchDisplayController.searchResultsTableView)
-            return _searchData.count;
-        else
-            return _serverDataArray.count;
-    }
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    static NSString *CellIdentifier = @"libraryVLCCellDetail";
-
-    VLCNetworkListCell *cell = (VLCNetworkListCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
-
-    if (cell == nil)
-        cell = [VLCNetworkListCell cellWithReuseIdentifier:CellIdentifier];
-
-    NSDictionary *cellObject;
-    @synchronized(self) {
-        if (tableView == self.searchDisplayController.searchResultsTableView)
-            cellObject = _searchData[indexPath.row];
-        else
-            cellObject = _serverDataArray[indexPath.row];
-    }
-
-    [cell setTitle:[cellObject objectForKey:@"title"]];
-    [cell setIcon:[UIImage imageNamed:@"blank"]];
-
-    NSString *thumbPath = [cellObject objectForKey:@"thumb"];
-    if (thumbPath) {
-        dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);
-        dispatch_async(queue, ^{
-            UIImage *img = [self getCachedImage:thumbPath];
-            dispatch_async(dispatch_get_main_queue(), ^{
-                if (!img)
-                    [cell setIcon:[UIImage imageNamed:@"blank"]];
-                else
-                    [cell setIcon:img];
-            });
-        });
-    }
-
-    NSInteger size = [[cellObject objectForKey:@"size"] integerValue];
-    NSString *mediaSize = [NSByteCountFormatter stringFromByteCount:size countStyle:NSByteCountFormatterCountStyleFile];
-    NSString *duration = [cellObject objectForKey:@"duration"];
-    [cell setIsDirectory:NO];
-    [cell setSubtitle:[NSString stringWithFormat:@"%@ (%@)", mediaSize, duration]];
-    [cell setIsDownloadable:YES];
-    [cell setDelegate:self];
-    return cell;
-}
-
-- (UIImage *)getCachedImage:(NSString *)url
-{
-    UIImage *image = [_imageCache objectForKey:url];
-    if ((image != nil) && [image isKindOfClass:[UIImage class]]) {
-        return image;
-    } else {
-        NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:url]];
-        if (imageData) {
-            image = [[UIImage alloc] initWithData:imageData];
-            [_imageCache setObject:image forKey:url];
-        }
-        return image;
-    }
-}
-
-#pragma mark - Table view delegate
-
-- (void)tableView:(UITableView *)tableView willDisplayCell:(VLCNetworkListCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    UIColor *color = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
-    cell.contentView.backgroundColor = cell.titleLabel.backgroundColor = cell.folderTitleLabel.backgroundColor = cell.subtitleLabel.backgroundColor =  color;
-}
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    NSDictionary *selectedObject;
-
-    @synchronized(self) {
-        if (tableView == self.searchDisplayController.searchResultsTableView)
-            selectedObject = _searchData[indexPath.row];
-        else
-            selectedObject = _serverDataArray[indexPath.row];
-    }
-
-    NSString *URLofSubtitle = nil;
-    if (![[selectedObject objectForKey:@"pathSubtitle"] isEqualToString:@""]) {
-        NSURL *url = [NSURL URLWithString:[[selectedObject objectForKey:@"pathSubtitle"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
-        URLofSubtitle = [self _getFileSubtitleFromServer:url modeStream:YES];
-    }
-
-    NSURL *itemURL = [NSURL URLWithString:[selectedObject objectForKey:@"pathfile"]];
-    if (itemURL) {
-        VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
-        [vpc playURL:itemURL subtitlesFilePath:URLofSubtitle];
-    }
-
-    [tableView deselectRowAtIndexPath:indexPath animated:NO];
-}
-
-#pragma mark - Specifics
-
-- (void)sharedLibraryDataProcessings:(NSArray *)result
-{
-    @synchronized(self) {
-        _serverDataArray = result;
-        self.title = [_serverDataArray.firstObject objectForKey:@"libTitle"];
-    }
-    [self.tableView reloadData];
-}
-
-
-- (void)_downloadFileFromMediaItem:(NSURL *)itemURL
-{
-    APLog(@"trying to download %@", [itemURL absoluteString]);
-    if (![[itemURL absoluteString] isSupportedFormat]) {
-        VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil)
-                                                          message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), [itemURL absoluteString]]
-                                                         delegate:self
-                                                cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
-                                                otherButtonTitles:nil];
-        [alert show];
-    } else if (itemURL) {
-        [[VLCDownloadViewController sharedInstance] addURLToDownloadList:itemURL fileNameOfMedia:nil];
-    }
-}
-
-- (NSString *)_getFileSubtitleFromServer:(NSURL *)url modeStream:(BOOL)modeStream
-{
-    NSString *FileSubtitlePath = nil;
-    NSString *fileName = [[url path] lastPathComponent];
-    NSData *receivedSub = [NSData dataWithContentsOfURL:url];
-
-    if (receivedSub.length < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
-        NSArray *searchPaths =  nil;
-        if (modeStream)
-            searchPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
-        else
-            searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-
-        NSString *directoryPath = [searchPaths objectAtIndex:0];
-        FileSubtitlePath = [directoryPath stringByAppendingPathComponent:fileName];
-        NSFileManager *fileManager = [NSFileManager defaultManager];
-        if (![fileManager fileExistsAtPath:FileSubtitlePath]) {
-            [fileManager createFileAtPath:FileSubtitlePath contents:nil attributes:nil];
-            if (![fileManager fileExistsAtPath:FileSubtitlePath])
-                APLog(@"file creation failed, no data was saved");
-        }
-        [receivedSub writeToFile:FileSubtitlePath atomically:YES];
-    } else {
-        VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
-                                                          message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), fileName, [[UIDevice currentDevice] model]]
-                                                         delegate:self
-                                                cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
-                                                otherButtonTitles:nil];
-        [alert show];
-    }
-
-    return FileSubtitlePath;
-}
-
-#pragma mark - VLCNetworkListCell delegation
-
-- (void)triggerDownloadForCell:(VLCNetworkListCell *)cell
-{
-    NSDictionary *dataItem;
-
-    @synchronized(self) {
-        if ([self.searchDisplayController isActive])
-            dataItem = _searchData[[self.searchDisplayController.searchResultsTableView indexPathForCell:cell].row];
-        else
-            dataItem = _serverDataArray[[self.tableView indexPathForCell:cell].row];
-    }
-
-    NSURL *itemURL = [NSURL URLWithString:[dataItem objectForKey:@"pathfile"]];
-
-    NSInteger size = [[dataItem objectForKey:@"size"] integerValue];
-    if (size  < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
-        NSString *URLofSubtitle = nil;
-        if (![[dataItem objectForKey:@"pathSubtitle"] isEqualToString:@""]) {
-            NSURL *url = [NSURL URLWithString:[[dataItem objectForKey:@"pathSubtitle"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
-            URLofSubtitle = [self _getFileSubtitleFromServer:url modeStream:NO];
-        }
-
-        [self _downloadFileFromMediaItem:itemURL];
-        [cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)];
-    } else {
-        VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
-                                                          message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), [dataItem objectForKey:@"title"], [[UIDevice currentDevice] model]]
-                                                         delegate:self
-                                                cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
-                                                otherButtonTitles:nil];
-        [alert show];
-    }
-}
-
-#pragma mark - Search Display Controller Delegate
-
-- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
-{
-    @synchronized (self) {
-        [_searchData removeAllObjects];
-        NSUInteger count = _serverDataArray.count;
-        for (NSUInteger i = 0; i < count; i++) {
-            NSRange nameRange;
-            nameRange = [[_serverDataArray[i] objectForKey:@"title"] rangeOfString:searchString options:NSCaseInsensitiveSearch];
-            if (nameRange.location != NSNotFound)
-                [_searchData addObject:_serverDataArray[i]];
-        }
-    }
-    return YES;
-}
-
-- (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView
-{
-    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
-        tableView.rowHeight = 80.0f;
-    else
-        tableView.rowHeight = 68.0f;
-
-    tableView.backgroundColor = [UIColor blackColor];
-}
-
-#pragma mark - Refresh
-
--(void)handleRefresh
-{
-    //set the title while refreshing
-    _refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:NSLocalizedString(@"LOCAL_SERVER_REFRESH", nil)];
-    //set the date and time of refreshing
-    NSDateFormatter *formattedDate = [[NSDateFormatter alloc]init];
-    [formattedDate setDateFormat:@"MMM d, h:mm a"];
-    NSString *lastupdated = [NSString stringWithFormat:NSLocalizedString(@"LOCAL_SERVER_LAST_UPDATE", nil),[formattedDate stringFromDate:[NSDate date]]];
-    NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
-    _refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastupdated attributes:attrsDictionary];
-    //end the refreshing
-    [_refreshControl endRefreshing];
-
-    @synchronized(self) {
-        _serverDataArray = nil;
-    }
-    [_httpParser fetchDataFromServer:_httpServerAddress port:_httpServerPort];
-}
-
-#pragma mark - Gesture Action
-
-- (void)tapTwiceGestureAction:(UIGestureRecognizer *)recognizer
-{
-    _searchBar.hidden = !_searchBar.hidden;
-    if (_searchBar.hidden)
-        self.tableView.tableHeaderView = nil;
-    else
-        self.tableView.tableHeaderView = _searchBar;
-
-    [self.tableView setContentOffset:CGPointMake(0.0f, -self.tableView.contentInset.top) animated:NO];
-}
-
-@end

+ 4 - 0
Sources/LocalNetworkConnectivity/ServerBrowsing/VLCNetworkServerBrowser-Protocol.h

@@ -42,6 +42,10 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, readonly) NSURL *URL;
 @property (nonatomic, readonly, nullable) NSNumber *fileSizeBytes;
 
+@optional
+@property (nonatomic, readonly, nullable) NSString *duration;
+@property (nonatomic, readonly, nullable) NSURL *subtitleURL;
+
 @end
 
 

+ 30 - 0
Sources/LocalNetworkConnectivity/ServerBrowsing/VLCNetworkServerBrowserSharedLibrary.h

@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * VLCNetworkServerBrowserVLCMedia.h
+ * VLC for iOS
+ *****************************************************************************
+ * Copyright (c) 2015 VideoLAN. All rights reserved.
+ * $Id$
+ *
+ * Authors: Tobias Conradi <videolan # tobias-conradi.de>
+ *
+ * Refer to the COPYING file of the official project for license.
+ *****************************************************************************/
+
+#import "VLCNetworkServerBrowser-Protocol.h"
+
+NS_ASSUME_NONNULL_BEGIN
+@interface VLCNetworkServerBrowserSharedLibrary : NSObject <VLCNetworkServerBrowser>
+- (instancetype)initWithName:(NSString *)name host:(NSString *)addressOrName portNumber:(NSUInteger)portNumber NS_DESIGNATED_INITIALIZER;
+- (instancetype)init NS_UNAVAILABLE;
+@end
+
+
+@interface VLCNetworkServerBrowserItemSharedLibrary : NSObject <VLCNetworkServerBrowserItem>
+- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
+@property (nonatomic, readonly, nullable) NSURL *subtitleURL;
+@property (nonatomic, readonly, nullable) NSString *duration;
+
+@end
+
+
+NS_ASSUME_NONNULL_END

+ 91 - 0
Sources/LocalNetworkConnectivity/ServerBrowsing/VLCNetworkServerBrowserSharedLibrary.m

@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * VLCNetworkServerBrowserVLCMedia.m
+ * VLC for iOS
+ *****************************************************************************
+ * Copyright (c) 2015 VideoLAN. All rights reserved.
+ * $Id$
+ *
+ * Authors: Tobias Conradi <videolan # tobias-conradi.de>
+ *
+ * Refer to the COPYING file of the official project for license.
+ *****************************************************************************/
+
+#import "VLCNetworkServerBrowserSharedLibrary.h"
+#import "VLCSharedLibraryParser.h"
+
+@interface VLCNetworkServerBrowserSharedLibrary () <VLCSharedLibraryParserDelegate>
+@property (nonatomic, readonly) NSString *addressOrName;
+@property (nonatomic, readonly) NSUInteger port;
+@property (nonatomic, readonly) VLCSharedLibraryParser *httpParser;
+
+@end
+
+@implementation VLCNetworkServerBrowserSharedLibrary
+@synthesize title = _title, delegate = _delegate, items = _items;
+
+- (instancetype)initWithName:(NSString *)name host:(NSString *)addressOrName portNumber:(NSUInteger)portNumber
+{
+    self = [super init];
+    if (self) {
+        _title = name;
+        _addressOrName = addressOrName;
+        _port = portNumber;
+        _items = [NSArray array];
+        _httpParser = [[VLCSharedLibraryParser alloc] init];
+        _httpParser.delegate = self;
+    }
+    return self;
+}
+
+- (void)update {
+    [self.httpParser fetchDataFromServer:self.addressOrName port:self.port];
+}
+
+#pragma mark - Specifics
+
+
+- (void)sharedLibraryDataProcessings:(NSArray *)result
+{
+    _title = [result.firstObject objectForKey:@"libTitle"];
+
+    NSMutableArray *items = [NSMutableArray array];
+    for (NSDictionary *dict in result) {
+        [items addObject:[[VLCNetworkServerBrowserItemSharedLibrary alloc] initWithDictionary:dict]];
+    }
+    _items = [items copy];
+
+    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
+        [self.delegate networkServerBrowserDidUpdate:self];
+
+    }];
+}
+
+@end
+
+
+@implementation VLCNetworkServerBrowserItemSharedLibrary
+@synthesize name = _name, URL = _URL, fileSizeBytes = _fileSizeBytes, container = _container;
+- (instancetype)initWithDictionary:(NSDictionary *)dictionary
+{
+    self = [super init];
+    if (self) {
+        _name = dictionary[@"title"];
+        NSString *thumbURLString = dictionary[@"thumb"];
+        _subtitleURL = thumbURLString ? [NSURL URLWithString:thumbURLString] : nil;
+        _fileSizeBytes = dictionary[@"size"];
+        _duration = dictionary[@"duration"];
+        NSString *subtitleURLString = dictionary[@"pathSubtitle"];
+        if ([subtitleURLString isEqualToString:@"(null)"]) subtitleURLString = nil;
+        subtitleURLString = [subtitleURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+        _subtitleURL = subtitleURLString ? [NSURL URLWithString:subtitleURLString] : nil;
+        _URL = [NSURL URLWithString:dictionary[@"pathfile"]];
+        _container = NO;
+    }
+    return self;
+}
+
+- (id<VLCNetworkServerBrowser>)containerBrowser {
+    return nil;
+}
+
+@end

+ 5 - 5
Sources/LocalNetworkConnectivity/ServerDiscovery/VLCLocalNetworkService.m

@@ -111,7 +111,8 @@
 }
 @end
 
-#import "VLCSharedLibraryListViewController.h"
+#import "VLCNetworkServerBrowserSharedLibrary.h"
+#import "VLCNetworkServerBrowserViewController.h"
 @implementation VLCLocalNetworkServiceHTTP
 - (UIImage *)icon {
     return [UIImage imageNamed:@"menuCone"];
@@ -126,10 +127,9 @@
     NSString *name = service.name;
     NSString *hostName = service.hostName;
     NSUInteger portNum = service.port;
-    VLCSharedLibraryListViewController *targetViewController = [[VLCSharedLibraryListViewController alloc]
-                                                                initWithHttpServer:name
-                                                                serverAddress:hostName
-                                                                portNumber:portNum];
+    VLCNetworkServerBrowserSharedLibrary *serverBrowser = [[VLCNetworkServerBrowserSharedLibrary alloc] initWithName:name host:hostName portNumber:portNum];
+
+        VLCNetworkServerBrowserViewController *targetViewController = [[VLCNetworkServerBrowserViewController alloc] initWithServerBrowser:serverBrowser];
     return targetViewController;
 }
 @end

+ 0 - 1
Sources/LocalNetworkConnectivity/VLCServerListViewController.m

@@ -21,7 +21,6 @@
 #import "VLCNetworkLoginViewController.h"
 #import "VLCUPnPServerListViewController.h"
 #import "VLCLocalPlexFolderListViewController.h"
-#import "VLCSharedLibraryListViewController.h"
 #import "VLCNetworkServerBrowserViewController.h"
 
 #import "VLCNetworkServerBrowserFTP.h"

+ 6 - 6
VLC for iOS.xcodeproj/project.pbxproj

@@ -13,7 +13,6 @@
 		265D511D1922746C00E38383 /* VLCPlexParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 265D511B1922746C00E38383 /* VLCPlexParser.m */; };
 		266DB8EB1B447E5000EA415E /* VLCPlexMediaInformationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 266DB8EA1B447E5000EA415E /* VLCPlexMediaInformationViewController.xib */; };
 		268BDA7E1B4FE1E200D622DD /* backArrow_black.png in Resources */ = {isa = PBXBuildFile; fileRef = 268BDA7D1B4FE1E200D622DD /* backArrow_black.png */; };
-		26D4AF8D1A78379000D5EC65 /* VLCSharedLibraryListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 26D4AF8A1A78379000D5EC65 /* VLCSharedLibraryListViewController.m */; };
 		26D4AF8E1A78379000D5EC65 /* VLCSharedLibraryParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 26D4AF8C1A78379000D5EC65 /* VLCSharedLibraryParser.m */; };
 		26F1BFD01A770408001DF30C /* libMediaVLC.xml in Resources */ = {isa = PBXBuildFile; fileRef = 26F1BFCF1A770408001DF30C /* libMediaVLC.xml */; };
 		29125E5617492219003F03E5 /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 29125E5417492219003F03E5 /* index.html */; };
@@ -286,6 +285,7 @@
 		DD3567F91B6768FC00338947 /* WKInterfaceObject+VLCProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3567EE1B6768FC00338947 /* WKInterfaceObject+VLCProgress.m */; };
 		DD3EA6311AF50CFE007FF096 /* VLCWatchMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EA6301AF50CFE007FF096 /* VLCWatchMessage.m */; };
 		DD3EFE301BDA813F00B68579 /* VLCNetworkServerBrowserVLCMedia.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EFE2F1BDA813F00B68579 /* VLCNetworkServerBrowserVLCMedia.m */; };
+		DD3EFE361BDAACD400B68579 /* VLCNetworkServerBrowserSharedLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = DD3EFE351BDAACD400B68579 /* VLCNetworkServerBrowserSharedLibrary.m */; };
 		DD510B701B14E564003BA71C /* VLCPlayerDisplayController.m in Sources */ = {isa = PBXBuildFile; fileRef = DD510B6F1B14E564003BA71C /* VLCPlayerDisplayController.m */; };
 		DD7110F01AF38B2B00854776 /* MLMediaLibrary+playlist.m in Sources */ = {isa = PBXBuildFile; fileRef = DD7110EF1AF38B2B00854776 /* MLMediaLibrary+playlist.m */; };
 		DD7BA2631B680C8E002D9F54 /* MediaLibraryKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD7BA2601B680C1B002D9F54 /* MediaLibraryKit.framework */; };
@@ -438,8 +438,6 @@
 		265D511B1922746C00E38383 /* VLCPlexParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCPlexParser.m; path = Sources/LocalNetworkConnectivity/Plex/VLCPlexParser.m; sourceTree = SOURCE_ROOT; };
 		266DB8EA1B447E5000EA415E /* VLCPlexMediaInformationViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = VLCPlexMediaInformationViewController.xib; path = Resources/VLCPlexMediaInformationViewController.xib; sourceTree = SOURCE_ROOT; };
 		268BDA7D1B4FE1E200D622DD /* backArrow_black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = backArrow_black.png; path = ImportedSources/OneDrive/src/LiveSDK/Library/Internal/Resources/backArrow_black.png; sourceTree = SOURCE_ROOT; };
-		26D4AF891A78379000D5EC65 /* VLCSharedLibraryListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCSharedLibraryListViewController.h; path = Sources/LocalNetworkConnectivity/LibrarySharing/VLCSharedLibraryListViewController.h; sourceTree = SOURCE_ROOT; };
-		26D4AF8A1A78379000D5EC65 /* VLCSharedLibraryListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCSharedLibraryListViewController.m; path = Sources/LocalNetworkConnectivity/LibrarySharing/VLCSharedLibraryListViewController.m; sourceTree = SOURCE_ROOT; };
 		26D4AF8B1A78379000D5EC65 /* VLCSharedLibraryParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCSharedLibraryParser.h; path = Sources/LocalNetworkConnectivity/LibrarySharing/VLCSharedLibraryParser.h; sourceTree = SOURCE_ROOT; };
 		26D4AF8C1A78379000D5EC65 /* VLCSharedLibraryParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCSharedLibraryParser.m; path = Sources/LocalNetworkConnectivity/LibrarySharing/VLCSharedLibraryParser.m; sourceTree = SOURCE_ROOT; };
 		26F1BFCF1A770408001DF30C /* libMediaVLC.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = libMediaVLC.xml; sourceTree = "<group>"; };
@@ -896,6 +894,8 @@
 		DD3EA6301AF50CFE007FF096 /* VLCWatchMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCWatchMessage.m; sourceTree = "<group>"; };
 		DD3EFE2E1BDA813F00B68579 /* VLCNetworkServerBrowserVLCMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCNetworkServerBrowserVLCMedia.h; path = Sources/LocalNetworkConnectivity/ServerBrowsing/VLCNetworkServerBrowserVLCMedia.h; sourceTree = SOURCE_ROOT; };
 		DD3EFE2F1BDA813F00B68579 /* VLCNetworkServerBrowserVLCMedia.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCNetworkServerBrowserVLCMedia.m; path = Sources/LocalNetworkConnectivity/ServerBrowsing/VLCNetworkServerBrowserVLCMedia.m; sourceTree = SOURCE_ROOT; };
+		DD3EFE341BDAACD400B68579 /* VLCNetworkServerBrowserSharedLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCNetworkServerBrowserSharedLibrary.h; path = Sources/LocalNetworkConnectivity/ServerBrowsing/VLCNetworkServerBrowserSharedLibrary.h; sourceTree = SOURCE_ROOT; };
+		DD3EFE351BDAACD400B68579 /* VLCNetworkServerBrowserSharedLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCNetworkServerBrowserSharedLibrary.m; path = Sources/LocalNetworkConnectivity/ServerBrowsing/VLCNetworkServerBrowserSharedLibrary.m; sourceTree = SOURCE_ROOT; };
 		DD510B6E1B14E564003BA71C /* VLCPlayerDisplayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCPlayerDisplayController.h; path = Sources/VLCPlayerDisplayController.h; sourceTree = SOURCE_ROOT; };
 		DD510B6F1B14E564003BA71C /* VLCPlayerDisplayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCPlayerDisplayController.m; path = Sources/VLCPlayerDisplayController.m; sourceTree = SOURCE_ROOT; };
 		DD7110EE1AF38B2B00854776 /* MLMediaLibrary+playlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MLMediaLibrary+playlist.h"; sourceTree = "<group>"; };
@@ -1642,6 +1642,8 @@
 				DDE3C8E71BD3A81600C03B8B /* VLCNetworkServerBrowserFTP.m */,
 				DD3EFE2E1BDA813F00B68579 /* VLCNetworkServerBrowserVLCMedia.h */,
 				DD3EFE2F1BDA813F00B68579 /* VLCNetworkServerBrowserVLCMedia.m */,
+				DD3EFE341BDAACD400B68579 /* VLCNetworkServerBrowserSharedLibrary.h */,
+				DD3EFE351BDAACD400B68579 /* VLCNetworkServerBrowserSharedLibrary.m */,
 			);
 			name = "Server browsing";
 			sourceTree = "<group>";
@@ -1749,8 +1751,6 @@
 			children = (
 				26D4AF8B1A78379000D5EC65 /* VLCSharedLibraryParser.h */,
 				26D4AF8C1A78379000D5EC65 /* VLCSharedLibraryParser.m */,
-				26D4AF891A78379000D5EC65 /* VLCSharedLibraryListViewController.h */,
-				26D4AF8A1A78379000D5EC65 /* VLCSharedLibraryListViewController.m */,
 			);
 			name = "Library Sharing";
 			sourceTree = "<group>";
@@ -2555,7 +2555,6 @@
 				2915542517490A9C00B86CAD /* DDASLLogger.m in Sources */,
 				2915542617490A9C00B86CAD /* DDFileLogger.m in Sources */,
 				7D0363AC1B2F325500CC0343 /* MediaLibrary.xcdatamodeld in Sources */,
-				26D4AF8D1A78379000D5EC65 /* VLCSharedLibraryListViewController.m in Sources */,
 				2915542717490A9C00B86CAD /* DDLog.m in Sources */,
 				7D95610B1AF3E9E800779745 /* VLCMiniPlaybackView.m in Sources */,
 				2915542817490A9C00B86CAD /* DDTTYLogger.m in Sources */,
@@ -2604,6 +2603,7 @@
 				7D3784BE183A9938009EE944 /* UIBarButtonItem+Theme.m in Sources */,
 				41B93C051A53835300102E8B /* VLCCloudServiceCell.m in Sources */,
 				7D4625881A5614A1001A80B4 /* VLCEqualizerView.m in Sources */,
+				DD3EFE361BDAACD400B68579 /* VLCNetworkServerBrowserSharedLibrary.m in Sources */,
 				7DAE0C341B2EE0C200C53996 /* VLCNetworkServerBrowserViewController.m in Sources */,
 				7DF9352F1958AB0600E60FD4 /* UIColor+Presets.m in Sources */,
 				7D50903218F41C7900180139 /* VLCAlertView.m in Sources */,