VLCLocalNetworkServiceBrowserPlex.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*****************************************************************************
  2. * VLCLocalNetworkServiceBrowserPlex.m
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2015 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Authors: Tobias Conradi <videolan # tobias-conradi.de>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. #import "VLCLocalNetworkServiceBrowserPlex.h"
  13. #import "VLCNetworkServerBrowserPlex.h"
  14. @implementation VLCLocalNetworkServiceBrowserPlex
  15. - (instancetype)init {
  16. return [super initWithName:@"Plex Media Server (via Bonjour)"
  17. serviceType:@"_plexmediasvr._tcp."
  18. domain:@""];
  19. }
  20. - (VLCLocalNetworkServiceNetService *)localServiceForNetService:(NSNetService *)netService {
  21. return [[VLCLocalNetworkServicePlex alloc] initWithNetService:netService];
  22. }
  23. @end
  24. NSString *const VLCNetworkServerProtocolIdentifierPlex = @"plex";
  25. @implementation VLCLocalNetworkServicePlex
  26. - (UIImage *)icon {
  27. return [UIImage imageNamed:@"PlexServerIcon"];
  28. }
  29. - (id<VLCNetworkServerBrowser>)serverBrowser {
  30. NSNetService *service = self.netService;
  31. if (service.hostName == nil || service.port == 0) {
  32. return nil;
  33. }
  34. NSString *name = service.name;
  35. NSString *hostName = service.hostName;
  36. NSUInteger portNum = service.port;
  37. VLCNetworkServerBrowserPlex *serverBrowser = [[VLCNetworkServerBrowserPlex alloc] initWithName:name host:hostName portNumber:@(portNum) path:@"" authentificication:@""];
  38. return serverBrowser;
  39. }
  40. @end