marktaff 14 Posted November 26, 2019 Posted November 26, 2019 For my use case, emby does a terrible job at identifying movies, for two reasons. First, my files are in proper alphabetical other with respect to the article 'The', i.e. 'Title,The' not 'The Title'. Secondly, filenames have the year and other metadata in them in ways emby doesn't like, i.e. 'Movie.Title,The [2003.1080p.x265.AAC.6CH].mkv'. Changing my filenames to suit emby isn't an option, as that would destroy all my other software that depends on that scheme, such as the code I wrote to help manage my collection. For example, with these filenames, ls and grep are very powerful. To help deal with misidentified items, I quickly hacked the javascript that runs the identify form in emby metadata manager to autofill the year and a search-optimized title, so all I have to do is click 'identify', then 'search' to get the correct result. I keep a copy outside of emby in case it ever gets overwritten by an emby update. The file is just the stock emby file, run through a code formatter so it is readable, plus my minor changes. Overall, it is 3kB larger, most of that is whitespace. The file is /opt/emby-server/system/dashboard-ui/bower_components/emby-webcomponents/itemidentifier/itemidentifier.js After you update the file, you may need to clear your browser cache and restart emby. Also a good idea to rename the original version of the file first so you have a backup if things go wrong. The first interesting bit is the new function 'function parsePath(path)' at lines 92-112. It takes the full file path as input, and must return the search optimized name and year. You will have to edit this function to fit your filenames. function parsePath(path) { var str = path str = str.replace("smb://columbia/public/video/movies/", "") str = str.replace(".mkv", "") str = str.replace(".mp4", "") var tokens = str.split(" [") var rawName = tokens[0] var name = rawName.replace(/\./g, " ") if (name.indexOf(",The") !== -1) { name = name.replace(",The", "") name = "The " + name } if (name.indexOf(",the") !== -1) { name = name.replace(",the", "") name = "The " + name } var data = tokens[1] var dataItems = data.split(".") var year = dataItems[0] return [name, year] } The second interesting bit is lines 163-165, where parsePath() is called, and the results loaded into the proper variables so the form gets auto-filled. var lookupData = parsePath(item.Path) var lookupName = lookupData[0] var lookupYear = lookupData[1] It doesn't help with the auto-identification, but it makes things much easier when you have to manually fix a misidentified movie. HTH.
Luke 42080 Posted November 26, 2019 Posted November 26, 2019 Hi, the reason we don't do this is because usually with Identification you're changing it to something new. In the past we actually did auto-fill it, but what would happen is users would constantly just change one field and then complain that Identify "doesn't work"...well it's because you left the other fields filled in and they needed to be changed or blanked out as well. So to resolve that we found the easiest thing to do was just to start blank. Can you give specific examples of misidentified files? We're always looking to improve that. Thanks.
marktaff 14 Posted November 26, 2019 Author Posted November 26, 2019 Sure. Adventures.In.Babysitting [1987.1080p.x265.AAC.6CH].mkv Adventures.of.Baron.Munchausen,The [1988.1080p.x265.AAC.6CH].mkv Adventures.of.Ford.Fairlane [1990.1080p.x265.AC3.6CH].mkv All auto-identify incorrectly as 'The Adventurers (2017)'. Those are just the ones that stand out near the top of the list; I haven't run my script yet that identifies movies that are likely mis-identified, but that is next on the agenda.
marktaff 14 Posted November 26, 2019 Author Posted November 26, 2019 I ran my script. I have 159 total movies that are are dupes, e.g. all 'Halloween' movies may be identified as the same movie (and not even as one of the 'Halloween' movies!). I have 163 movies where the identified year is more than one year different from the actual year, and an additional 56 that is only one year off (most of those 56 are just where filename and tmdb disagree, but some are different movies).If emby would correctly grab the year from my filenames, I think that alone would go a long way to solving the issue. I would certainly pound that nail first.
Luke 42080 Posted November 26, 2019 Posted November 26, 2019 I think i have these solved. Thanks for the feedback.
marktaff 14 Posted November 26, 2019 Author Posted November 26, 2019 Thanks for looking into it; look forward to the improvements in a future release. :-)
marktaff 14 Posted November 27, 2019 Author Posted November 27, 2019 (edited) I'm trying to restore my watched state, but I've run into issues. The DB Browser method in the backup guide doesn't work, as the schema has changed (old table had 12 columns, new table has 14 columns, plus some data type changes). I put a query together to show me my watched items with filenames/titles, so I can just tick them manually in the gui. However, the results are showing that I've watched *many* items I've never watched. Any ideas what I'm doing wrong?This is the query I'm using: SELECT mediaitems.Path, mediaitems.Name FROM userdatas INNER JOIN mediaitems ON mediaitems.UserDataKeyId = userdatas.UserDataKeyId WHERE userdatas.played = 1 AND mediaitems.Path IS NOT NULL; Thanks! ETA: NM, the query works perfectly! I was executing it with one table from the new db and one table from the old db, from when I was trying to backup guide method. Running it against just the old db worked just fine. :-) Thanks again for all your help, @@LukeEdit2: The SQL is now the query as applied to just the old library.db Edited November 28, 2019 by marktaff
Luke 42080 Posted November 27, 2019 Posted November 27, 2019 We'll need to update that. It will probably be a little more complex now.
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