Kodi Notification 401 Unauthorized

Any questions? Need some help?
Post Reply
holsten
Posts: 17
Joined: 15 Nov 2015, 14:38

Kodi Notification 401 Unauthorized

Post by holsten »

Hi, I am experiencing a problem with the Media Center Automation. It has been discussed previously, but I did not completely understand the proposed solutions.

viewtopic.php?t=5464
viewtopic.php?t=4472

I am using FileBot Node on a Synology DS415play. When I provide the Kodi IP together with username and password for the web interface the notification is not making it through. This is the corresponding log

Code: Select all

Task: FileBot Task-MoviesTellKodiV2
Start time: Fri, 05 Jun 2020 09:16:33 GMT Stop time: Fri, 05 Jun 2020 09:18:50 GMT Current status: 0 (Normal) Standard output/error:
Run script [fn:amc] at [Fri Jun 05 09:17:24 CEST 2020]
Parameter: ut_label = Movie
Parameter: music = y
Parameter: unsorted = y
Parameter: clean = y
Parameter: minLengthMS = 300000
Parameter: minFileSize = 0
Parameter: kodi = *****
Parameter: seriesFormat = {n}/{n} - Season {s}/{n} - {s00e00} - {t}
Parameter: movieFormat = {n} ({y})
Argument[0]: /volume1/torrents/Movies
Ignore system path: /volume1/torrents/Movies/@eaDir
Input: /volume1/torrents/Movies/Antz (1998).mkv
Group: {Movie=true} => [Antz (1998).mkv] Rename movies using [TheMovieDB] Auto-detect movie from context [/volume1/torrents/Movies/Antz (1998).mkv] [MOVE] from [/volume1/torrents/Movies/Antz (1998).mkv] to [/volume1/XBMC/Movies/Antz (1998).mkv] [REFRESH] Refresh File Services (/volume1/XBMC/Movies) Processed 1 files Notify Kodi: [i]user:pswd[/i]@[i]IP[/i]]
POST: http://[i]user:pswd[/i]@[i]IP[/i]:8080/jsonrpc
{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"FileBot
finished processing 1 files","message":"\u2022 Antz (1998)","image":"https://app.filebot.net/icon.png"},"id":1}
java.lang.NullPointerException
HttpClientError: http://[i]user:pswd[/i]@[i]IP[/i]:8080/jsonrpc [401 Unauthorized] Clean clutter files and empty folders Done ヾ(@⌒ー⌒@)ノ
When copy pasting http://user:pswd@IP:8080 into a browser the Kodi WebGUI appears indicating that login and IP are correct. Could somebody help me with what I am missing here?

Cheers, holsten
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Kodi Notification 401 Unauthorized

Post by rednoah »

You'll need to use curl via --def exec if you need to do HTTP requests with BASIC authentication. The amc script itself does not implicitly support BASIC authentication via user:pass URL scheme.

e.g.

Code: Select all

--def exec="curl http://user:pswd@IP:8080/jsonrpc"


EDIT:

Newer revisions of FileBot will now extract user:pass from the URL and pass along the corresponding HTTP authentication headers. Using --def exec with curl is generally a good idea though, since that'll give you full control plus it's easily testable standalone.
:idea: Please read the FAQ and How to Request Help.
holsten
Posts: 17
Joined: 15 Nov 2015, 14:38

Re: Kodi Notification 401 Unauthorized

Post by holsten »

Hi rednoah,

thank you for the response. Took me a bit to follow up as our little girl was born in the meantime...

Coming back to the topic, apologize my ignorance, but is it sufficient to type the CODE into the "Kodi:" text field as illustrated in the picture (using the correct credentials though).

Image


Using this CODE for FileBot Node gives the following log:

Code: Select all

Dear user,

Task Scheduler has completed a scheduled task.

Task: FileBot Task-MoviesTEllKodiV3
Start time: Fri, 05 Jun 2020 17:38:57 GMT Stop time: Fri, 05 Jun 2020 17:41:06 GMT Current status: 0 (Normal) Standard output/error:
Run script [fn:amc] at [Fri Jun 05 17:39:44 CEST 2020]
Parameter: ut_label = Movie
Parameter: music = y
Parameter: unsorted = y
Parameter: clean = y
Parameter: minLengthMS = 300000
Parameter: minFileSize = 0
Parameter: kodi = *****
Parameter: seriesFormat = {n}/{n} - Season {s}/{n} - {s00e00} - {t}
Parameter: movieFormat = {n} ({y})
Argument[0]: /volume1/Movies
Ignore system path: /volume1/Movies/@eaDir
Input: /volume1/Movies/Mulan (1998).mkv
Group: {Movie=true} => [Mulan (1998).mkv] Rename movies using [TheMovieDB] Auto-detect movie from context [/volume1/Movies/Mulan (1998).mkv] [MOVE] from [/volume1/Movies/Mulan (1998).mkv] to [/volume1/XBMC/Movies/Mulan (1998).mkv] [REFRESH] Refresh File Services (/volume1/XBMC/Movies) Processed 1 files Notify Kodi: [host:--def]
POST: http://--def:8080/jsonrpc
{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"FileBot
finished processing 1 files","message":"\u2022 Mulan (1998)","image":"https://app.filebot.net/icon.png"},"id":1}
UnknownHostException: --def
Clean clutter files and empty folders
Done ヾ(@⌒ー⌒@)ノ
Is there something I am doing wrong?

Cheers,

holsten
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Kodi Notification 401 Unauthorized

Post by rednoah »

FileBot Node has a dedicated input field that corresponds to the --def exec option.


i.e. Run Program

Code: Select all

curl http://user:pswd@IP:8080/jsonrpc
:idea: Please read the FAQ and How to Request Help.
holsten
Posts: 17
Joined: 15 Nov 2015, 14:38

Re: Kodi Notification 401 Unauthorized

Post by holsten »

Hi rednoha,

Thanks for explaining it to a neophyte. I added the CODE like this in FileBot Node

Image

or do I have to write it with quotation note?


Now I receive a pretty long log after running the task, but my Kodi library is not updated. I can only show part of it, but it goes on for another 300k letters or so:

Dear user,

Task Scheduler has completed a scheduled task.

Code: Select all

Task: FileBot Task-MoviesTellKodiV4
Start time: Thu, 11 Jun 2020 18:04:02 GMT
Stop time: Thu, 11 Jun 2020 18:06:12 GMT
Current status: 0 (Normal)
Standard output/error:
Run script [fn:amc] at [Thu Jun 11 18:04:55 CEST 2020]
Parameter: ut_label = Movie
Parameter: music = y
Parameter: unsorted = y
Parameter: clean = y
Parameter: minLengthMS = 300000
Parameter: minFileSize = 0
Parameter: exec = curl http://user:pswd@IP/jsonrpc
Parameter: seriesFormat = {n}/{n} - Season {s}/{n} - {s00e00} - {t}
Parameter: movieFormat = {n} ({y})
Argument[0]: /volume1/Movies
Ignore system path: /volume1/Movies/@eaDir
Input: /volume1/Movies/The Bear (1988).mkv
Input: /volume1/Movies/Undercover (2005).mkv
Group: {Movie=true} => [The Bear (1988).mkv, Undercover (2005).mkv]
Rename movies using [TheMovieDB]
Auto-detect movie from context [/volume1/Movies/The Bear (1988).mkv]
Auto-detect movie from context [/volume1/Movies/Undercover (2005).mkv]
[MOVE] from [/volume1/Movies/Undercover (2005).mkv] to
[/volume1/XBMC/Movies/Undercover (2005).mkv]
[MOVE] from [/volume1/Movies/The Bear (1988).mkv] to
[/volume1/XBMC/Movies/The Bear (1988).mkv]
[REFRESH] Refresh File Services (/volume1/XBMC/Movies)
Processed 2 files
Execute: curl http://user:pswd@IP:8080/jsonrpc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0{
	"description": "JSON-RPC API of XBMC",
	"id": "http://xbmc.org/jsonrpc/ServiceDescription.json",
	"methods": {
		"Addons.ExecuteAddon": {
			"description": "Executes the given addon with the given parameters
(if possible)",
			"params": [
				{
					"name": "addonid",
					"required": true,
					"type": "string"
				},
				{
					"default": "",
					"name": "params",
					"type": [
						{
							"additionalProperties": {
								"default": "",
								"type": "string"
							},
							"type": "object"
						},
						{
							"items": {
								"type": "string"
							},
							"type": "array"
						},
						{
							"description": "URL path (must start with / or ?",
							"type": "string"
						}
					]
				},
				{
					"default": false,
					"name": "wait",
					"type": "boolean"
				}
			],
			"returns": {
				"type": "string"
			},
			"type": "method"
		},
		"Addons.GetAddonDetails": {
			"description": "Gets the details of a specific addon",
			"params": [
				{
					"name": "addonid",
					"required": true,
					"type": "string"
				},
				{
					"$ref": "Addon.Fields",
					"name": "properties"
				}
			],
			"returns": {
				"properties": {
					"addon": {
						"$ref": "Addon.Details",
						"required": true
					},
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"Addons.GetAddons": {
			"description": "Gets all available addons",
			"params": [
				{
					"$ref": "Addon.Types",
					"default": "unknown",
					"name": "type"
				},
				{
					"$ref": "Addon.Content",
					"default": "unknown",
					"description": "Content provided by the addon. Only considered
for plugins and scripts.",
					"name": "content"
				},
				{
					"default": "all",
					"name": "enabled",
					"type": [
						{
							"type": "boolean"
						},
						{
							"enums": [
								"all"
							],
							"type": "string"
						}
					]
				},
				{
					"$ref": "Addon.Fields",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"default": true,
					"name": "installed",
					"type": [
						{
							"type": "boolean"
						},
						{
							"enums": [
								"all"
							],
							"type": "string"
						}
					]
				}
			],
			"returns": {
				"properties": {
					"addons": {
						"items": {
							"$ref": "Addon.Details"
						},
						"type": "array"
					},
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"Addons.SetAddonEnabled": {
			"description": "Enables/Disables a specific addon",
			"params": [
				{
					"name": "addonid",
					"required": true,
					"type": "string"
				},
				{
					"$ref": "Global.Toggle",
					"name": "enabled",
					"required": true
				}
			],
			"returns": {
				"type": "string"
			},
			"type": "method"
		},
		"Application.GetProperties": {
			"description": "Retrieves the values of the given properties",
			"params": [
				{
					"items": {
						"$ref": "Application.Property.Name"
					},
					"name": "properties",
					"required": true,
					"type": "array",
					"uniqueItems": true
				}
			],
			"returns": {
				"$ref": "Application.Property.Value"
			},
			"type": "method"
		},
		"Application.Quit": {
			"description": "Quit application",
			"params": [

			],
			"returns": {
				"type": "string"
			},
			"type": "method"
		},
		"Application.SetMute": {
			"description": "Toggle mute/unmute",
			"params": [
				{
					"$ref": "Global.Toggle",
					"name": "mute",
					"required": true
				}
			],
			"returns": {
				"description": "Mute state",
				"type": "boolean"
			},
			"type": "method"
		},
		"Application.SetVolume": {
			"description": "Set the current volume",
			"params": [
				{
					"name": "volume",
					"required": true,
					"type": [
						{
							"maximum": 100,
							"minimum": 0,
							"type": "integer"
						},
						{
							"$ref": "Global.IncrementDecrement"
						}
					]
				}
			],
			"returns": {
				"type": "integer"
			},
			"type": "method"
		},
		"AudioLibrary.Clean": {
			"description": "Cleans the audio library from non-existent items",
			"params": [
				{
					"default": true,
					"description": "Whether or not to show the progress bar or any
other GUI dialog",
					"name": "showdialogs",
					"type": "boolean"
				}
			],
			"returns": {
				"type": "string"
			},
			"type": "method"
		},
		"AudioLibrary.Export": {
			"description": "Exports all items from the audio library",
			"params": [
				{
					"name": "options",
					"type": [
						{
							"additionalProperties": false,
							"properties": {
								"path": {
									"description": "Path to the directory to where the data
should be exported",
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"images": {
									"default": false,
									"description": "Whether to export thumbnails and fanart images",
									"type": "boolean"
								},
								"overwrite": {
									"default": false,
									"description": "Whether to overwrite existing exported files",
									"type": "boolean"
								}
							},
							"type": "object"
						}
					]
				}
			],
			"returns": {
				"type": "string"
			},
			"type": "method"
		},
		"AudioLibrary.GetAlbumDetails": {
			"description": "Retrieve details about a specific album",
			"params": [
				{
					"$ref": "Library.Id",
					"name": "albumid",
					"required": true
				},
				{
					"$ref": "Audio.Fields.Album",
					"name": "properties"
				}
			],
			"returns": {
				"properties": {
					"albumdetails": {
						"$ref": "Audio.Details.Album"
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetAlbums": {
			"description": "Retrieve all albums from specified artist (and
role) or that has songs of the specified genre",
			"params": [
				{
					"$ref": "Audio.Fields.Album",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				},
				{
					"name": "filter",
					"type": [
						{
							"additionalProperties": false,
							"properties": {
								"genreid": {
									"$ref": "Library.Id",
									"description": "Song genre. Filter for existance of songs
with this genre",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"genre": {
									"description": "Song genre. Filter for existance of songs
with this genre",
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"artistid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"artistid": {
									"$ref": "Library.Id",
									"required": true
								},
								"roleid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"artistid": {
									"$ref": "Library.Id",
									"required": true
								},
								"role": {
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"artist": {
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"artist": {
									"minLength": 1,
									"required": true,
									"type": "string"
								},
								"roleid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"artist": {
									"minLength": 1,
									"required": true,
									"type": "string"
								},
								"role": {
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"$ref": "List.Filter.Albums"
						}
					]
				},
				{
					"default": false,
					"name": "includesingles",
					"type": "boolean"
				},
				{
					"default": false,
					"description": "Whether or not to include all roles when
filtering by artist, rather than the default of excluding other
contributions. When true it overrides any role filter value.",
					"name": "allroles",
					"type": "boolean"
				}
			],
			"returns": {
				"properties": {
					"albums": {
						"items": {
							"$ref": "Audio.Details.Album"
						},
						"type": "array"
					},
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetArtistDetails": {
			"description": "Retrieve details about a specific artist",
			"params": [
				{
					"$ref": "Library.Id",
					"name": "artistid",
					"required": true
				},
				{
					"$ref": "Audio.Fields.Artist",
					"name": "properties"
				}
			],
			"returns": {
				"properties": {
					"artistdetails": {
						"$ref": "Audio.Details.Artist"
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetArtists": {
			"description": "Retrieve all artists. For backward compatibility by
default this implicity does not include those that only contribute
other roles, however absolutely all artists can be returned using
allroles=true",
			"params": [
				{
					"$ref": "Optional.Boolean",
					"default": null,
					"description": "Whether or not to only include album artists
rather than the artists of only individual songs as well. If the
parameter is not passed or is passed as null the GUI setting will be
used",
					"name": "albumartistsonly"
				},
				{
					"$ref": "Audio.Fields.Artist",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				},
				{
					"name": "filter",
					"type": [
						{
							"additionalProperties": false,
							"properties": {
								"genreid": {
									"$ref": "Library.Id",
									"description": "Deprecated, use songgenreid. Filter for
existance of songs with this genre",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"songgenreid": {
									"$ref": "Library.Id",
									"description": "Song genreid. Filter for existance of songs
with this genre",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"roleid": {
									"$ref": "Library.Id",
									"required": true
								},
								"songgenreid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"role": {
									"minLength": 1,
									"required": true,
									"type": "string"
								},
								"songgenreid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"genre": {
									"description": "Deprecated, use songgenre. Filter for
existance of songs with this genre",
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"songgenre": {
									"description": "Song genre. Filter for existance of songs
with this genre",
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"roleid": {
									"$ref": "Library.Id",
									"required": true
								},
								"songgenre": {
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"role": {
									"minLength": 1,
									"required": true,
									"type": "string"
								},
								"songgenre": {
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"albumid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"album": {
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"songid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"roleid": {
									"$ref": "Library.Id",
									"required": true
								},
								"songid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"role": {
									"minLength": 1,
									"required": true,
									"type": "string"
								},
								"songid": {
									"$ref": "Library.Id",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"roleid": {
									"$ref": "Library.Id",
									"description": "Role contributed by artist. Overriden by
allroles parameter",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"role": {
									"description": "Role contributed by artist. Overriden by
allroles parameter",
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},
							"type": "object"
						},
						{
							"$ref": "List.Filter.Artists"
						}
					]
				},
				{
					"default": false,
					"description": "Whether or not to include all artists
irrespective of the role they contributed. When true it overrides any
role filter value.",
					"name": "allroles",
					"type": "boolean"
				}
			],
			"returns": {
				"properties": {
					"artists": {
						"items": {
							"$ref": "Audio.Details.Artist"
						},
						"type": "array"
					},
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetGenres": {
			"description": "Retrieve all genres",
			"params": [
				{
					"$ref": "Library.Fields.Genre",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				}
			],
			"returns": {
				"properties": {
					"genres": {
						"items": {
							"$ref": "Library.Details.Genre"
						},
						"required": true,
						"type": "array"
					},
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetProperties": {
			"description": "Retrieves the values of the music library properties",
			"params": [
				{
					"items": {
						"$ref": "Audio.Property.Name"
					},
					"name": "properties",
					"required": true,
					"type": "array",
					"uniqueItems": true
				}
			],
			"returns": {
				"$ref": "Audio.Property.Value"
			},
			"type": "method"
		},
		"AudioLibrary.GetRecentlyAddedAlbums": {
			"description": "Retrieve recently added albums",
			"params": [
				{
					"$ref": "Audio.Fields.Album",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				}
			],
			"returns": {
				"properties": {
					"albums": {
						"items": {
							"$ref": "Audio.Details.Album"
						},
						"type": "array"
					},
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetRecentlyAddedSongs": {
			"description": "Retrieve recently added songs",
			"params": [
				{
					"$ref": "List.Amount",
					"default": -1,
					"description": "The amount of recently added albums from which to
return the songs",
					"name": "albumlimit"
				},
				{
					"$ref": "Audio.Fields.Song",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				}
			],
			"returns": {
				"properties": {
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					},
					"songs": {
						"items": {
							"$ref": "Audio.Details.Song"
						},
						"type": "array"
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetRecentlyPlayedAlbums": {
			"description": "Retrieve recently played albums",
			"params": [
				{
					"$ref": "Audio.Fields.Album",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				}
			],
			"returns": {
				"properties": {
					"albums": {
						"items": {
							"$ref": "Audio.Details.Album"
						},
						"type": "array"
					},
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetRecentlyPlayedSongs": {
			"description": "Retrieve recently played songs",
			"params": [
				{
					"$ref": "Audio.Fields.Song",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				}
			],
			"returns": {
				"properties": {
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					},
					"songs": {
						"items": {
							"$ref": "Audio.Details.Song"
						},
						"type": "array"
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetRoles": {
			"description": "Retrieve all contributor roles",
			"params": [
				{
					"$ref": "Audio.Fields.Role",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				}
			],
			"returns": {
				"properties": {
					"limits": {
						"$ref": "List.LimitsReturned",
						"required": true
					},
					"roles": {
						"items": {
							"$ref": "Audio.Details.Role"
						},
						"required": true,
						"type": "array"
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetSongDetails": {
			"description": "Retrieve details about a specific song",
			"params": [
				{
					"$ref": "Library.Id",
					"name": "songid",
					"required": true
				},
				{
					"$ref": "Audio.Fields.Song",
					"name": "properties"
				}
			],
			"returns": {
				"properties": {
					"songdetails": {
						"$ref": "Audio.Details.Song"
					}
				},
				"type": "object"
			},
			"type": "method"
		},
		"AudioLibrary.GetSongs": {
			"description": "Retrieve all songs from specified album, artist or genre",
			"params": [
				{
					"$ref": "Audio.Fields.Song",
					"name": "properties"
				},
				{
					"$ref": "List.Limits",
					"name": "limits"
				},
				{
					"$ref": "List.Sort",
					"name": "sort"
				},
				{
					"name": "filter",
					"type": [
						{
							"additionalProperties": false,
							"properties": {
								"genreid": {
									"$ref": "Library.Id",
									"description": "Song genre. Filter for existance of songs
with this genre",
									"required": true
								}
							},
							"type": "object"
						},
						{
							"additionalProperties": false,
							"properties": {
								"genre": {
									"description": "Song genre. Filter for existance of songs
with this genre",
									"minLength": 1,
									"required": true,
									"type": "string"
								}
							},


Clean clutter files and empty folders
Done ヾ(@⌒ー⌒@)ノ

From StoRRage
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Kodi Notification 401 Unauthorized

Post by rednoah »

Sorry, looks like you’ll have to ask in the Kodi forums what specific curl command works for your specific version of Kodi.
:idea: Please read the FAQ and How to Request Help.
holsten
Posts: 17
Joined: 15 Nov 2015, 14:38

Re: Kodi Notification 401 Unauthorized

Post by holsten »

OK, thank you for the help so far. I have found the correct curl command. It works with Git Bash

Code: Select all

curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://<user>:<pswd>@<host>:<port>/jsonrpc
My question would be how do I have to enter this into the "Run Program:" field in the FileBot Node. Whatever I tried so far with and without "" or --def did not work and I received this log:

Dear user,

Task Scheduler has completed a scheduled task.

Code: Select all

Task: FileBot Task-MoviesTellKodiV8
Start time: Fri, 12 Jun 2020 13:43:20 GMT Stop time: Fri, 12 Jun 2020 13:45:08 GMT Current status: 1 (Interrupted) Standard output/error:
Run script [fn:amc] at [Fri Jun 12 13:44:10 CEST 2020]
Parameter: ut_label = Movie
Parameter: music = y
Parameter: unsorted = y
Parameter: clean = y
Parameter: minLengthMS = 300000
Parameter: minFileSize = 0
Parameter: exec = "curl --data-binary '{ "jsonrpc": "2.0", "method":
"VideoLibrary.Scan", "id": "mybash"}' -H 'content-type:
application/json;' http://<user>:<pswd>@<host>:<port>/jsonrpc"
Parameter: seriesFormat = {n}/{n} - Season {s}/{n} - {s00e00} - {t}
Parameter: movieFormat = {n} ({y})
Argument[0]: /volume1/Movies
Ignore system path: /volume1/Movies/@eaDir
Input: /volume1/Movies/Bug's Life (1998).mkv
Group: {Movie=true} => [Bug's Life (1998).mkv] Rename movies using [TheMovieDB] Auto-detect movie from context [/volume1/Movies/Bug's Life (1998).mkv] [MOVE] from [/volume1/Movies/Bug's Life (1998).mkv] to [/volume1/XBMC/Movies/A Bug's Life (1998).mkv] [REFRESH] Refresh File Services (/volume1/XBMC/Movies) Processed 1 files Did you read the manual?
└ https://www.filebot.net/cli.html

Did you quote and escape your arguments correctly?
└ https://www.filebot.net/help/args.html

args[1] = @/usr/local/filebot-node/data/task/16.args

javax.script.ScriptException: SyntaxError: Unexpected input: ':'; Expecting <EOF>
javax.script.ScriptException: SyntaxError: Unexpected input: ':'; Expecting <EOF>
	at net.filebot.format.ExpressionFormat.compile(Unknown Source)
	at net.filebot.format.ExpressionFormat.<init>(Unknown Source)
	at net.filebot.cli.ScriptShellBaseClass.getMediaInfo(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at Script1$_run_closure68.doCall(Script1.groovy:456)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at Script1.run(Script1.groovy:456)
	at net.filebot.cli.ScriptShell.evaluate(Unknown Source)
	at net.filebot.cli.ScriptShell.runScript(Unknown Source)
	at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
	at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
	at net.filebot.Main.main(Unknown Source)

Error (o_O)
From StoRRage



Is there a way to get the command correctly executed? All I would need is an instruction for dummies which text has to go into the "Run Program:" field. Alternatively I would also not shy away from editing the task/script myself, but I have no clue where to find it and how to do that...

Cheers,

holsten
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Kodi Notification 401 Unauthorized

Post by rednoah »

You'll have to paste it verbatim:

Code: Select all

curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://<user>:<pswd>@<host>:<port>/jsonrpc
:!: Unfortunately, the {...} are going to be interpreted away by FileBot, so bad luck, out of options there. If your command itself contains {...} then things do get more tricky.



The thing you can do, if you're advanced enough to log in via SSH and run commands, is creating a new shell script with your command, and then simply calling your shell script via --def exec, e.g.

Code: Select all

--def exec=/path/to/my/script.sh
:!: /path/to/my/script.sh will need to be created by you. You just need to copy & paste your curl command into a shell script, make it executable, and then tell filebot to just call that.

EDIT: Run Program should say /path/to/my/script.sh in this case. Since /path/to/my/script.sh does not contain {...} you won't run into any issues there.
:idea: Please read the FAQ and How to Request Help.
holsten
Posts: 17
Joined: 15 Nov 2015, 14:38

Re: Kodi Notification 401 Unauthorized

Post by holsten »

OK almost there...
I made the script which I can execute using Task Manager (Run: bash /volume1/Shared/UpdateV.sh)

Here is the script

Code: Select all

#!/opt/bin/sh
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://<user>:<pswd>@<host>:<port>/jsonrpc
If I call the script with "Run Program:" I get this log:

Code: Select all

Dear user,

Task Scheduler has completed a scheduled task.

Task: FileBot Task-MoviesTellKodiV9
Start time: Fri, 12 Jun 2020 16:28:10 GMT Stop time: Fri, 12 Jun 2020 16:30:13 GMT Current status: 0 (Normal) Standard output/error:
Run script [fn:amc] at [Fri Jun 12 16:29:05 CEST 2020]
Parameter: ut_label = Movie
Parameter: music = y
Parameter: unsorted = y
Parameter: clean = y
Parameter: minLengthMS = 300000
Parameter: minFileSize = 0
Parameter: exec = /volume1/Shared/UpdateV.sh
Parameter: seriesFormat = {n}/{n} - Season {s}/{n} - {s00e00} - {t}
Parameter: movieFormat = {n} ({y})
Argument[0]: /volume1/Movies
Ignore system path: /volume1/Movies/@eaDir
Input: /volume1/Movies/Reign of Fire (2002).mkv
Group: {Movie=true} => [Reign of Fire (2002).mkv] Rename movies using [TheMovieDB] Auto-detect movie from context [/volume1/Movies/Reign of Fire (2002).mkv] [MOVE] from [/volume1/Movies/Reign of Fire (2002).mkv] to [/volume1/XBMC/Movies/Reign of Fire (2002).mkv] [REFRESH] Refresh File Services (/volume1/XBMC/Movies) Processed 1 files
Execute: /volume1/Shared/UpdateV.sh
sh: /volume1/Shared/UpdateV.sh: /opt/bin/sh^M: bad interpreter: No such file or directory Clean clutter files and empty folders Done ヾ(@⌒ー⌒@)ノ


From StoRRage
I tried different options for the shebang

Code: Select all

/bin/bash
/bin/sh
/opt/bin/bash
What could be the reason that it still is not working? Alternatively, I could schedule the task directly in Task Scheduler, but would be nicer getting it going with FileBot.

Cheers,

holsten
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Kodi Notification 401 Unauthorized

Post by rednoah »

#/bin/sh should do. The main problem is ^M which indicates that you're using Windows line endings, and not Unix line endings.
https://en.wikipedia.org/wiki/Newline#I ... ne_formats


:idea: Make sure that you're using a proper code editor, if you're writing the script file on Windows, since Windows tools like to add invisible control characters (e.g. BOM, CR, etc) that break things.
:idea: Please read the FAQ and How to Request Help.
holsten
Posts: 17
Joined: 15 Nov 2015, 14:38

Re: Kodi Notification 401 Unauthorized

Post by holsten »

Eureka! Notepad++ did the trick. Truly impressed how you even spotted invisible symbols...

Code: Select all

Execute: /volume1/Shared/UpdateV.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   111  100    45  100    66   2926   4291 --:--:-- --:--:-- --:--:--  4714
{"id":"mybash","jsonrpc":"2.0","result":"OK"}Clean clutter files and empty folders Done ヾ(@⌒ー⌒@)ノ
ヾ(@⌒ー⌒@)ノヾ(@⌒ー⌒@)ノヾ(@⌒ー⌒@)ノヾ(@⌒ー⌒@)ノヾ(@⌒ー⌒@)ノヾ(@⌒ー⌒@)ノ
Thanks for the excellent support!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Kodi Notification 401 Unauthorized

Post by rednoah »

holsten wrote: 12 Jun 2020, 16:31 Truly impressed how you even spotted invisible symbols...
Experience. Everyone makes the same mistakes. Everyone has to learn these things through trial and error. :lol:
:idea: Please read the FAQ and How to Request Help.
Post Reply