dexus 27 Posted February 6, 2022 Posted February 6, 2022 Hi! I was wondering if there was an easy way to remove unused .nfo and .jpg files left in the system after a file rename? I use tv-rename to manage my tv-series and to move episodes into the library. But sometimes it will rename episodes that had a previously unknown name, or has been corrected in thetvdb, leaving a .nfo and a .jpg thumb without a video. Emby will then generate new .nfo and thumbs, thus you are stuck with duplicates with different names. I guess I could find or get someone smarter than me to write a script that searches through the library for orphan jpg's and .nfo's but it seems to me that this would be a function that the server should have in the first place? Or am I the only one with this dilemma?
Luke 42083 Posted February 6, 2022 Posted February 6, 2022 Hi, there is no function in Emby Server to do this. I would think whatever software is doing the rename should probably be the one to handle those kinds of leftovers.
dexus 27 Posted February 7, 2022 Author Posted February 7, 2022 The problem with that, is that the software in question, Tv-rename, which is used to copy and rename tv-shows based on the names of episodes in Thetvdb doesn't generate the .nfo and thumbnail jpg's. So it is unaware that those exist. It will however rename an already present file in the library, if it changes on Thetvdb. I.e. when an episode at first have the name "Show - S01E01 - Episode 1" Is later renamed to something else, i.e "Show - S01E01 - Actual episode name" When it does, Emby will index the new file again, generating new thumbs and .nfo, leaving the .jpg and .nfo of the previous name in the library cluttering and taking up space. Given that Emby is aware of all the files it "should" have available in the library folders, would it be possible to implement a "clean up" routine to remove files that are orphaned, or simply not supposed to be there?
Tangsgod 22 Posted February 7, 2022 Posted February 7, 2022 You could go to your main folder make a search for .nfo then delete all of them at once from there. Same for .jpeg
BillOatman 596 Posted February 7, 2022 Posted February 7, 2022 (edited) There is a similar situation with recordings. If you record something then at some later time delete it in Emby, the recording file is gone but the directory and nfo file is still there. I had thought about creating a garbage collector plugin with a scheduled task for that but haven't so far. Edited February 7, 2022 by BillOatman 2
Tangsgod 22 Posted February 7, 2022 Posted February 7, 2022 52 minutes ago, BillOatman said: There is a similar situation with recordings. If you record something then at some later time delete it in Emby, the recording file is gone but the directory and nfo file is still there. I had thought about creating a garbage collector plugin with a scheduled task for that but haven't so far. That would be a very usefull plugin !
dexus 27 Posted February 7, 2022 Author Posted February 7, 2022 It would indeed! Such a plugin would be much appreciated! The problem with deleting all the jpg's and .nfo's is that you would have to generate the .nfo's each time, and you'd also delete all the custom logo's, backdrops etc. and regenerating 1000's of files thumbs and such does take time and resources.
BillOatman 596 Posted February 8, 2022 Posted February 8, 2022 6 hours ago, dexus said: It would indeed! Such a plugin would be much appreciated! The problem with deleting all the jpg's and .nfo's is that you would have to generate the .nfo's each time, and you'd also delete all the custom logo's, backdrops etc. and regenerating 1000's of files thumbs and such does take time and resources. The theory would be for recordings is if there is no .ts file, delete everything in the directory then the directory itself. If there is a .ts file leave that directory alone.
dexus 27 Posted February 8, 2022 Author Posted February 8, 2022 I was thinking for tv-series it would be, if a .nfo (except for season.nfo and tvshow.nfo) exists, and there is no media file (.mkv, .avi, .mp4) with the same base name, then delete the .nfo. Same for jpg. If there is a jpg other than the regular system jpg's (fanart, landscape, poster etc.) and there is no media-file with the same base-name, delete the jpg.
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