Ejemplo n.º 1
0
        public async Task GoTo(ItemsSourceReference itemsSourceReference)
        {
            switch (itemsSourceReference.Type)
            {
            case ItemsSourceType.Episode:
                var episode = await
                              _appContext.XBMC.VideoLibrary.GetEpisodeDetails(Convert.ToInt32(itemsSourceReference.Param),
                                                                              Episode.AllFields());

                var vm = new EpisodeVm(episode.episodedetails, _appContext);

                vm.GoTo();
                break;

            case ItemsSourceType.Movie:
                _appContext.View.GotoMovie(itemsSourceReference);
                break;
            }
        }
Ejemplo n.º 2
0
        private async Task GetItemInfo(string path)
        {
            var    parts      = _curPlayback.PosTrackuri.Split('/');
            string filename   = parts.Last();
            var    candidates = await _appContext.XBMC.VideoLibrary.GetMovies(filter : new Rule.Movies()
            {
                field = Movies.filename, Operator = Operators.Is, value = filename
            }, properties : Movie.AllFields(), limits : new Limits()
            {
                end = 1
            });

            var candidates2 = await _appContext.XBMC.VideoLibrary.GetEpisodes(filter : new Rule.Episodes()
            {
                field = Episodes.filename, Operator = Operators.Is, value = filename
            }, properties : Episode.AllFields(), limits : new Limits()
            {
                end = 1
            });

            if (candidates.limits.total == 1 && candidates2.limits.total == 0)
            {
                _libItem = new MovieVm(candidates.movies.First(), _appContext);
            }
            else if (candidates.limits.total == 0 && candidates2.limits.total == 1)
            {
                _libItem = new EpisodeVm(candidates2.episodes.First(), _appContext, null);
            }

            if (_libItem == null && path != null)
            {
                var fileInfo = await _appContext.XBMC.Files.GetFileDetails(path, Media.video, Files.AllFields());

                _libItem = new FileInfo(fileInfo.filedetails, _appContext);
            }
            if (_libItem != null)
            {
                Label       = _libItem.Label;
                SecondLabel = _libItem.SecondLabel;
                SetImage(_libItem.Images);
            }
        }