VLCLocalPlexFolderListViewController.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. /*****************************************************************************
  2. * VLCLocalPlexFolderListViewController.m
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2014-2015 VideoLAN. All rights reserved.
  6. *
  7. * Authors: Felix Paul Kühne <fkuehne # videolan.org>
  8. * Pierre SAGASPE <pierre.sagaspe # me.com>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. #import "VLCLocalPlexFolderListViewController.h"
  13. #import "VLCPlexMediaInformationViewController.h"
  14. #import "VLCPlexParser.h"
  15. #import "VLCPlexWebAPI.h"
  16. #import "VLCNetworkListCell.h"
  17. #import "VLCPlaybackController.h"
  18. #import "VLCPlaylistViewController.h"
  19. #import "VLCDownloadViewController.h"
  20. #import "NSString+SupportedMedia.h"
  21. #import "VLCStatusLabel.h"
  22. #import "UIDevice+VLC.h"
  23. @interface VLCLocalPlexFolderListViewController () <UITableViewDataSource, UITableViewDelegate, VLCNetworkListCellDelegate, UISearchBarDelegate, UISearchDisplayDelegate>
  24. {
  25. NSArray *_globalObjectList;
  26. NSCache *_imageCache;
  27. NSString *_PlexServerName;
  28. NSString *_PlexServerAddress;
  29. NSString *_PlexServerPort;
  30. NSString *_PlexServerPath;
  31. NSString *_PlexAuthentification;
  32. VLCPlexParser *_PlexParser;
  33. VLCPlexWebAPI *_PlexWebAPI;
  34. NSMutableArray *_searchData;
  35. UISearchBar *_searchBar;
  36. UISearchDisplayController *_searchDisplayController;
  37. UIRefreshControl *_refreshControl;
  38. UIBarButtonItem *_menuButton;
  39. }
  40. @end
  41. @implementation VLCLocalPlexFolderListViewController
  42. - (void)loadView
  43. {
  44. _tableView = [[UITableView alloc] initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStylePlain];
  45. _tableView.backgroundColor = [UIColor VLCDarkBackgroundColor];
  46. _tableView.delegate = self;
  47. _tableView.dataSource = self;
  48. _tableView.rowHeight = [VLCNetworkListCell heightOfCell];
  49. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  50. _tableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
  51. self.view = _tableView;
  52. }
  53. - (id)initWithPlexServer:(NSString *)serverName serverAddress:(NSString *)serverAddress portNumber:(NSString *)portNumber atPath:(NSString *)path authentification:(NSString *)auth
  54. {
  55. self = [super init];
  56. if (self) {
  57. _PlexServerName = serverName;
  58. _PlexServerAddress = serverAddress;
  59. _PlexServerPort = portNumber;
  60. _PlexServerPath = path;
  61. _PlexAuthentification = auth;
  62. _globalObjectList = [[NSArray alloc] init];
  63. _imageCache = [[NSCache alloc] init];
  64. [_imageCache setCountLimit:50];
  65. _PlexParser = [[VLCPlexParser alloc] init];
  66. }
  67. return self;
  68. }
  69. - (void)viewDidLoad
  70. {
  71. [super viewDidLoad];
  72. self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
  73. self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
  74. _PlexWebAPI = [[VLCPlexWebAPI alloc] init];
  75. self.title = _PlexServerName;
  76. _searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
  77. UINavigationBar *navBar = self.navigationController.navigationBar;
  78. _searchBar.barTintColor = navBar.barTintColor;
  79. _searchBar.tintColor = navBar.tintColor;
  80. _searchBar.translucent = navBar.translucent;
  81. _searchBar.opaque = navBar.opaque;
  82. _searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:_searchBar contentsController:self];
  83. _searchDisplayController.delegate = self;
  84. _searchDisplayController.searchResultsDataSource = self;
  85. _searchDisplayController.searchResultsDelegate = self;
  86. _searchDisplayController.searchBar.searchBarStyle = UIBarStyleBlack;
  87. _searchDisplayController.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  88. _searchDisplayController.searchResultsTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
  89. _searchBar.delegate = self;
  90. _searchBar.hidden = YES;
  91. //self.tableView.tableHeaderView = _searchBar;
  92. //self.tableView.contentOffset = CGPointMake(0, CGRectGetHeight(_searchBar.frame)); // -> hide search bar to load
  93. UITapGestureRecognizer *tapTwiceGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTwiceGestureAction:)];
  94. [tapTwiceGesture setNumberOfTapsRequired:2];
  95. [self.navigationController.navigationBar addGestureRecognizer:tapTwiceGesture];
  96. // Active le Pull down to refresh
  97. _refreshControl = [[UIRefreshControl alloc] init];
  98. _refreshControl.backgroundColor = [UIColor VLCDarkBackgroundColor];
  99. _refreshControl.tintColor = [UIColor whiteColor];
  100. // Call the refresh function
  101. [_refreshControl addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
  102. [self.tableView addSubview:_refreshControl];
  103. _menuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(menuButtonAction:)];
  104. self.navigationItem.rightBarButtonItem = _menuButton;
  105. _globalObjectList = [[NSArray alloc] init];
  106. _searchData = [[NSMutableArray alloc] init];
  107. [self performSelectorInBackground:@selector(loadContents) withObject:nil];
  108. }
  109. - (void)loadContents
  110. {
  111. _globalObjectList = [_PlexParser PlexMediaServerParser:_PlexServerAddress port:_PlexServerPort navigationPath:_PlexServerPath authentification:_PlexAuthentification];
  112. NSDictionary *firstObject = [_globalObjectList firstObject];
  113. if (_globalObjectList.count == 0 || firstObject == nil)
  114. _PlexAuthentification = @"";
  115. else
  116. _PlexAuthentification = [firstObject objectForKey:@"authentification"];
  117. NSString *titleValue;
  118. if ([_PlexServerPath isEqualToString:@""] || _globalObjectList.count == 0 || firstObject == nil)
  119. titleValue = _PlexServerName;
  120. else
  121. titleValue = [firstObject objectForKey:@"libTitle"];
  122. self.title = titleValue;
  123. [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
  124. }
  125. - (BOOL)shouldAutorotate
  126. {
  127. UIInterfaceOrientation toInterfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
  128. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
  129. return NO;
  130. return YES;
  131. }
  132. - (IBAction)menuButtonAction:(id)sender
  133. {
  134. [[VLCSidebarController sharedInstance] toggleSidebar];
  135. if (self.isEditing)
  136. [self setEditing:NO animated:YES];
  137. }
  138. #pragma mark - Table view data source
  139. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  140. {
  141. return 1;
  142. }
  143. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  144. {
  145. if (tableView == self.searchDisplayController.searchResultsTableView)
  146. return _searchData.count;
  147. else
  148. return _globalObjectList.count;
  149. }
  150. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  151. {
  152. static NSString *CellIdentifier = @"PlexCellDetail";
  153. VLCNetworkListCell *cell = (VLCNetworkListCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  154. if (cell == nil)
  155. cell = [VLCNetworkListCell cellWithReuseIdentifier:CellIdentifier];
  156. NSDictionary *cellObject;
  157. if (tableView == self.searchDisplayController.searchResultsTableView)
  158. cellObject = _searchData[indexPath.row];
  159. else
  160. cellObject = _globalObjectList[indexPath.row];
  161. [cell setTitle:cellObject[@"title"]];
  162. [cell setIcon:[UIImage imageNamed:@"blank"]];
  163. NSString *thumbPath = cellObject[@"thumb"];
  164. if (thumbPath) {
  165. dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0);
  166. dispatch_async(queue, ^{
  167. UIImage *img = [self getCachedImage:[self _urlAuth:thumbPath]];
  168. dispatch_async(dispatch_get_main_queue(), ^{
  169. if (!img)
  170. [cell setIcon:[UIImage imageNamed:@"blank"]];
  171. else
  172. [cell setIcon:img];
  173. });
  174. });
  175. }
  176. if ([cellObject[@"container"] isEqualToString:@"item"]) {
  177. UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightGestureAction:)];
  178. [swipeRight setDirection:(UISwipeGestureRecognizerDirectionRight)];
  179. [cell addGestureRecognizer:swipeRight];
  180. UILongPressGestureRecognizer *longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTouchGestureAction:)];
  181. [cell addGestureRecognizer:longPressGestureRecognizer];
  182. NSInteger size = [cellObject[@"size"] integerValue];
  183. NSString *mediaSize = [NSByteCountFormatter stringFromByteCount:size countStyle:NSByteCountFormatterCountStyleFile];
  184. NSString *durationInSeconds = cellObject[@"duration"];
  185. [cell setIsDirectory:NO];
  186. [cell setSubtitle:[NSString stringWithFormat:@"%@ (%@)", mediaSize, durationInSeconds]];
  187. [cell setIsDownloadable:YES];
  188. [cell setDelegate:self];
  189. } else {
  190. [cell setIsDirectory:YES];
  191. if (!thumbPath)
  192. [cell setIcon:[UIImage imageNamed:@"folder"]];
  193. }
  194. return cell;
  195. }
  196. - (UIImage *)getCachedImage:(NSString *)url
  197. {
  198. UIImage *image = [_imageCache objectForKey:url];
  199. if ((image != nil) && [image isKindOfClass:[UIImage class]]) {
  200. return image;
  201. } else {
  202. NSData *imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:url]];
  203. if (imageData) {
  204. image = [[UIImage alloc] initWithData:imageData];
  205. [_imageCache setObject:image forKey:url];
  206. }
  207. return image;
  208. }
  209. }
  210. #pragma mark - Table view delegate
  211. - (void)tableView:(UITableView *)tableView willDisplayCell:(VLCNetworkListCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
  212. {
  213. UIColor *color = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
  214. cell.contentView.backgroundColor = cell.titleLabel.backgroundColor = cell.folderTitleLabel.backgroundColor = cell.subtitleLabel.backgroundColor = color;
  215. }
  216. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  217. {
  218. NSArray *objectList;
  219. NSString *newPath = nil;
  220. if (tableView == self.searchDisplayController.searchResultsTableView)
  221. objectList = [_searchData copy];
  222. else
  223. objectList = _globalObjectList;
  224. NSDictionary *rowObject = objectList[indexPath.row];
  225. NSString *keyValue = [rowObject objectForKey:@"key"];
  226. if ([keyValue rangeOfString:@"library"].location == NSNotFound)
  227. newPath = [_PlexServerPath stringByAppendingPathComponent:keyValue];
  228. else
  229. newPath = keyValue;
  230. if ([rowObject[@"container"] isEqualToString:@"item"]) {
  231. objectList = [_PlexParser PlexMediaServerParser:_PlexServerAddress port:_PlexServerPort navigationPath:newPath authentification:_PlexAuthentification];
  232. NSString *URLofSubtitle = nil;
  233. NSDictionary *firstObject = [objectList firstObject];
  234. if (!firstObject)
  235. return;
  236. if ([firstObject objectForKey:@"keySubtitle"])
  237. URLofSubtitle = [_PlexWebAPI getFileSubtitleFromPlexServer:firstObject modeStream:YES];
  238. NSURL *itemURL = [NSURL URLWithString:[self _urlAuth:firstObject[@"keyMedia"]]];
  239. if (itemURL) {
  240. VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
  241. [vpc playURL:itemURL subtitlesFilePath:URLofSubtitle];
  242. }
  243. } else {
  244. VLCLocalPlexFolderListViewController *targetViewController = [[VLCLocalPlexFolderListViewController alloc] initWithPlexServer:_PlexServerName serverAddress:_PlexServerAddress portNumber:_PlexServerPort atPath:newPath authentification:_PlexAuthentification];
  245. [[self navigationController] pushViewController:targetViewController animated:YES];
  246. }
  247. [tableView deselectRowAtIndexPath:indexPath animated:NO];
  248. }
  249. #pragma mark - Specifics
  250. - (NSString *)_urlAuth:(NSString *)url
  251. {
  252. return [_PlexWebAPI urlAuth:url autentification:_PlexAuthentification];
  253. }
  254. - (void)_playMediaItem:(NSDictionary *)mediaObject
  255. {
  256. NSString *newPath = nil;
  257. NSString *keyValue = [mediaObject objectForKey:@"key"];
  258. if ([keyValue rangeOfString:@"library"].location == NSNotFound)
  259. newPath = [_PlexServerPath stringByAppendingPathComponent:keyValue];
  260. else
  261. newPath = keyValue;
  262. if ([[mediaObject objectForKey:@"container"] isEqualToString:@"item"]) {
  263. NSArray *mediaList = [_PlexParser PlexMediaServerParser:_PlexServerAddress port:_PlexServerPort navigationPath:newPath authentification:_PlexAuthentification];
  264. NSString *URLofSubtitle = nil;
  265. NSDictionary *firstObject = [mediaList firstObject];
  266. if (!firstObject)
  267. return;
  268. if ([firstObject objectForKey:@"keySubtitle"])
  269. URLofSubtitle = [_PlexWebAPI getFileSubtitleFromPlexServer:firstObject modeStream:YES];
  270. NSURL *itemURL = [NSURL URLWithString:[self _urlAuth:[firstObject objectForKey:@"keyMedia"]]];
  271. if (itemURL) {
  272. VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
  273. [vpc playURL:itemURL subtitlesFilePath:URLofSubtitle];
  274. }
  275. }
  276. }
  277. - (void)_downloadFileFromMediaItem:(NSDictionary *)mediaObject
  278. {
  279. if (!mediaObject)
  280. return;
  281. NSURL *itemURL = [NSURL URLWithString:[mediaObject objectForKey:@"keyMedia"]];
  282. if (![[itemURL absoluteString] isSupportedFormat]) {
  283. VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil)
  284. message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), [itemURL absoluteString]]
  285. delegate:self
  286. cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
  287. otherButtonTitles:nil];
  288. [alert show];
  289. } else if (itemURL) {
  290. NSString *fileName = [mediaObject objectForKey:@"namefile"];
  291. [[VLCDownloadViewController sharedInstance] addURLToDownloadList:itemURL fileNameOfMedia:fileName];
  292. }
  293. }
  294. - (void)swipeRightGestureAction:(UIGestureRecognizer *)recognizer
  295. {
  296. NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:[recognizer locationInView:self.tableView]];
  297. UITableViewCell *swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath];
  298. VLCNetworkListCell *cell = (VLCNetworkListCell *)[[self tableView] cellForRowAtIndexPath:swipedIndexPath];
  299. NSDictionary *cellObject = _globalObjectList[[self.tableView indexPathForCell:swipedCell].row];
  300. NSString *ratingKey = cellObject[@"ratingKey"];
  301. NSString *tag = cellObject[@"state"];
  302. NSString *cellStatusLbl = nil;
  303. NSInteger status = [_PlexWebAPI MarkWatchedUnwatchedMedia:_PlexServerAddress port:_PlexServerPort videoRatingKey:ratingKey state:tag authentification:_PlexAuthentification];
  304. if (status == 200) {
  305. if ([tag isEqualToString:@"watched"]) {
  306. tag = @"unwatched";
  307. cellStatusLbl = NSLocalizedString(@"PLEX_UNWATCHED", nil);
  308. } else if ([tag isEqualToString:@"unwatched"]) {
  309. tag = @"watched";
  310. cellStatusLbl = NSLocalizedString(@"PLEX_WATCHED", nil);
  311. }
  312. } else
  313. cellStatusLbl = NSLocalizedString(@"PLEX_ERROR_MARK", nil);
  314. [cell.statusLabel showStatusMessage:cellStatusLbl];
  315. [_globalObjectList[[self.tableView indexPathForCell:swipedCell].row] setObject:tag forKey:@"state"];
  316. }
  317. - (void)reloadTableViewPlex
  318. {
  319. _globalObjectList = [_PlexParser PlexMediaServerParser:_PlexServerAddress port:_PlexServerPort navigationPath:_PlexServerPath authentification:_PlexAuthentification];
  320. [self.tableView reloadData];
  321. }
  322. #pragma mark - VLCNetworkListCell delegation
  323. - (void)triggerDownloadForCell:(VLCNetworkListCell *)cell
  324. {
  325. NSDictionary *cellObject;
  326. if ([self.searchDisplayController isActive])
  327. cellObject = _searchData[[self.searchDisplayController.searchResultsTableView indexPathForCell:cell].row];
  328. else
  329. cellObject = _globalObjectList[[self.tableView indexPathForCell:cell].row];
  330. NSString *path = cellObject[@"key"];
  331. NSArray *mediaList = [_PlexParser PlexMediaServerParser:_PlexServerAddress port:_PlexServerPort navigationPath:path authentification:_PlexAuthentification];
  332. NSDictionary *firstObject = [mediaList firstObject];
  333. NSInteger size = [[firstObject objectForKey:@"size"] integerValue];
  334. if (size < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
  335. if ([firstObject objectForKey:@"keySubtitle"])
  336. [_PlexWebAPI getFileSubtitleFromPlexServer:firstObject modeStream:NO];
  337. [self _downloadFileFromMediaItem:firstObject];
  338. [cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)];
  339. } else {
  340. VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
  341. message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), [firstObject objectForKey:@"title"], [[UIDevice currentDevice] model]]
  342. delegate:self
  343. cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
  344. otherButtonTitles:nil];
  345. [alert show];
  346. }
  347. }
  348. #pragma mark - Search Display Controller Delegate
  349. - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
  350. {
  351. [_searchData removeAllObjects];
  352. NSUInteger count = _globalObjectList.count;
  353. for (NSUInteger i = 0; i < count; i++) {
  354. NSRange nameRange;
  355. nameRange = [[_globalObjectList[i] objectForKey:@"title"] rangeOfString:searchString options:NSCaseInsensitiveSearch];
  356. if (nameRange.location != NSNotFound)
  357. [_searchData addObject:_globalObjectList[i]];
  358. }
  359. return YES;
  360. }
  361. - (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView
  362. {
  363. if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
  364. tableView.rowHeight = 80.0f;
  365. else
  366. tableView.rowHeight = 68.0f;
  367. tableView.backgroundColor = [UIColor blackColor];
  368. }
  369. #pragma mark - Refresh
  370. -(void)handleRefresh
  371. {
  372. //set the title while refreshing
  373. _refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:NSLocalizedString(@"LOCAL_SERVER_REFRESH", nil)];
  374. //set the date and time of refreshing
  375. NSDateFormatter *formattedDate = [[NSDateFormatter alloc]init];
  376. [formattedDate setDateFormat:@"MMM d, h:mm a"];
  377. NSString *lastupdated = [NSString stringWithFormat:NSLocalizedString(@"LOCAL_SERVER_LAST_UPDATE", nil),[formattedDate stringFromDate:[NSDate date]]];
  378. NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];
  379. _refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:lastupdated attributes:attrsDictionary];
  380. //end the refreshing
  381. [_refreshControl endRefreshing];
  382. [self performSelector:@selector(reloadTableViewPlex) withObject:nil];
  383. }
  384. #pragma mark - Gesture Action
  385. - (void)tapTwiceGestureAction:(UIGestureRecognizer *)recognizer
  386. {
  387. _searchBar.hidden = !_searchBar.hidden;
  388. if (_searchBar.hidden)
  389. self.tableView.tableHeaderView = nil;
  390. else
  391. self.tableView.tableHeaderView = _searchBar;
  392. [self.tableView setContentOffset:CGPointMake(0.0f, -self.tableView.contentInset.top) animated:NO];
  393. }
  394. - (void)longTouchGestureAction:(UIGestureRecognizer *)recognizer
  395. {
  396. if (recognizer.state == UIGestureRecognizerStateBegan) {
  397. NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:[recognizer locationInView:self.tableView]];
  398. UITableViewCell *swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath];
  399. NSDictionary *cellObject = _globalObjectList[[self.tableView indexPathForCell:swipedCell].row];
  400. VLCPlexMediaInformationViewController *targetViewController = [[VLCPlexMediaInformationViewController alloc] initPlexMediaInformation:cellObject serverAddress:_PlexServerAddress portNumber:_PlexServerPort atPath:_PlexServerPath authentification:_PlexAuthentification];
  401. [[self navigationController] pushViewController:targetViewController animated:YES];
  402. }
  403. }
  404. @end