Jump to content

Tools/Feature Request to Remove "Orphaned/Unmatched" BIF Files


Go to solution Solved by sydlexius,

Recommended Posts

sydlexius
Posted

So after searching some of the discussion topics, I didn't find one that touched on this specifically.  I'm fine with Emby being unable to monitor for external filename changes and thus being unable to match renaming the BIF files.  Perhaps a feature or plugin can be developed to handle such changes?  I get that this would be challenging for users that keep multiple versions in the same folder.  Additionally, perhaps there's external tools or scripts that can manage this? @GrimReaper, I tried seeing how I could add .BIF as a monitored filetype to TinyMediaManager, but am having challenges with how to keep my existing naming convention while renaming such resources?  Anyhow, I hope this isn't a duplicate request.

TL;DR: I renamed/deleted my media files, and now the .BIF filenames don't match up or are orphaned.

GrimReaper
Posted (edited)

Hey up, syd

It is somewhat possible via TMM, but you'll need a bulk-renaming tool (like Advanced Renamer or any other of choice) in addition. 

(bear with me and gimme 5 minutes as I have to edit this post thrice else images will be all around the place since I'm on mobile and it's tricky to get them in between text) 

If I understood you correctly, scenario is as below, movie folder with old bif file:

 

Screenshot 2022-06-10 180549.png

 

In TMM Settings>General>File types, add .bif under "Subtitle and Additional File Types".

Update Source(s) afterwards so those .bifs get read by TMM, else they'll remain ignored:

 

Screenshot 2022-06-10 175438.png

 

In TMM Renamer settings use ${movie.originalFilename} token as Filename argument:

 

Screenshot 2022-06-10 175458.png

 

If you now dry run Rename/Cleanup, you can see only .bif file will be renamed according new/changed/updated moviefilename:

 

Screenshot 2022-06-10 175648.png

 

However, it will lose suffix (like -320-10) for which you can batch-search *.bif on OS level and just add that at the end with any bulk-renaming utility. 

Edited by GrimReaper
Screenshots are PITA
  • Thanks 1
sydlexius
Posted

@GrimReaperThis is a good stop-gap solution. I had most of those options configured, however I was getting back bogus original name values. I ended up nuking the movies and tvshow dB files. I'll script the appended values to the filenames afterwards. 

I'm hoping a better, more automated solution can be developed. @ebr, please don't close this thread just yet. 

  • Like 1
sydlexius
Posted

@GrimReaperSo much for that being the solution.  I finally ran the rename/cleanup, and got tons of errors indicating that the misnamed BIF cannot be changed due to the correctly named one also existing.  I tried to see if there was an option to force overwrites, but no such luck.  I'm going to just egrep the output of the log file to get the list of BIFs that couldn't be renamed and nuke them.  I wish I knew shell scripting better, as I could just resolve this whole issue with a bunch of 'ls', 'grep', 'xargs' and 'rm' commands...probably more, but I'm just a junior Linux admin (even though I've worked with it since '94...shouldn't have focused on Windows!).

rbjtech
Posted

The 'arr's automatically rename all associated files with the same name on a rename - may be useful to others, probably a bit late for you ..

GrimReaper
Posted
29 minutes ago, sydlexius said:

@GrimReaperSo much for that being the solution.  I finally ran the rename/cleanup, and got tons of errors indicating that the misnamed BIF cannot be changed due to the correctly named one also existing.  I tried to see if there was an option to force overwrites, but no such luck.  I'm going to just egrep the output of the log file to get the list of BIFs that couldn't be renamed and nuke them.  I wish I knew shell scripting better, as I could just resolve this whole issue with a bunch of 'ls', 'grep', 'xargs' and 'rm' commands...probably more, but I'm just a junior Linux admin (even though I've worked with it since '94...shouldn't have focused on Windows!).

Ah, so you have both new and old bifs there. Yeah, too bad, won't work on that case. Windows guy myself, maybe we should move your topic to Linux forum subsection, so you might possibly get some assistance there? 

sydlexius
Posted
2 hours ago, rbjtech said:

The 'arr's automatically rename all associated files with the same name on a rename - may be useful to others, probably a bit late for you ..

Been there, tried that. I just finished a massive project to rename all of my video-based media. I made sure to add the big filetype in the settings. 

sydlexius
Posted (edited)
On 6/11/2022 at 7:34 AM, GrimReaper said:

Ah, so you have both new and old bifs there. Yeah, too bad, won't work on that case. Windows guy myself, maybe we should move your topic to Linux forum subsection, so you might possibly get some assistance there? 

That may make the most sense. 

Edited by sydlexius
Quoted some other idiot (namely, myself)
GrimReaper
Posted

*Moved*

  • Solution
sydlexius
Posted
On 6/11/2022 at 7:34 AM, GrimReaper said:

Ah, so you have both new and old bifs there. Yeah, too bad, won't work on that case. Windows guy myself, maybe we should move your topic to Linux forum subsection, so you might possibly get some assistance there? 

So this isn't a "universal" solution, but it worked for my situation.  Specifically, my new file naming convention included square brackets ( [] ) where it was almost certainly not found in the old naming convention.  So I simply made use of the "find" command to identify and remove the unwanted BIFs, as such:

 find . -name "*.bif" -and -not -name "*[*.bif" -and -not -name "theme*.bif" -delete

This produced almost exactly what I want.  If it deleted a correctly-named BIF, then I can live with that.

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