VLCLocalPlexFolderListViewController.m 20 KB

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