Jump to content

Remove unused .nfo and thumb files with no associated video file?


Recommended Posts

Posted

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? 😄

Posted

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.

Posted

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?

Posted

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
Posted (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 by BillOatman
  • Like 2
Posted
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 ! 

Posted

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

Posted

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.

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