Jump to content

nfo for a folder?


Recommended Posts

Posted

Hi.

I have nfo reader and write enabled for a Home Video type library. Refreshing metadata both reads and writes for individual video files. But I cannot save nfo file for a folder. I can change metadata of a folder in UI (e.g add tags to it), tags for a folder are displayed in UI (and you can navigate to corresponent folder back). But no matter what I do, nfo file is not created for a folder. This is a big problem, because as soon you move the folder to different place you lose all tags (they are stored only in db, and cleared after folder moves)

Posted

Hello winstream,

** This is an auto reply **

Please wait for someone from staff support or our members to reply to you.

It's recommended to provide more info, as it explain in this thread:


Thank you.

Emby Team

Posted

Hi, there are currently no nfo files for plain folders. Why do you edit metadata for those?

Posted
7 hours ago, Luke said:

Hi, there are currently no nfo files for plain folders. Why do you edit metadata for those?

Because it is a folder that holds metadata for similar video files. For example, a tutorial with multiple lessons. To keep tags consolidated (and not to waste efforts on tagging individual lessons) a folder is the best place.

Emby's folder view is a unique feature that other media servers don't have (or require specific folder structure and mess up file names all the time anyway). Nfo for a folder will make this feature even more useful and robust.

The implementation seems straightforward and well-aligned with nfo for files:

  •  folder already stores metadata in the database
  •  this metadata can be written and read from folder's nfo file
  • the most robust/portable option is just `folder.nfo` file in a folder. But `<folder name>.nfo` scheme (similar to nfo for a file) will be ok too if that aligns better with nfo handling code. It is just less portable - you will need to rename nfo file if you rename folder.
Posted (edited)
 
The result is "204 No Content" and no tag is created.
My request is:
 
POST http://localhost:9096/Items/29206/Tags/Add
Content-Type: application/json
X-Emby-Token: ***
 
{
  "Id": "27353",
  "Name": "test",
}
 
This call doesn't work. In the body of my request I tried to pass the following:
  • valid Id/Name returned by /Tags endpoint
  • new Id/Name (is it supposed to work? how to pass id for a brand new tag?)
  • no body at all
 
In all cases response is the same - 204 No Content. And no tags visible on UI, nor created in db.
 
ItemId in URL I pass is correct (if you pass non existing one - the server returns 500)
 
Log file: 2025-02-06 12:05:52.294 Info Server: http/1.1 Response 204 to ‌‍‍192.168.192.1‌. Time: 3ms. POST http://‌‍‍localhost‌:9096/Items/34826/Tags/Add
 
Emby version: Version 4.8.10.0
Edited by winstream
Posted
6 hours ago, winstream said:
 
The result is "204 No Content" and no tag is created.
My request is:
 
POST http://localhost:9096/Items/29206/Tags/Add
Content-Type: application/json
X-Emby-Token: ***
 
{
  "Id": "27353",
  "Name": "test",
}
 
This call doesn't work. In the body of my request I tried to pass the following:
  • valid Id/Name returned by /Tags endpoint
  • new Id/Name (is it supposed to work? how to pass id for a brand new tag?)
  • no body at all
 
In all cases response is the same - 204 No Content. And no tags visible on UI, nor created in db.
 
ItemId in URL I pass is correct (if you pass non existing one - the server returns 500)
 
Log file: 2025-02-06 12:05:52.294 Info Server: http/1.1 Response 204 to ‌‍‍192.168.192.1‌. Time: 3ms. POST http://‌‍‍localhost‌:9096/Items/34826/Tags/Add
 
Emby version: Version 4.8.10.0

Does the ui allow you to add a tag to the same folder?

Posted (edited)
19 minutes ago, Luke said:

Does the ui allow you to add a tag to the same folder?

Yes, I can add tags via UI (both to folder itemId and file itemId). But not via API. I see that payload accepts array, I probably were passing it wrong, though it seems not the root cause.The endpoint seems just ignoring anything you send and returns 204 (the undocumented status). The only difference it makes when you pass obviously wrong data:

  • wrong ItemId leads to http 500 "Object reference not set to an instance of an object."
  • not JSON payload leads to http 500 "Type definitions should start with a &#39;{&#39;, expecting serialized type &#39;AddTags&#39;"
Edited by winstream
Posted (edited)
POST http://localhost:8096/Items/5/Tags/Add
Content-Type: application/json
X-Emby-Token: xxx

{
  "Tags": [{"Name": "MyTag"}] 
}

This is likely correct payload. At least, by passing empty Name I have verified that TagExtensions.AddTags is actually called, and returns ArgumentNullException as it should.

But when Name is not empty, it doesn't work. I suspect that itemById.UpdateToRepository(ItemUpdateType.MetadataEdit) just does nothing (and doesn't save item.TagItems)

Edited by winstream
Posted

Emby server 4.9.0.37 beta - the same problem

Posted

That post looks correct. I know @TeamBuses this api because I added it for him.

Posted
On 2/7/2025 at 6:13 AM, winstream said:
POST http://localhost:8096/Items/5/Tags/Add
Content-Type: application/json
X-Emby-Token: xxx

{
  "Tags": [{"Name": "MyTag"}] 
}

This is likely correct payload. At least, by passing empty Name I have verified that TagExtensions.AddTags is actually called, and returns ArgumentNullException as it should.

But when Name is not empty, it doesn't work. I suspect that itemById.UpdateToRepository(ItemUpdateType.MetadataEdit) just does nothing (and doesn't save item.TagItems)

this is how I use it

hide_tag_string = "hide-" + user_name
url = "{server}/emby/Items/" + item_id + "/Tags/Add"
post_tag_data = {"Tags": [{"Name": hide_tag_string}]}
res = downloadUtils.download_url(url, post_body=post_tag_data, method="POST")

https://github.com/faush01/plugin.video.embycon/blob/dfa3d148be89a2aeee1dcd1bc23f6bec39bc60a5/resources/lib/functions.py#L573C1-L576C86

 

  • Thanks 1
Posted (edited)

@TeamB This looks similar to what I do. How do you authenticate? Using Username/password? Does it create tag for you?

I authenticate using X-Emby-Token. It potentially can go to newer/different logic which doesn't work.

 

Edited by winstream
Posted
25 minutes ago, winstream said:

@TeamB This looks similar to what I do. How do you authenticate? Using Username/password? Does it create tag for you?

I authenticate using X-Emby-Token. It potentially can go to newer/different logic which doesn't work.

 

yes, username/password then get a token and use that in the auth header

Posted

@TeamB

I tried to post X-Emby-Token returned by users/authenticatebyname. It doesn't make any difference. The result is the same a using static ApiKey from Advanced->Api Keys section that I had been using before.

No tags are added, http response 204 - as I described in my previous posts

Please post your http response of /Tags/Add call

On 2/6/2025 at 8:27 PM, Luke said:

Does the ui allow you to add a tag to the same folder?

@LukeReplying to this again. It does create tag, but UI uses different endpoint (POST /Items/29022), and the request is huge (contains ALL metadata, not just tags). Is there a place on UI that posts just tags to /Tags/Add endpoint?

pünktchen
Posted

Copy, paste error here in the forum? It should be {server}/emby/items/{itemid} not {server}/items/{itemid}.

pünktchen
Posted

But have you really checked wether or not the tag will be added to the item? Because 204 is neither an error nor an unusual response for a post request.

Posted

It doesn't add a tag to an item. I'm talking about this in every my post. I did an extra step and disassembled emby dlls and told which method is called there and which is likely does noop

  • 2 weeks later...
Posted
15 hours ago, Luke said:

Hi, can you try again?

Which version? Was there a release?

Posted
On 2/21/2025 at 9:33 AM, winstream said:

Which version? Was there a release?

No I just mean in the sense that maybe if you give it another shot you'll see what went wrong. Sometimes that can happen when you try something a second time.

Posted

Tags API didn't work to me.
I have implemented my solution by direct database edit. Works great. The drawback is that it must bring Emby offline for an operation to acquire file lock.

One thing is not clear how does Emby process orphan tags (tags that ended up not assigned to any media items) regardless of how tags are assigned/unassigned - via web UI, api or direct db edit. I see that often it eventually cleans up orphan tags from DB. But sometimes they stay. Is there a scheduler? How is it triggered?

Posted
On 2/24/2025 at 4:46 AM, winstream said:

 

One thing is not clear how does Emby process orphan tags (tags that ended up not assigned to any media items) regardless of how tags are assigned/unassigned - via web UI, api or direct db edit. I see that often it eventually cleans up orphan tags from DB. But sometimes they stay. Is there a scheduler? How is it triggered?

The library scan will clean them up.

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