New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON/RPC Support adding new videos #20797
base: master
Are you sure you want to change the base?
Conversation
I've made some formatting changes to meet the current code style. The diffs are available in the following links: For more information please see our current code style guidelines. |
Can't comment on the code and if it's correct or not. But could you please explain a usecase where a user is in need of using the JSON RPC to add a movie which haven't been added to the library by scraping? Most likely, if scraping fails, it's a naming problem of files/folders and users should probably rename their files in order to be scraped correctly. So, what's the usecase to forcefully add a movie to the library if the scraper fails to scrape? Also not too sure if using the filename as the title is a good idea. Tools like MakeMKV for example are often using default filesnames such as |
Spontaneously the following reasons spring to mind:
and
for whatever reason. You mention that .nfo files would allow getting files into the library that It is the same reason: It provides a way to fill the library with The JSON/RPC API provides functionality to be performed via In fact users of the JSON/RPC API are not the same users as those generating Regarding this concrete PR: The functionality provided by it is very much |
The reason the file name is set as the default title is that otherwise the title would be blank. Having multiple entries with a title of "title01" is better than having multiple entries with blank titles. It is expected of course that the user of the API uses the Therefore my question above:
This would allow for avoiding the "auto-generated" title at all by directly providing it in the same method call. However, calling
I am not sure what you mean here. What does the scraper use the title for? Actually a scraper would fill in the title as this method does. Also by using the JSON/RPC API it would not be necessary (but still possible) to use the scraper to override the title. The API is used to override it. |
Afaik there is no way in Kodi to just add a single movie to the database, without either scraping or supplying an NFO file. You can play video files on your system with existing calls already. I can't see the benefit of adding movies to the database that contain zero metadata. |
Description
This PR adds support for adding new movies to the library.
I plan to extend it to support adding TV shows, TV show series and TV show episodes as well as Music Videos, but want to get these changes for the addition of movies into shape first.
Motivation and context
This PR extends the utility of the JSON/RPC interface by adding support for the creation of new entries in the library.
At the moment it is possible to set all details for movies (and TV shows, etc.) via JSON/RPC, but only for files that are already existing in the library. This requires a successful scan of those videos into the library.
In the case the scan does not import those files or using the scan functionality is not desired, it is not possible to add those items to the library via JSON/RPC.
How has this been tested?
I tested it by executing the corresponding JSON/RPC function. The files were correctly inserted into the database and are accessible from the Kodi UI then. Calling VideoLibrary.SetVideoDetails afterwards does also work as expected.
What is the effect on users?
It increases the utility of the JSON/RPC interface by offering users a way to create entries for movies (TV shows, etc.) in the library.
Screenshots (if appropriate):
Types of change
Checklist:
Open questions:
The PR is (apart from the missing functionality to add other types of video than movies) ready.
However I have a few questions about possible changes to the PR.
To be able to call
VideoDatabase::AddNewMovie
from theVideoLibrary
I had to change the visiblity of it.If this is not desired, how should I handle his? Add another method in
VideoDtabase
that delegates toVideoDatabase::AddNewMovie
? This would not provide any benefit in my opinion.hupfdule@8c265cd#diff-1c9dd1b7b484ba7a64c670d64a855bfe5ff9e8ba31da75a3be351223a3b61815R915-R917
At the moment this new function only creates the entry in the library and sets the title to the filename. All remaining information has to be set afterwards by calling
VideoLibrary.SetMovieDetails
. It would be possible to allow setting all the same fields that can be modified viaVideoLibrary.SetMovieDetails
inVideoLibrary.AddMovie
as well. This would remove the need for calling a second function by providing the ability to create the entry and fill it with data in the same call.Is there any guideline/convention on whether to provide this functionality?