![]() ![]() Movie B (2016)/fileb.srt Movie B (2016)/Movie B (2016). The makemv command is a distributable streaming command. The command line is an 'all or nothing affair'. So if you only want the original German director's commentary, with the Swedish subtitles from the main feature, you can do that. Using MakeMKV for some reason subtitles are always enabled (shows up in both VLC and apple tv) I used your script do make this one liner to set the default flag on all mkv files in a given directory. In this particular case, we can use it to filter out all files, and perform a renaming operation on them.įirst of all, let me give you the solution: find -type f -exec bash -c 'fp=$(dirname "$1") fn=$(basename "$fp") px="$" echo "$f" "$fp"/"$fp"."$ext" done For example, the GUI allows you to select which video, audio, and subtitles, you want to copy. THIS QUESTION IS ABOUT DISABLING-NOT REMOVING SUBTITLE TRACKS FROM MKV FILES FROM THE COMMAND LINE. Solution via find command and -exec flagįind command is useful in many ways, particular when performing operations on multiple levels of directory tree. Move /home/xieerqi/testdir/Movie B (2016)/filea.mkv to. Move /home/xieerqi/testdir/Movie B (2016)/fileb.srt to. Move /home/xieerqi/testdir/Movie A (2014)/filea.mkv to. Move /home/xieerqi/testdir/Movie A (2014)/fileb.srt to. So when we run the script, we shall see the following output: $. Our script lives in the same directory: $ tree I've created a directory with two others, Movie A (2016) and Movie B (2016). Here's an example of how this works in practice. save it as add_location_name.py in the top-most directory Setting up the scriptĪll the standard rules for scripting apply: NOTE: very very important is that to actually rename the files you need to remove # before # os.rename(fullpath,newpath). Print('Move ' + fullpath + ' to ' + newpath ) For this example I used the Correct Horse Battery Staple Password Generator which was inspired by this XKCD comic. Newpath = os.path.join(dir, dir + '.' + extension) Script contents #!/usr/bin/env python3įor dir,subdirs,files in os.walk(treeroot):įullpath = os.path.realpath( os.path.join(dir,f) ) In the script presented below we're doing exactly that - we're finding all files and operating on each one of them, by determining full path to each file, file's extension, and renaming it via os.rename() function. ![]() Python is a quite powerful language for system administration, and traversing directory tree can be done via os.walk() function. Please read instructions carefully for best results. There are multiple ways to approach this question.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |