Jump to content

media .actors folder Import / Export - standalone plugin


mickle026

Recommended Posts

mickle026

Updated 15 Sept 2023 - description at bottom of this post

Updated 06 August 2023 - description at bottom of this post

Updated 05 August 2023 - description at bottom of this post

As requested, import and export .actors folders people as a seperate plugin.

I have done this fairly quickly so have not extensively tested it/checked it all works falwlessly!

Everything should log to its own files and keep out of Emby's main logs now

If you don't know what it is or does then you don't need it!

Use at your own risk, this plugin creates files (export) and changes Emby database (import)

Create files writes to media folders and / or writes to metadata cache library

 

 

680041186_Screenshot2023-01-28at04-17-26Emby.thumb.png.d92fa45beeef755a1ac95dfec6c6d9ae.png

Scheduled task

1697286458_Screenshot2023-01-28at11-26-37Emby.png.c43692a5bf2665abed2f0d66bcdf0372.png

1351165274_Screenshot2023-01-28at11-25-47Emby.png.8ea14357c6aa86718c171e564ff0364d.png

840715186_Screenshot2023-01-28at22-00-47Emby.png.07a93bf75b50505243be4506408d61dd.png

1065113161_Screenshot2023-01-28at22-02-13Emby.png.6547e3cad8aa11b1997e751def6ff0ba.png

 

 

Screenshot 2023-01-28 at 04-16-50 Emby.png

* Updated 24/03/23
=====================

I have left the old version here incase the newer one doesn't work properly.  I have NOT tested it!

Screenshot2023-03-24at19-44-27Emby.png.21876c6a8919e3b4c72b5d30a3da2f0a.png

There is now an option to select the import metadata directory preference for \Metadata\library or \Metadata\people directories.

Code has been added to change the path that the image is put to when the option is selected.

Other than this change, both versions are the same (one with this change and one without) - no need to upgrade if you do not want to.

Kodi_actors_Folders.zip  Kodi_actors_Folders_(MetadataPeopleFolder).zip

 

Updated 20 June 2023

Fixed Null Reference Exception when Actor image path is not null but an empty string - this shouldn't happen but seemingly can happen!
When it occures the plugin simply exits, and doesnt finish its task.

The Fix Now logs this as a path error and skips over it to continue so the plugin doesn't just quit and exit.

Also a code edit for getting Images from http paths [ERROR - Debug Below] messages in your logs.
Code to wait for the filesystem to actually save the temporary file to disk before trying to copy it &
Exception Trace logging if it still fails.
Logging made better for overwrite / do not overwrite destination instead of a error
Logs should all go into the log directory on all systems now.

If anyone still gets this null reference error, please let me know

Kodi_actors_Folders(20-07-2023).zip

* Updated & Reuploaded with Import changes to metadata path & option to write to a-z folders

 

Kodi_actors_Folders(21-07-2023).zip

Kodi_actors_Folders(21-07-2023) (2nd Release).zip

 

05 August 2023

* Fix for sporadic null reference error (caused by http.listener) - which stopped export.
* Improved Invalid name handling
* Added MovieList Export on activation
* Added Timeframe option of people to export

Kodi_actors_Folders (05-08-2023).zip

06 August 2023

* Added Error Traps for random export errors, recovers fully now,continues and logs (if selected).
Kodi_actors_Folders (06-08-2023).zip

15 September 2023

* Added Import / Export of Provider ID stub files

* Corrected settings that didn't save properly.

This was done primarily for my own use, so it might not be ideal for everyone.  Basically it allows you to export imdb,tmdb,tvmaze ids (currently just these three, I will add more provider ids later) with the poster images

I have not tested the import yet but the code is there to do it...

This is solely to help prevent duplicate people in my database and eventually make my db more and more correct over time, and also to work with my other plugins....

stubs.jpg.749ed35a6a657084319306e67a8ac7e2.jpg

Screenshot2023-09-15at15-36-40MIKE-PC.png.6ebfc58f7c69be16c5768977af870837.png

They are just plain text files with the provider id inside.

Kodi_actors_Folders.zip

Edited by mickle026
  • Like 4
  • Thanks 6
Link to comment
Share on other sites

GrimReaper

Looks like if run from plugin settings>"Import missing only" triggers .actors(ALL)_Repair. If run from Scheduled tasks it correctly triggers .actors(MISSING)_Repair. Minor issue, just so you can be aware.

Link to comment
Share on other sites

mickle026
8 hours ago, GrimReaper said:

Looks like if run from plugin settings>"Import missing only" triggers .actors(ALL)_Repair. If run from Scheduled tasks it correctly triggers .actors(MISSING)_Repair. Minor issue, just so you can be aware.

Actually its running the missing only code, just reporting to the wrong log file, but thanks, I've fixed that, and added an export scheduled task too.

 

Link to comment
Share on other sites

GrimReaper
2 hours ago, mickle026 said:

Actually its running the missing only code, just reporting to the wrong log file, but thanks, I've fixed that, and added an export scheduled task too.

 

Dunno, as log was saying it's copying all images, starting with legendary Stan Lee, and timestamp confirmes that.

image.png.41b3ac8ad53a0f8e6d003d5aeb8bc095.png

 

Edited by GrimReaper
Link to comment
Share on other sites

mickle026

Aha gotya!

Spotted an Error in the logic, it should be sorted (should be! - LOL) - re-uploaded.

Im off to the pub now :) 🍺

Thanks

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
mixXxim

@mickle026

Thank you for the great plugin.
A tiny cosmetic thing maybe:
According to the log, the images are correctly copied to the .actors folder, but the emby interface shows o copied folders. like I said just a little thing.
Kind regards and many thanks

 

0 People exported.jpg

Link to comment
Share on other sites

mickle026
On 12/03/2023 at 10:38, mixXxim said:

@mickle026

Thank you for the great plugin.
A tiny cosmetic thing maybe:
According to the log, the images are correctly copied to the .actors folder, but the emby interface shows o copied folders. like I said just a little thing.
Kind regards and many thanks

 

0 People exported.jpg

Thanks,

Updated to fix this issue

fix.jpg.d4be2df5caf02c38f89f71e30b15986d.jpg

Logs them as well as reports them when finished.

Screenshot2023-03-15at03-22-30Emby.png.8686eb94451fa0bd1ec406166cbc66bd.png

Edited by mickle026
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
tr0nllam

Is there anyway this plugin could be modified to copy the imported images into the metadata/people folders rather than the metadata/library folder? In the current format, you have to re-import the images if you ever want to move the images to a new database rather than just being able to copy the metadata/people folder over.

Link to comment
Share on other sites

mickle026
16 hours ago, tr0nllam said:

Is there anyway this plugin could be modified to copy the imported images into the metadata/people folders rather than the metadata/library folder? In the current format, you have to re-import the images if you ever want to move the images to a new database rather than just being able to copy the metadata/people folder over.

Yes that is entirely possible, I'll add it to my 'todo' list.

Link to comment
Share on other sites

mickle026

@tr0nllamA new version has been added to the first post with your request implimented.  It is untested!!!!!

Kodi_actors_Folders_(MetadataPeopleFolder).zip

Screenshot2023-03-24at19-44-27Emby.png.93621fb50c5dce7622a8bc24d43219ba.png

Link to comment
Share on other sites

sydlexius

@mickle026Would it be possible in a future enhancement to make sure that when "Log the Operation to file" is selected, that the log entries go into the logs folder?

Link to comment
Share on other sites

mickle026
1 hour ago, sydlexius said:

@mickle026Would it be possible in a future enhancement to make sure that when "Log the Operation to file" is selected, that the log entries go into the logs folder?

Where are they going on your system (and what type of system is it) ? - I was not aware that they were not on anyones systems...

Edited by mickle026
Link to comment
Share on other sites

sydlexius
46 minutes ago, mickle026 said:

Where are they going on your system (and what type of system is it) ? - I was not aware that they were not on anyones systems...

I run Emby in a docker container, and the log files are going into the /config path, not /config/logs.  Your other Actors plugins have worked in the past (though some of the tasks outputted log file names with leading spaces).

Link to comment
Share on other sites

tr0nllam
On 3/24/2023 at 3:52 PM, mickle026 said:

@tr0nllamA new version has been added to the first post with your request implimented.  It is untested!!!!!

Kodi_actors_Folders_(MetadataPeopleFolder).zip

Screenshot2023-03-24at19-44-27Emby.png.93621fb50c5dce7622a8bc24d43219ba.png

The new version is copying images to "programdata\metadata\metadata\library\people\Actor Name\folder.jpg" when it should be "programdata\metadata\people\Actor Name-tmdb-xxxxxxx\folder.jpg"

 

For the new method to work, the plugin needs to know the proper providerID to add to the folder. The tmdb id is the default folder id, but it also accepts imdb id if there is no tmdb id available. I don't know how difficult that is to implement.

Edited by tr0nllam
Link to comment
Share on other sites

mickle026
On 25/03/2023 at 04:13, sydlexius said:

I run Emby in a docker container, and the log files are going into the /config path, not /config/logs.  Your other Actors plugins have worked in the past (though some of the tasks outputted log file names with leading spaces).

I don't see any reason for the incorrect log paths, I have not decided the path on my own string its embys own log path.

My Plugin  uses Embys internally assigned Logpath and appends the filename to it.

string LogPath = Current.configurationManager.ApplicationPaths.LogDirectoryPath;
string MyLog = Path.Combine(LogPath, ReportName + ".txt");

log.KodiFolder_ioLogging(MyLog, DateTime.Now.ToString("dd.MMM.yyy  -  HH'.'mm'.'ss") + $" The Logging Text");

log.KodiFolder_ioLogging(filename,string to write);

17 hours ago, tr0nllam said:

The new version is copying images to "programdata\metadata\metadata\library\people\Actor Name\folder.jpg" when it should be "programdata\metadata\people\Actor Name-tmdb-xxxxxxx\folder.jpg"

 

For the new method to work, the plugin needs to know the proper providerID to add to the folder. The tmdb id is the default folder id, but it also accepts imdb id if there is no tmdb id available. I don't know how difficult that is to implement.

I'll look at this when I have time. :)

Link to comment
Share on other sites

mickle026
On 25/03/2023 at 04:13, sydlexius said:

I run Emby in a docker container, and the log files are going into the /config path, not /config/logs.  Your other Actors plugins have worked in the past (though some of the tasks outputted log file names with leading spaces).

Found one instance where its doing it for a Export Actors to '.actors' scheduled task, I have fixed that so I'll update it for next release - thanks.

Link to comment
Share on other sites

  • 3 months later...
tr0nllam
23 hours ago, mickle026 said:

Updated 20 June 2023 - See First post for description of fixes

Did you ever figure out of it's possible to copy the imported files to the default people folder (programdata\metadata\people\Actor Name-tmdb-xxxxxxx\folder.jpg)?

I noticed the new version is still using "programdata\metadata\library\people\Actor Name\folder.jpg" rather than adding the tmdbid or imdbid to the folder and putting it where the others are.

Link to comment
Share on other sites

mickle026

the option is in the config to write to the people folder

kodi.png.bee00336d5504842d2a72dac520fc10c.png

 

I coded that way back when .... I couldnt remember off hand if it added the tmdb bit to the folder, but it puts them in the people folder

Quote

(programdata\metadata\people\Actor Name-tmdb-xxxxxxx\folder.jpg)?

it definately put them here programdata\metadata\people\Actor Name\folder.jpg and writes the folder.jpg file if the option is checked

Anyway ..........

I just checked and it didnt add the tmbd id so I just coded it in to do that if it exists now

it'll write like this in priority order of tmdb, imdb, tvmaze

programdata\metadata\people\Actor Name-tmdb-xxxxxxx\folder.jpg
programdata\metadata\people\Actor Name-imdb-xxxxxxx\folder.jpg
programdata\metadata\people\Actor Name-tvmaze-xxxxxxx\folder.jpg

and fallback to

programdata\metadata\people\Actor Name\folder.jpg

if no provider id's are available

I also added a fix to invalid http urls errors that the previous fixes highlighted..

I'll re-upload now

 

Link to comment
Share on other sites

tr0nllam
14 minutes ago, mickle026 said:

the option is in the config to write to the people folder

kodi.png.bee00336d5504842d2a72dac520fc10c.png

 

I coded that way back when .... I couldnt remember off hand if it added the tmdb bit to the folder, but it puts them in the people folder

it definately put them here programdata\metadata\people\Actor Name\folder.jpg and writes the folder.jpg file if the option is checked

Anyway ..........

I just checked and it didnt add the tmbd id so I just coded it in to do that if it exists now

it'll write like this in priority order of tmdb, imdb, tvmaze

programdata\metadata\people\Actor Name-tmdb-xxxxxxx\folder.jpg
programdata\metadata\people\Actor Name-imdb-xxxxxxx\folder.jpg
programdata\metadata\people\Actor Name-tvmaze-xxxxxxx\folder.jpg

and fallback to

programdata\metadata\people\Actor Name\folder.jpg

if no provider id's are available

I also added a fix to invalid http urls errors that the previous fixes highlighted..

I'll re-upload now

 

I have that option checked and it was still sending them to metadata\library\people\ instead of metadata\people. Maybe it has something to do with what my library path is set at in the Emby options. I'll test it out on the new version.

EDIT: It's correctly adding the ids to the folder in the newest version, but it's still putting them in the metadata\library\people folder instead of metadata\people.

What do you have your Emby metadata path set at? Mine is listed as "C:\Users\xxx\AppData\Roaming\Emby-Server\programdata\metadata"

Edited by tr0nllam
Updated Information
Link to comment
Share on other sites

tr0nllam

I created a new Emby server to test it and this is what I've found:

If you choose "Use .actors Images (All Images)" from the plugin options, it imports images to "programdata\metadata\library\people"

If you choose "Use .actors Images (Missing Images ONLY)" from the plugin options, it imports images to "programdata\metadata\metadata\library\people"

If you choose "Import Actors from .actors - missing only" from Scheduled tasks, it imports images to "programdata\metadata\library\people"

So, for me, none of the actor import options send them to the correct directory.

Also, I'm not sure if it's related, but I've also noticed that if you're using the default metadata directory, Emby won't write it to system.xml file, so it's impossible to change unless you manually edit it.

 

Link to comment
Share on other sites

mickle026

OK, I see the problem with the metadata paths.

Thanks for the information @tr0nllam

I have made the necessary edits and rebuilt/re-uploaded it.

It seems to be working correctly here, let me know if its right for you too.....as I use a custom path of my choice rather than the internal one.

 

 

 

Link to comment
Share on other sites

tr0nllam
54 minutes ago, mickle026 said:

OK, I see the problem with the metadata paths.

Thanks for the information @tr0nllam

I have made the necessary edits and rebuilt/re-uploaded it.

It seems to be working correctly here, let me know if its right for you too.....as I use a custom path of my choice rather than the internal one.

 

 

 

The two .actors tasks in the plugin options are now sending to the proper people folder, however, I just realized that they're sending all the people to the same directory rather than using a-z folders like Emby does. So, instead of "programdata\metadata\people\Adam Bellamy-imdb-nm7708400" it should be "programdata\metadata\people\a\Adam Bellamy-imdb-nm7708400."

Also, The Scheduled Tasks missing actors task is still sending to the "programdata\metadata\library\metadata\people" path rather than the newer one.

Edited by tr0nllam
Link to comment
Share on other sites

GrimReaper
1 hour ago, tr0nllam said:

I just realized that they're sending all the people to the same directory rather than using a-z folders like Emby does. So, instead of "programdata\metadata\people\Adam Bellamy-imdb-nm7708400" it should be "programdata\metadata\people\a\Adam Bellamy-imdb-nm7708400."

That depends on the installation, Emby also does alphabet folderless. 

Edited by GrimReaper
Link to comment
Share on other sites

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