Jump to content


Photo

Query returns only trailers?????


  • Please log in to reply
7 replies to this topic

#1 rechigo OFFLINE  

rechigo

    Advanced Member

  • Members
  • 772 posts
  • Local time: 06:08 AM
  • LocationCALIFORNIA

Posted 31 March 2020 - 07:26 PM

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



#2 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 156835 posts
  • Local time: 09:08 AM

Posted 31 March 2020 - 08:19 PM

RemoteTrailers is just part of the movie object.



#3 rechigo OFFLINE  

rechigo

    Advanced Member

  • Members
  • 772 posts
  • Local time: 06:08 AM
  • LocationCALIFORNIA

Posted 31 March 2020 - 08:27 PM

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



#4 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 4730 posts
  • Local time: 09:08 AM
  • LocationPeterborough, Canada

Posted 31 March 2020 - 09:44 PM

Maybe try "GetItemsResult"

#5 rechigo OFFLINE  

rechigo

    Advanced Member

  • Members
  • 772 posts
  • Local time: 06:08 AM
  • LocationCALIFORNIA

Posted 01 April 2020 - 12:46 AM

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, 01 April 2020 - 02:11 AM.


#6 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 4730 posts
  • Local time: 09:08 AM
  • LocationPeterborough, Canada

Posted 01 April 2020 - 01:46 PM

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



#7 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 4730 posts
  • Local time: 09:08 AM
  • LocationPeterborough, Canada

Posted 02 April 2020 - 11:17 AM

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, 02 April 2020 - 12:10 PM.


#8 chef OFFLINE  

chef

    Advanced Member

  • Developers
  • 4730 posts
  • Local time: 09:08 AM
  • LocationPeterborough, Canada

Posted 02 April 2020 - 12:09 PM

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, 02 April 2020 - 12:25 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users