adminExitium 355 Posted May 31, 2024 Posted May 31, 2024 Is there an easy way to add multiple libraries at once to Emby rather than doing it one by one and waiting for each one to be scanned? When it was stored in folders, it was easy enough to copy all the folders at once while Emby was stopped and then just run a Full Scan to get all of them scanned but since they have been moved to the DB, I haven't been able to figure out a way to do it via the API. 1
softworkz 5066 Posted May 31, 2024 Posted May 31, 2024 9 hours ago, adminExitium said: Is there an easy way to add multiple libraries at once to Emby rather than doing it one by one and waiting for each one to be scanned? I'm not quite sure whether I understand. I'm not aware that it would be required to wait for a library scan to be completed before adding another library? Same like during the first-time setup: You can add multiple libraries without needing to wait for one to be scanned before adding another one, that's not different to when adding libraries via API.
Happy2Play 9780 Posted May 31, 2024 Posted May 31, 2024 43 minutes ago, softworkz said: I'm not quite sure whether I understand. I'm not aware that it would be required to wait for a library scan to be completed before adding another library? Same like during the first-time setup: You can add multiple libraries without needing to wait for one to be scanned before adding another one, that's not different to when adding libraries via API. Previously if we had to create a new database the /root/default folder was readd and all libraries were recreated. Now the folder no longer exists or used as they are DB only. So is there a way to apply say all 10 libraries at once in a new DB? But suspect you can only POST one at a time.
softworkz 5066 Posted May 31, 2024 Posted May 31, 2024 11 minutes ago, Happy2Play said: But suspect you can only POST one at a time. Correct, but what's the problem with doing 10 posts in a row? I mean, it's an infrequently used API with a large range of parameters and probably also doing some checks against existing libraries for conflicting settings (like folders or names).
softworkz 5066 Posted May 31, 2024 Posted May 31, 2024 If you would have a single API for adding multiple libs and the the 5th one conflicts with the 2nd one, then we would have to fail the API, but then we would either have to rollback 1 to 4 or leave an incomplete result. That would buy more trouble than it can provide convenience.
adminExitium 355 Posted June 1, 2024 Author Posted June 1, 2024 Doing 10 POSTs in a row has some rough edges that I have encountered while trying it over the last 2 weeks due to the current behaviour of immediately triggering a scan when a new library is added and then attempting to cancel that scan when a new library is added. Some issues from the same: Due to triggering a complete scan of all libraries (rather than just the newly added library), I have seen that the cancelling of the scan (when a new library is added) can sometimes take hours during which adding of even more new libraries can fail occasionally. Depending on which point in time a scan gets cancelled, it can occasionally result in a new library being present solely as an item in the scan and never actually gets scanned. I have found it happen twice in the last few weeks and each time forcing a full scan or only a scan of that library doesn't help. Emby just skips over the added library as if it doesn't exist even if it's visible in the UI. Only solution to that has been removing and adding the library again after ensuring there's no full scan running. 10 hours ago, softworkz said: 5th one conflicts with the 2nd one 10 hours ago, softworkz said: rollback 1 to 4 I am not sure what you mean by a conflict here since AFAIK, Emby allows the same paths in multiple libraries and that's pretty much the only possible point of conflict. And even if it's a conflict, why can't it be failed immediately on adding the libraries (without scanning anything) which should be pretty much instantaneous? Just rolling back the actual library additions should be pretty quick if the scan can be delayed till all the libraries in the API request have been processed and added.
softworkz 5066 Posted June 1, 2024 Posted June 1, 2024 I'm not saying that a rollback cannot be done. I'm saying that it requires additional implementation that is not worth the effort. Why do you even want to cancel a library scan after adding a library? Just add your libraries and that's it. You should not need to take any other actions.
Happy2Play 9780 Posted June 1, 2024 Posted June 1, 2024 I guess ensuring "RefreshLibrary": true," is false would add the library without a scan, correct? { "Name": "string", "CollectionType": "string", "RefreshLibrary": true, "Paths": [ "string" ] So add each library with false, then on the last on change to true or initial scan manually after all libraries are added.
adminExitium 355 Posted June 1, 2024 Author Posted June 1, 2024 1 hour ago, softworkz said: Why do you even want to cancel a library scan after adding a library? That happens automatically by Emby after adding a library, doesn't matter whether the addition is via the API or the UI.
adminExitium 355 Posted June 1, 2024 Author Posted June 1, 2024 49 minutes ago, Happy2Play said: I guess ensuring "RefreshLibrary": true," is false would add the library without a scan, correct? Thanks for pointing that out. Will give it a try in a few days and revert back in case no one else responds before then confirming or negating it.
Happy2Play 9780 Posted June 1, 2024 Posted June 1, 2024 Can you verify you are not seeing access/parental controls issues when creating a new library.db. Have not tested this recently but I ran into that issue as there appears to be some sort of users.db/library.db mismatch is what I will call it. And have to toggle parental controls on each user to see libraries/new libraries. But that was a test a while ago. So will retest when I get a chance.
adminExitium 355 Posted June 2, 2024 Author Posted June 2, 2024 I generally don't create libraries after having created the users because I faced some issues with that a year or so back. Since then, I always create all the required libraries first and then the users and I haven't noticed any issues with that even as recent as last week.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now