Jump to content

API to get missing episodes.


Recommended Posts

Is there a way to pull missing episodes via a API call? Looking for the show name, season, episode and name of episode.

 

Want to get a list I can pass to my DVR to fill any gaps I have.

 

 

Sent from my iPhone using Tapatalk

Link to post
Share on other sites
Happy2Play

Have you considered looking at Reports-Episodes-filter Episodes-Missing episodes

Edited by Happy2Play
Link to post
Share on other sites
speechles

.../Users/<user-id>/Items?Includeitemtypes=Episodes&recursive=true&IsMissing=true

After getting this payload, you may have to ... do more like below

Afterwhich newresult only has missing episodes. Not sure if you still need to do this cleansing anymore or not. Last time I tried you had to.

NewResult = {}
for each item in parse(json.result) {
   if item.locationType = "Virtual"
      NewResult.append(item)
   End if
End for
Edited by speechles
Link to post
Share on other sites

Getting a 400 error, from logs I am seeing a auth and then failure. looks like there is a failure on the session?

 

CODe output

 

Invoke-WebRequest : The remote server returned an error: (400) Bad Request.

At line:57 char:5

+ Invoke-WebRequest -Uri $authUrl -Method POST -Body $postParams -C ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [invoke-WebRequest], WebException

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

 

CODE

 

 

Function Get-StringHash([string] $String,$HashName = "MD5")

{

$StringBuilder = New-Object System.Text.StringBuilder

[system.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash([system.Text.Encoding]::UTF8.GetBytes($String))|%{

[Void]$StringBuilder.Append($_.ToString("x2"))

}

$StringBuilder.ToString()

}

$embyServerUrl = "http://homecentral:8096"

$embyClientName = "PowerShellScript"

$embyDeviceName = "PowerShellScriptEpisodeFiller"

$embyDeviceId = "1"

$embyApplicationVersion = "1.0.0";

 

function Get-EmbyAccessToken {

[CmdletBinding()]

param ($Username, $Password)

$authUrl = "{0}/Users/AuthenticateByName/" -f $embyServerUrl

$sha1Pass = Get-StringHash -String $password -HashName "SHA1"

$md5Pass = Get-StringHash -String $password

$postParams = (@{Username="$username";password="$sha1Pass";passwordMd5="$md5Pass"} | ConvertTo-Json)

$headers = @{"Authorization"="MediaBrowser";"Client"=$embyClientName;"Device"=$embyDeviceName;"DeviceId"=$embyDeviceId;"Version"=$embyApplicationVersion;"UserId"="06da1707c6734dff9a26c360f8b71484"}

 

 

Write-Verbose ("authUrl={0},Username={1},sha1Pass={2},md5Pass={3},params={4}" -f $authUrl, $Username,$sha1Pass,$md5Pass,$postParams)

Invoke-WebRequest -Uri $authUrl -Method POST -Body $postParams -ContentType "application/json" -Headers $headers

 

 

}

 

 

Logs:

2016-04-19 19:01:11.5154 Info HttpServer: HTTP POST http://homecentral:8096/Users/AuthenticateByName/. UserAgent: Mozilla/5.0 (Windows NT; Windows NT 10.0; en-US) WindowsPowerShell/5.0.10586.122
2016-04-19 19:01:11.5716 Info UserManager: Authentication request for jon_b has succeeded.
2016-04-19 19:01:11.5716 Info SessionManager: Reissuing access token: b80d86289610416f8950ef44bd9a1701
2016-04-19 19:01:11.5716 Error DtoUtils: ServiceBase<TRequest>::Service Exception
*** Error Report ***
Version: 3.0.5912.0
Command line: C:\Users\jon_b\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe -service
Operating system: Microsoft Windows NT 6.2.9200.0
Processor count: 8
64-Bit OS: True
64-Bit Process: True
Program data path: C:\Users\jon_b\AppData\Roaming\Emby-Server
Application Path: C:\Users\jon_b\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe
Value cannot be null.
Parameter name: appName
System.ArgumentNullException
   at MediaBrowser.Server.Implementations.Session.SessionManager.<LogSessionActivity>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MediaBrowser.Server.Implementations.Session.SessionManager.<AuthenticateNewSessionInternal>d__f2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MediaBrowser.Api.UserService.<Post>d__17.MoveNext()

2016-04-19 19:01:11.5716 Error HttpServer: Error processing request for /Users/AuthenticateByName/
*** Error Report ***
Version: 3.0.5912.0
Command line: C:\Users\jon_b\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe -service
Operating system: Microsoft Windows NT 6.2.9200.0
Processor count: 8
64-Bit OS: True
64-Bit Process: True
Program data path: C:\Users\jon_b\AppData\Roaming\Emby-Server
Application Path: C:\Users\jon_b\AppData\Roaming\Emby-Server\System\MediaBrowser.ServerApplication.exe
Value cannot be null.
Parameter name: appName
ServiceStack.HttpError
No Stack Trace Available

2016-04-19 19:01:11.5716 Info HttpServer: HTTP Response 400 to fe80::1178:92a5:e2fc:10f4%11. Time: 60ms. http://homecentral:8096/Users/AuthenticateByName/

Link to post
Share on other sites
  • 3 years later...

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