Coder Social home page Coder Social logo

dta9191 / videocodecrename Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 72 KB

Python program using FFProbe3 to recursively search all files in a directory, identify video files, and add their codec to the file name for easy filtering in any system.

License: GNU General Public License v3.0

Python 100.00%

videocodecrename's People

Contributors

dta9191 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

videocodecrename's Issues

Does not output new file names until program has finished.

My original code printed out the name of the file it was working on, as it opened. It did this using nested if statements for each codec. I recently changed over to searching through a dictionary of known codecs. That new method is cleaner and more efficient, but does not print out the current file name until after the entire operation has completed. This adds the requirement for a progress bar of some sort. Fixing this could remove the need for a progress bar, or at least suppliment one.

Requires Write Permission for Files, Never Prompts

To rename files, the program has to be opened by a user who has permission to do so. Opening from a standard desktop or menu shortcut may or may not give necessary permissions. Program needs to attempt to open with elevated privileges and prompt user for credentials. There are currently no warnings that this is a problem, and file rename operations fail without warning.

Unused import of serial module

Left over code from the project before, used as a template. Not used, safe to remove. Non standard serial module called, causing failure to run on stock installations.

Serial module imported, but not needed.

The serial import from the previous project, used as a template for this one, got left behind, causing extra errors. Causes the program to fail in cases as that isn't a standard Python module, which defeats the goal of this project.

Over complicated handling of string cases in extensions.

Current video extensions list contains both upper and lower case versions. Can be simplified with <if ex in file.lower()>. Best practice to convert strings to either or lower case, then run comparison checks. Found by user on Reddit.

Complicated output code.

Outputting to user display requires excessive code. Can use helper methods to clean up and simplify code. Found by reddit user.

Error in ffprobe3 module

When trying to run against directory full of video project folders, get the following error. Seems to be a problem with certain files. Suspected files contain the extension ".mp4.pfl"

Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.6/tkinter/init.py", line 1705, in call
return self.func(*args)
File "/home/dustin/Documents/Projects/CodecRenameUtility/JUNK.py", line 153, in add_pressed
metadata = FFProbe(str(current))
File "/usr/local/lib/python3.6/dist-packages/ffprobe3/ffprobe.py", line 47, in init
self.streams.append(FFStream(data_lines))
File "/usr/local/lib/python3.6/dist-packages/ffprobe3/ffprobe.py", line 78, in init
(key, val) = a.strip().split('=')
ValueError: not enough values to unpack (expected 2, got 1)

Removes Codec From Files Other Than Video Files

The program will remove the codec from the *.nfo files used by Jellyfin Media Server, as they share the exact name. The nfo file is generated by Jellyfin when scanning new media and includes data about the movie, such as actors, as well as file info. When the names match, Jellyfin may just use the existing nfo file, even though the video file has changed. This would cause issues with displaying resolution and codec data on the client side. When the video file is changed, the nfo file needs to be updated. Jellyfin may notice a file name change and generate a new nfo file, bt this behavior is unconfirmed. The program could simply delete the nf file of the same name, forcing Jellyfin to create a new one. This would require either a server administrator to know the files have changed and force a media scan, or have instant file scanning enabled in Jellyfin. I disable instant scans as they slow down such systems as the Raspberry Pi 400.

Slow performance, not multithreaded.

For use on systems with many cores and many files, a more efficient and multithreaded implementation will be needed. At first glance, it appears Python may not be a great language for this. Need to research further.

"List All Files" Count is Off.

There are currently 110 files in the Videos directory, but the program shows that there are 112. Searched in Linux Mint using a search for . in file manager.

No progress indicators

Without any sort of progress indicator, it's hard to know if the program crashed, or is just running slowly. Considering counting all the files as a first operation, using a spinning progress indicator, then use that count to make a more accurate progress indicator.

Option to remove [ERROR] from file name.

I'd like to be able to identify all the files that cause an error with ffprobe3, but then have the ability to remove just that tag, and not a valid codec in the file name.

Total Runtime Display

There is currently no counter for how long it took the operation to run. This would be very useful for development, and interesting to the user. Need to learn how to work with time maths.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.