Jump to content

Brand New at this


thatoneguy99

Recommended Posts

thatoneguy99

Hey all. I am very brand new at anything like this. I am however savvy...LOL

 

Long story short I want to somehow create a plug in (or the best method) that will allow users to contact the server admin (me). My server runs on Linux (Ubuntu 16.04 to be exact). I haven't the slightest clue to where to even begin...

 

Since I am an extreme beginner would this be something that is even possible? Is it better suited as a feature request?

 

Either way I would still like to know how to begin with dev. How to use the API to pull information would be a GREAT start for me. Thank you very much for any advice/tutorial links/ anything!!!

  • Like 1
Link to comment
Share on other sites

thatoneguy99

@@ebr I am looking for a button/link that would be available to Emby users that would allow them to contact me via email. I said "contact the admin" because that could be the text that is shown for the button.

 

I know that Ombi with Emby is in beta stages but its not really what I am looking for, at least not for now. It is a little feature rich / Emby buggy at the moment to do what I want, reliably.

 

Long story short I would like users to be able to request something from me and I want to be able to send an email with recently downloaded media. That is all that I want to be able to do.

 

I give my server information to a few people/friends/family, but want a way for them to contact me, without blowing up my phone with text messages. Or not being able to contact me if they don't have/lost my phone number. 

 

Doesn't it seem I am making a mountain out of a mole hill? I guess Ombi would work but as of right now it can not send out the recently added media email because of some error. Tried to read up on the error but it seems that there is an API request problem on Ombi's side of things.

Link to comment
Share on other sites

There's no way for you to inject UI right now. Your plugin can have a configuration page but that is only available for the admin user.

Link to comment
Share on other sites

thatoneguy99

Thank you for the reply. You're always so busy on the forums. It's awesome. Going to dive into the API this week/weekend and see what I can learn.

 

 

Sent from my phone!

Link to comment
Share on other sites

It really sounds like Ombi is what you are looking for and those devs are moving fast with shoring up support for Emby.

 

But, feel free to tinker :).

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
thatoneguy99

Anyone want to teach me how to get started with the API? Been trying off and on to figure it out but I literally do not know where to start. Like some one on one assistance.

 

Edit: Just to be clear I did have a look at the WIKI but I dont know what to do with that info.

Edited by thatoneguy99
Link to comment
Share on other sites

  • 3 months later...
thatoneguy99

Finally getting back to this. I am done with the admin contact stuff that I mentioned above. I have figured out a way...

 

What I am trying to do now is pull images from Emby. How do I easily get item ids without physically going to the url inside Emby web client, and getting it from there?

 

I really want to get started with the API so bad but I just don't know what I am doing. 

 

I did figure out how to pull an image using the url server/emby/item/id/image/type

 

That's about as far as I got.

 

Thanks again!

Link to comment
Share on other sites

Typically you would pull down lists of items, then for each one construct image urls using the item information. does that help?

Link to comment
Share on other sites

thatoneguy99

It does. Sorry if I am being annoying *dang noobs* 

 

I don't even know how to "pull down" anything. If I could figure out how to search the API for certain things I think that would be a very good start.

 

Do I need to create a javascript or php script? Anyone you know would be willing to chat with me one on one?

Link to comment
Share on other sites

chef

I can try to help. Which language of code are you using again?

  • Like 1
Link to comment
Share on other sites

chef

Okay, so check the github wiki to make sure your URLs are correct and start this workflow to get images

 

1. Get public users

2.Autheticate one if them, preferably one with access to all the library item.

3. Do an itemQuery on the users library with parameters for the item you want images for.

Most likely by name.

4. This returns an Item Data Transfer Object with the IDs you need to make the image request.

5. Make the image request.

 

There is a second way, where you would create an application API key in the server. I believe if you do that, you might not have to Autheticate any users to get library info.

 

Someone may correct me about that.

Link to comment
Share on other sites

thatoneguy99

I will give it a shot. Thank you.

 

Edit: Just to clarify, all of this can be done with http requests?

Edited by thatoneguy99
Link to comment
Share on other sites

chef

I will give it a shot. Thank you.

 

Edit: Just to clarify, all of this can be done with http requests?

Yes it can, it will return JSON strings.

 

If you had said C# or JavaScript I might have been able o give you code examples to get item images, but alas I am not as well versed in programming languages as some of the guys here at emby :)

Link to comment
Share on other sites

thatoneguy99

Obviously neither am I. I think the portion I was getting confused about, on the Wiki, is the API client talk.

Knowing that it can be done with http requests helps me out a little bit. I will work on it.

 

I made a php script that auto downloads subtitles (using filebot and post processing) and will send me a notification whether or not it was a success.

 

Now I want to create a script that will look for all items that DONT have subtitles and show me those. Grabbing images is just to make it pretty. I could just display a text list also.

Edited by thatoneguy99
Link to comment
Share on other sites

chef

Obviously neither am I. I think the portion I was getting confused about, on the Wiki, is the API client talk.

Knowing that it can be done with http requests helps me out a little bit. I will work on it.

 

I made a php script that auto downloads subtitles (using filebot and post processing) and will send me a notification whether or not it was a success.

 

Now I want to create a script that will look for all items that DONT have subtitles and show me those. Grabbing images is just to make it pretty. I could just display a text list also.

I should point out that emby has a subtitle downloader that comes standard. You can find it under scheduled tasks :)

Link to comment
Share on other sites

thatoneguy99

Do I need to authenticate to Emby to be able to retrieve an image?

Link to comment
Share on other sites

thatoneguy99

I have been reading the wiki. It is great if you already have an idea on how to code. Starting from knowing nothing, to being able to use that documentation, is a little difficult. Learning a new language (PHP) at the same time is even harder. I am getting there though.

 

So far I can authenticate to the backend as a user, and receive an access token. Right after the access token is created I see an error in the log, that I can not decipher.

 

https://pastebin.com/pmymxhPk

 

TIA for the amount of direction I have gotten already!! Seriously, it is helpful. I WILL figure this out!

Link to comment
Share on other sites

chef

Are you passing the access token back in the header for the request properly?

I believe it is something like:

x-emby-Authentication : {your-access-token}

Also, I am pretty sure you have too pass the user ID in the header as well.

One second and I'll double check.

 

The proper header is:

 

X-MediaBrowser-Token

 

So the full headers are:

As the example on Github:

 

Authorization=MediaBrowser UserId="e8837bc1-ad67-520e-8cd2-f629e3155721", Client="Android", Device="Samsung Galaxy SIII", DeviceId="xxx", Version="1.0.0.0"

 

 

SO not that this will help, but this is the only time I ever used this type of communication with the server. Normally I build a C# application with the API libraraies...

 

This is going way back to my days in Visual Basic:

      Private Structure HttpClientProperties
            Public Shared ReadOnly Property AuthorizationHeader As [String]
                Get
                    Return [String].Format(
                        "MediaBrowser UserId=""{0}"", Client=""{1}"", Device=""{2}"""", DeviceId=""{3}"", Version=""{4}""",
                        UserModel.AuthenticateUserDto.Id, "MB-OpenAir", KinectSensorModel.Type, KinectSensorModel.Kinect.UniqueKinectId,
                        MainPanel.ApplicationVersion)
                End Get
            End Property
        End Structure

         Public Shared Sub POSTStream(url As [String], ContentType As [String])
            Try
                Dim encoding As UTF8Encoding = New UTF8Encoding
                Dim ByteData As Byte() = encoding.GetBytes(url)

                Dim Request As HttpWebRequest = DirectCast(WebRequest.Create(url), 
                                                           HttpWebRequest)
                With Request
                    .Method = "POST"
                    .Headers("Authorization") = (HttpClientProperties.AuthorizationHeader)
                    .ContentType = ContentType
                    .ContentLength = ByteData.Length
                End With

                Dim postRequestStream As Stream = Request.GetRequestStream()
                With postRequestStream
                    .Write(ByteData, 0, ByteData.Length)
                    .Close()
                End With
            Catch Ex As Exception
            End Try
        End Sub

I wrote that years ago. But you can see how I added the headers to the request, and what the hearders have to be :)

Edited by chef
Link to comment
Share on other sites

thatoneguy99

I would love to build something to speak to the API with an API key but I'm jut taking baby steps. 

 I was just testing the auth part. Didn't try to actually pull anything. So maybe my error is that I just didn't finish it up yet. 

I did add the header with the userid. Just didn't add the access token after that.

I'm thinking its just that my script isn't finished up just yet.

I will keep messing with it. Thank you!

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...