Jump to content

Query returns only trailers?????


rechigo

Recommended Posts

rechigo

Okay, so what I'm trying to do is get a query of all items with subtitles of specific codecs

 

I decided to start off simple with a very basic item query to get all movies in my library as shown below:

public BaseItem[] Get(SubtitleSearch request)
{
       InternalItemsQuery query = new InternalItemsQuery
       {
           IncludeItemTypes = new string[] { "Movie" }
       };

       BaseItem[] items = _libraryManager.GetItemList(query, false);

       return items;
}

The issue is that I only get back returned an array of trailers as show below:

[
    {
        "RemoteTrailers": [
            {
                "Url": "https://www.youtube.com/watch?v=9HKoPnraoLk",
                "Name": "2036 Origin Unknown | Katee Sackhoff | Trailer"
            }
        ]
    },
    {...TheRemainingHundredsOfTrailers}
]

What am I doing wrong here? I must be overlooking something simple

Link to comment
Share on other sites

rechigo

RemoteTrailers is just part of the movie object.

 

Yes, but it appears that's the ONLY part of the movie object that is returned. I get no other info about the movie, I ONLY get the RemoteTrialers object (and the TmdbCollectionName if the trailers are part of a collection). Here is a snippet of a couple hundred or so for example: https://pastebin.com/dPaMatFA

Link to comment
Share on other sites

rechigo

Maybe try "GetItemsResult"

 

Tried that earlier and it didn't work, results in the same issue. 

 

Tried using IItemRepository as well, results in the same issue

 

It works fine when I make just an HTTP request to "localhost:8096/emby/Items?IncludeItemTypes=Movie&Recursive=true?api_key=[]", but when I structure a query and fetch items via the c# API it doesn't work correctly, I have absolutely no clue what I'm doing wrong here

 

I COULD make a request internally to the rest API but I'd rather not use that, I'd like to keep that as a last result

 

Would anyone like to see the github repo to clone it and test it out? I'm going to stop trying for the day before I accidentally break my keyboard

Edited by rechigo
Link to comment
Share on other sites

chef

maybe try with the recursive param enabled and give a parent ID of the root folder?

Link to comment
Share on other sites

chef

I got to a part in one of my plugin where I was going to do this same thing, get a list of items from the InternalItemQuery and then  sort them.

 

As far as I can tell this seems to work without error, however I haven't added any new items to my library to actually get a perfect test. This seems to return full BaseItem information properly for me from LibraryManager.

            var ids = LibraryManager.GetInternalItemIds(new InternalItemsQuery()
            {
                IncludeItemTypes = new[] {"Movies", "Episodes"},
                Recursive = true,
                MinDateCreated = TaskManager.ScheduledTasks.FirstOrDefault(task => task.Name == Name)
                    ?.LastExecutionResult.EndTimeUtc //only items new since the last time this task ran??
            });

            if (ids.Any())
            {
                var message = $"Here's what is new!\n";
                foreach (var id in ids)
                {
                    var item = LibraryManager.GetItemById(id);

                    message += $"{item.Name}\n";

                }
                var data = new Payload()
                {
                    message = message,
                    endpoint = "me/feed"
                };

                FacebookClient.PostToPage(data, Logger, HttpClient, Plugin.Instance.Configuration);
            }
         }

I don't know if this will help at all.

Edited by chef
Link to comment
Share on other sites

chef

Something strange is happening with LibraryManager after all:

 

the code above shouldn't return any people objects... right?? I used "IncludeItemType = Movie, Episode" is the code above.

 

But, it returns all the people which have been added recently, and for some reason also returns an object called "Gay/lesbian" which I couldn't tell you (for the life of me) why it there LOL!

 

5e860cce0a0ac_error.png

 

EDIT: ops! Never mind about this! I used "Movies" instead of "Movie"

Edited by chef
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...