Why am I having this error editing files with mkvpropedit? - windows

I use mkvpropedit to edit audio tracks in my movies and it works, MOSTLY.
I found out today that for some of my movies (in .mkv of course) it give me this error:
Error: Updating the 'Tracks' element failed. Reason: The file could not be opened for writing.
Possible reasons are: the file is not a Matroska file; the file is write-protected; the file is locked by another process; you do not have permission to access the file.
These files are in the same folder of the others that actually works, and the permissions are all the same.
I tried to remux one of this "corrupt movie" (the movies are perfectly fine to watch) and the edit works in that way. But since they're a lot, and also they're in the same folder with the "good ones", I'd rather to understand why it give me this error, instead of remux everything.

Check if the file (s) have the "read only" attribute checked. If so, you can go to the containing folder -> properties -> uncheck "read-only" (this is to apply to all files and subfolders, if not, you can do it per file). Then try to run the command.

Related

How to restore a folder structure 7Zip'd with split volume option?

I 7Zip'd a multi-gig folder which contained many folders each with many files using the split to volumes (9Meg) option. 7Zip created files of type .zip.001,
.zip.002, etc. When I extract .001 it appears to work correctly but I get an 'unexpected end of data' error. 7Zip does not automatically go to .002. When I extract .002, it also gives the same error and it does not continue the original folder/file structure. Instead it extracts a zip file in the same folder as the previously extracted files. How do I properly extract split files to obtain the original folder/file structure? Thank you.

How do I copy specific file types with Maid?

I'm a first time Ruby user (any programming code for that matter) and I'm trying to create a script within "maid" to copy all of my music from a specific folder into the "automatically add to itunes" folder:
rule 'Move Downloaded Music to iTunes' do
FileUtils.cp_r '/Users/*********/Movies/*********/Music/.',
'/Users/*********/Music/iTunes/iTunes Media/Automatically Add to iTunes/',
:remove_destination => true
end
However, I have non-music files within that same folder and I want to include only files with audio formats (mp3, m4a, etc.)
How can I append this code so that I can choose which file types are copied?
Additionally, what is the difference between cp_r and cp?
Any advice or improvements to my code are more than welcome - I've seen people try to do similar things with much more complicated code, so in a sense I'm worried mine is too simple...Thanks for the help!!
You can use Dir::glob to find the files and FileUtils::mv to move them:
require 'fileutils'
Dir.glob('/Users/.../Music/*.{mp3,m4a}') do |filename|
FileUtils.mv(filename, '/Users/.../Automatically Add to iTunes/')
end
Maid provides some helper methods that would assist with this. Let's piece them together, individually.
# Find all files in your Downloads
dir('~/Downloads/*')
# Find **any kind of audio files** in your Downloads
where_content_type(dir('~/Downloads/*'), 'audio')
# Copy these specific MP3 files in Downloads to a specific iTunes folder
copy(['~/Downloads/song_1.mp3', '~/Downloads/song_2.mp3'],
'~/Music/iTunes/iTunes Media/Automatically Add to iTunes/')
# Copy any MP3 files in Downloads to a specific iTunes folder
copy(dir('~/Downloads/*.mp3'),
'~/Music/iTunes/iTunes Media/Automatically Add to iTunes/')
We can put those pieces together for the full intent, namely copying audio files to the "Automatically Add to iTunes" folder.
Maid.rules do
rule 'copy audio files to the "Automatically Add to iTunes" folder' do
copy(where_content_type(dir('~/Downloads/*'), 'audio'),
'~/Music/iTunes/iTunes Media/Automatically Add to iTunes/')
end
end
If you'd like, this can be broken down using variables -- it's Ruby after all.
Maid.rules do
rule 'copy audio files to the "Automatically Add to iTunes" folder' do
files_in_downloads = dir('~/Downloads/*')
audio_files_in_downloads = where_content_type(files_in_downloads, 'audio')
automatically_add_to_itunes_folder = '~/Music/iTunes/iTunes Media/Automatically Add to iTunes/'
copy(audio_files_in_downloads, automatically_add_to_itunes_folder)
end
end
I hope this helps!
To copy special type files, use
Dir.foreach(absolute_path) do |file|
if file.downcase.end_with?('.mp3', 'mp4', ....)
FileUtils.cp(file, final_dir)
end
end
Travel all folder to select which file can copy instead copying all folder by your code.
Ps: cp_r and cp is equal to cp -r and cp in console, means copy a folder or only a file.

s3cmd sync is remote copying the wrong files to the wrong locations

I've got the following as part of a shell script to copy site files up to a S3 CDN:
for i in "${S3_ASSET_FOLDERS[#]}"; do
s3cmd sync -c /path/to/.s3cfg --recursive --acl-public --no-check-md5 --guess-mime-type --verbose --exclude-from=sync_ignore.txt /path/to/local/${i} s3://my.cdn/path/to/remote/${i}
done
Say S3_ASSET_FOLDERS is:
("one/" "two/")
and say both of those folders contain a file called... "script.js"
and say I've made a change to two/script.js - but not touched one/script.js
running the above command will firstly copy the file from /one/ to the correct location, although I've no idea why it thinks it needs to:
INFO: Sending file
'/path/to/local/one/script.js', please wait...
File
'/path/to/local/one/script.js'
stored as
's3://my.cdn/path/to/remote/one/script.js' (13551
bytes in 0.1 seconds, 168.22 kB/s) [1 of 0]
... and then a remote copy operation for the second folder:
remote copy: two/script.js -> script.js
What's it doing? Why?? Those files aren't even similar. Different modified times, different checksums. No relation.
And I end up with an s3 bucket with two incorrect files in. The file in /two/ that should have been updated, hasn't. And the file in /one/ that shouldn't have changed is now overwritten with the contents of /two/script.js
Clearly I'm doing something bizarrely stupid because I don't see anyone else having the same issue. But I've no idea what??
First of all, try to run it without --no-check-md5 option.
Second, I suggest you to pay attention to directory names, specifically trailing slashes.
s3cmd documentation says:
With directories there is one thing to watch out for – you can either upload the directory and its contents or just the contents. It all depends on how you specify the source.
To upload a directory and keep its name on the remote side specify the source without the trailing slash
On the other hand to upload just the contents, specify the directory it with a trailing slash

Creating empty directories / folders in InstallAnywhere 2011

I have a script which collected together a number of files to be installed. This includes a number of empty directories.
Previously I would use the D flag in the manifest file which would copy empty directories. However due to the way I generate the manifest files (as part of our build process) I can sometimes end up with two D entries with the same destination folder. e.g:
D;${A_LIB}/all/pysys/${PYSYS_VERSION}/lib/python2.7/site-packages;./third_party/python/lib/python2.7/site-packages;COMMON;${UNIX}
D;${A_LIB_BT}/python/${PYTHON_VERSION};./third_party/python;COMMON;${ALL}
This causes InstallAnywhere to fail to build the installer.
To get around this I rewrote the manifest generation code to parse the directories previously pointed to by a D and replace the D entry with F entries for each file in the directory.
Unfortunately this will not include empty directories (which we may / may not need in the installer but in general it's just safer to create them than have some piece of code fail because they're not there).
I've tried the following in the manifest. Reference, Reference3 and Reference4 are empty, Reference2 contains a single directory (which is itself empty). Only Reference2 is present in the install - the other three which are empty directories seem to get excluded.
D,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference,./samples/pysys/cor_002/Reference
D,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference2,./samples/pysys/cor_002/Reference2
D,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference3/.,./samples/pysys/cor_002/Reference3/.
D,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference4/../Reference4,./samples/pysys/cor_002/Reference4/../Reference4
I've also tried increasing the log level but this has not revealed anything. Is there a way to increase this log level?
export LAX_DEBUG=true
Any suggestions?
DISCLAIMER: I've cross posted this to InstallAnywhere's forums but I will do my best to keep the answers in sync and spread the knowledge.
I can't speak to your manifest challenges. However, my first thought is to change the manifest generator to be sensitive to duplicate output locations -- maybe by storing them in a Map or Set -- and then handling collisions when they occur by failing the build or adjusting the output location(s).
On the other hand, I can tell you how to increase the verbosity of your installer.
Make the installer more verbose by adding:
-Dlax.debug.all=true -Dlax.debug.level=3
to Project > JVM Settings > Installer Settings (tab) > Optional Installer Arguments > Additional Arguments. You'll want to remove these before you ship. You can also add these to the command line when you start the installer. Level values of 4 and 5 work, too, and are even more verbose.
You can also make your installer print its progress to the console by going to Project > JVM Settings > Log Settings. Here, uncheck Include debug output (stderr and stdout). Then enter the word console in Send stderr to: and Send stdout to:. Rather than console, you can also set a specific file name. You'll also want to undo these settings before you ship.
The solution turns out to be so blindingly simple that I never tried it.
To get EMPTY directories installed by Install Anywhere you have to specify the directories as files in the manifest. So with the following directory structure:
Reference <empty>
Reference2
testdir <empty>
Reference3 <empty>
Reference4 <empty>
You need to specify the entries in the manifest as F. Specifying then as D will only result in the "Reference2" directory being included.
F,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference,./samples/pysys/cor_002/Reference
F,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference2,./samples/pysys/cor_002/Reference2
F,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference3/.,./samples/pysys/cor_002/Reference3/.
F,$IA_PROJECT_DIR$/samples/pysys/cor_002/Reference4/../Reference4,./samples/pysys/cor_002/Reference4/../Reference4
Sorry to answer my own question, really wasn't the plan!

Working in Xcode: Can't find exiftool:Can't locate Image/ExifTool.pm

But it's there.
any ideas?
It happens when I am trying to get metadata from an image file (this is AppleScript running a shell script):
on getMetaData(filePath)
-->get meta data
try
set myCommand to (quoted form of (POSIX path of (pathToExifTool)) & " " & quoted form of (POSIX path of (filePath)))
set thisMetaData to (do shell script myCommand)
on error errMsg
log "Can't find exiftool:" & errMsg
end try
...
pathToExifTool is this:
/Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool"
and exists.
Here's the complete error thrown:
"Can't find exiftool:Can't locate Image/ExifTool.pm in #INC (#INC contains: /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/lib /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level /Network/Library/Perl/5.8.8 /Network/Library/Perl /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool line 30.
BEGIN failed--compilation aborted at /Users/steve/Desktop/XCodeApps/ImageArchiveDeluxeX/build/Release/ImageArchiveDeluxeX.app/Contents/Resources/exiftool line 30."
Well the bundle is a mess (lots of .pm files floating about - they look to be duplicates) but the exiftool-->image-->ExifTool.pm path is there.
====================================
Here's the solution h/t to Sherm
Apparently my directory structure went all to hell for some reason, either I did it unknowingly or something with XCode as Sherm indicated decided to wreck havoc. Anyway, (bear with my incredibly non-technical description) when working in XCode, yellow folders (or groups as they call them for some odd reason) will not be added to your bundle...hence exiftool (if you look at the first image) had no hierarchy to find its needed files, as evidenced by the bundle screen capture. I basically trashed all the related exiftool files from the app (right click/delete/delete references) and then brought them back in from the finder. You'll note in the third screen cap those directories are now blue. These will be built with the app.
Have you looked inside your app bundle's Resources/ dir to verify that the directory structure is maintained when you copy these files? IIRC, that doesn't happen automatically; the default behavior is to "flatten" resources, ignoring Xcode groups and simply copying all resource files into the top-level Resources/ directory.
You can avoid the default behavior by removing those groups & file references from your Xcode project - don't delete the files of course! Then, re-add the "lib" directory, taking care to choose the "Create Folder References" option.

Resources